diff --git a/BUILD.gn b/BUILD.gn
index f6cf775..92a85782 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -725,7 +725,7 @@
       "//chrome/browser/vr:vr_common_unittests",
       "//chrome/browser/vr:vr_pixeltests",
     ]
-    if (is_linux && use_ozone) {
+    if (is_desktop_linux && use_ozone) {
       deps += [ "//chrome/browser/vr/testapp:vr_testapp" ]
     }
     if (is_android) {
diff --git a/DEPS b/DEPS
index 844fe54..f314726 100644
--- a/DEPS
+++ b/DEPS
@@ -95,7 +95,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling build tools
   # and whatever else without interference from each other.
-  'buildtools_revision': '6fe4a3251488f7af86d64fc25cf442e817cf6133',
+  'buildtools_revision': '437a616be5b2056336ed3ca5c33c41f7788ede09',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling SwiftShader
   # and whatever else without interference from each other.
@@ -103,7 +103,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling PDFium
   # and whatever else without interference from each other.
-  'pdfium_revision': '4d7a11b0819cc396245697c4e9bebb20737c59b2',
+  'pdfium_revision': '28cb9a764765ed3e3fc981ff6f4e9e0519033954',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling openmax_dl
   # and whatever else without interference from each other.
@@ -135,7 +135,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': 'fbd65219a8245c27c19f00ea37d3136e00d9a993',
+  'catapult_revision': 'b4706e73204bf551ca2f85fce8cbe23ef7d0df31',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
@@ -282,7 +282,7 @@
   },
 
   'src/third_party/auto/src': {
-      'url': Var('chromium_git') + '/external/github.com/google/auto.git' + '@' + '71802f2ae74dae2744abd999f8434e13055c4ee3',
+      'url': Var('chromium_git') + '/external/github.com/google/auto.git' + '@' + '8a81a858ae7b78a1aef71ac3905fade0bbd64e82',
       'condition': 'checkout_android',
   },
 
@@ -333,7 +333,7 @@
   },
 
   'src/third_party/depot_tools':
-    Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '5d6b00fac64a829cca5637bb76abe618291b8b60',
+    Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'd12f91d8829fc30b7d19a89069b55c4b833f960d',
 
   'src/third_party/devtools-node-modules':
     Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'),
diff --git a/android_webview/browser/aw_browser_policy_connector.cc b/android_webview/browser/aw_browser_policy_connector.cc
index c7ffd4f..df0be7ea 100644
--- a/android_webview/browser/aw_browser_policy_connector.cc
+++ b/android_webview/browser/aw_browser_policy_connector.cc
@@ -63,10 +63,11 @@
 
 AwBrowserPolicyConnector::AwBrowserPolicyConnector()
    : BrowserPolicyConnectorBase(base::Bind(&BuildHandlerList)) {
-  SetPlatformPolicyProvider(
+  std::vector<std::unique_ptr<policy::ConfigurationPolicyProvider>> providers;
+  providers.push_back(
       std::make_unique<policy::android::AndroidCombinedPolicyProvider>(
           GetSchemaRegistry()));
-  InitPolicyProviders();
+  SetPolicyProviders(std::move(providers));
 }
 
 AwBrowserPolicyConnector::~AwBrowserPolicyConnector() {}
diff --git a/android_webview/browser/test/aw_content_browser_client_unittest.cc b/android_webview/browser/aw_content_browser_client_unittest.cc
similarity index 100%
rename from android_webview/browser/test/aw_content_browser_client_unittest.cc
rename to android_webview/browser/aw_content_browser_client_unittest.cc
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn
index b05dd23..10ff6a15 100644
--- a/android_webview/test/BUILD.gn
+++ b/android_webview/test/BUILD.gn
@@ -275,6 +275,7 @@
   ]
 
   sources = [
+    "../browser/aw_content_browser_client_unittest.cc",
     "../browser/aw_contents_client_bridge_unittest.cc",
     "../browser/aw_form_database_service_unittest.cc",
     "../browser/aw_media_url_interceptor_unittest.cc",
@@ -292,7 +293,6 @@
     "../browser/permission/permission_request_handler_unittest.cc",
     "../browser/renderer_host/auto_login_parser_unittest.cc",
     "../browser/state_serializer_unittest.cc",
-    "../browser/test/aw_content_browser_client_unittest.cc",
     "../browser/test/fake_window.cc",
     "../browser/test/fake_window.h",
     "../browser/test/rendering_test.cc",
diff --git a/ash/app_list/app_list_presenter_delegate.cc b/ash/app_list/app_list_presenter_delegate.cc
index 54a0daee..c263438 100644
--- a/ash/app_list/app_list_presenter_delegate.cc
+++ b/ash/app_list/app_list_presenter_delegate.cc
@@ -39,7 +39,7 @@
 gfx::Point GetCenterOfDisplayForWindow(aura::Window* window,
                                        int minimum_height) {
   DCHECK(window);
-  gfx::Rect bounds = ScreenUtil::GetDisplayBoundsWithShelf(window);
+  gfx::Rect bounds = screen_util::GetDisplayBoundsWithShelf(window);
   ::wm::ConvertRectToScreen(window->GetRootWindow(), &bounds);
 
   // If the virtual keyboard is active, subtract it from the display bounds, so
diff --git a/ash/app_list/model/app_list_model.cc b/ash/app_list/model/app_list_model.cc
index 6246b538..129442d 100644
--- a/ash/app_list/model/app_list_model.cc
+++ b/ash/app_list/model/app_list_model.cc
@@ -246,7 +246,7 @@
       observer.OnAppListItemWillBeDeleted(item);
     top_level_item_list_->DeleteItem(id);
     for (auto& observer : observers_)
-      observer.OnAppListItemDeleted();
+      observer.OnAppListItemDeleted(id);
     return;
   }
   AppListFolderItem* folder = FindFolderItem(item->folder_id());
@@ -257,7 +257,7 @@
     observer.OnAppListItemWillBeDeleted(item);
   child_item.reset();  // Deletes item.
   for (auto& observer : observers_)
-    observer.OnAppListItemDeleted();
+    observer.OnAppListItemDeleted(id);
 }
 
 void AppListModel::DeleteUninstalledItem(const std::string& id) {
diff --git a/ash/app_list/model/app_list_model_observer.h b/ash/app_list/model/app_list_model_observer.h
index 7edb7110..bf9c9089 100644
--- a/ash/app_list/model/app_list_model_observer.h
+++ b/ash/app_list/model/app_list_model_observer.h
@@ -5,6 +5,8 @@
 #ifndef ASH_APP_LIST_MODEL_APP_LIST_MODEL_OBSERVER_H_
 #define ASH_APP_LIST_MODEL_APP_LIST_MODEL_OBSERVER_H_
 
+#include <string>
+
 #include "ash/app_list/model/app_list_model.h"
 #include "ash/app_list/model/app_list_model_export.h"
 
@@ -24,7 +26,7 @@
   virtual void OnAppListItemWillBeDeleted(AppListItem* item) {}
 
   // Triggered just after an item is deleted from the model.
-  virtual void OnAppListItemDeleted() {}
+  virtual void OnAppListItemDeleted(const std::string& id) {}
 
   // Triggered after |item| has moved, changed folders, or changed properties.
   virtual void OnAppListItemUpdated(AppListItem* item) {}
diff --git a/ash/display/display_move_window_util_unittest.cc b/ash/display/display_move_window_util_unittest.cc
index 4900c09a8..cdf526f 100644
--- a/ash/display/display_move_window_util_unittest.cc
+++ b/ash/display/display_move_window_util_unittest.cc
@@ -116,14 +116,14 @@
   // Set window to maximized state.
   window_state->Maximize();
   EXPECT_TRUE(window_state->IsMaximized());
-  EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(window),
+  EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(window),
             window->bounds());
   PerformMoveWindowAccel(DisplayMoveWindowDirection::kRight);
   EXPECT_EQ(display_manager()->GetDisplayAt(1).id(),
             screen->GetDisplayNearestWindow(window).id());
   // Check that window state is maximized and has updated maximized bounds.
   EXPECT_TRUE(window_state->IsMaximized());
-  EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(window),
+  EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(window),
             window->bounds());
 
   // Set window to fullscreen state.
diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc
index 6de837b..7d28850a 100644
--- a/ash/display/window_tree_host_manager_unittest.cc
+++ b/ash/display/window_tree_host_manager_unittest.cc
@@ -1482,7 +1482,7 @@
                              const gfx::Rect& old_bounds,
                              const gfx::Rect& new_bounds,
                              ui::PropertyChangeReason reason) override {
-    shelf_display_bounds_ = ScreenUtil::GetDisplayBoundsWithShelf(window);
+    shelf_display_bounds_ = screen_util::GetDisplayBoundsWithShelf(window);
   }
 
   const gfx::Rect& shelf_display_bounds() const {
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 1661a41..e0d60df 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -165,7 +165,7 @@
 
   const bool update_bounds = state->IsNormalOrSnapped() || state->IsMinimized();
   gfx::Rect work_area_in_new_parent =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(new_parent);
+      screen_util::GetDisplayWorkAreaBoundsInParent(new_parent);
 
   gfx::Rect local_bounds;
   if (update_bounds) {
diff --git a/ash/screen_util.cc b/ash/screen_util.cc
index fdc568a..6827a57 100644
--- a/ash/screen_util.cc
+++ b/ash/screen_util.cc
@@ -17,39 +17,35 @@
 
 namespace ash {
 
-// static
-gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) {
+namespace screen_util {
+
+gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window) {
   if (Shelf::ForWindow(window)->shelf_widget())
     return GetDisplayWorkAreaBoundsInParent(window);
   return GetDisplayBoundsInParent(window);
 }
 
-// static
-gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) {
+gfx::Rect GetDisplayBoundsInParent(aura::Window* window) {
   gfx::Rect result =
       display::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds();
   ::wm::ConvertRectFromScreen(window->parent(), &result);
   return result;
 }
 
-// static
-gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
+gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window) {
   gfx::Rect result =
       display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area();
   ::wm::ConvertRectFromScreen(window->parent(), &result);
   return result;
 }
 
-// static
-gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParentForLockScreen(
-    aura::Window* window) {
+gfx::Rect GetDisplayWorkAreaBoundsInParentForLockScreen(aura::Window* window) {
   gfx::Rect bounds = Shelf::ForWindow(window)->GetUserWorkAreaBounds();
   ::wm::ConvertRectFromScreen(window->parent(), &bounds);
   return bounds;
 }
 
-// static
-gfx::Rect ScreenUtil::GetDisplayBoundsWithShelf(aura::Window* window) {
+gfx::Rect GetDisplayBoundsWithShelf(aura::Window* window) {
   if (!Shell::Get()->display_manager()->IsInUnifiedMode())
     return window->GetRootWindow()->bounds();
 
@@ -80,4 +76,6 @@
   return gfx::Rect(gfx::ToCeiledSize(size));
 }
 
+}  // namespace screen_util
+
 }  // namespace ash
diff --git a/ash/screen_util.h b/ash/screen_util.h
index f7d6221..9c8ce825 100644
--- a/ash/screen_util.h
+++ b/ash/screen_util.h
@@ -6,51 +6,48 @@
 #define ASH_SCREEN_UTIL_H_
 
 #include "ash/ash_export.h"
-#include "base/macros.h"
 
 namespace aura {
 class Window;
-}
+}  // namespace aura
 
 namespace gfx {
 class Rect;
-}
+}  // namespace gfx
 
 namespace ash {
 
-class ASH_EXPORT ScreenUtil {
- public:
-  // Returns the bounds for maximized windows in parent coordinates.
-  // Maximized windows trigger auto-hiding the shelf.
-  static gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window);
+namespace screen_util {
 
-  // Returns the display bounds in parent coordinates.
-  static gfx::Rect GetDisplayBoundsInParent(aura::Window* window);
+// Returns the bounds for maximized windows in parent coordinates.
+// Maximized windows trigger auto-hiding the shelf.
+ASH_EXPORT gfx::Rect GetMaximizedWindowBoundsInParent(aura::Window* window);
 
-  // Returns the display's work area bounds in parent coordinates.
-  static gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window);
+// Returns the display bounds in parent coordinates.
+ASH_EXPORT gfx::Rect GetDisplayBoundsInParent(aura::Window* window);
 
-  // Returns the display's work area bounds in parent coordinates on lock
-  // screen, i.e. for work area with forced bottom alignment.
-  // Note that unlike |GetDisplayWorkAreaBoundsInParent|, this method uses
-  // work area bounds that are updated when the screen is locked. For example
-  // if shelf alignment is set to right before screen lock,
-  // |GetDisplayWorkAreaBoundsInParent| will return work are bounds for right
-  // shelf alignment - this method will return work area for bottom shelf
-  // alignment (which is always used on lock screen).
-  static gfx::Rect GetDisplayWorkAreaBoundsInParentForLockScreen(
-      aura::Window* window);
+// Returns the display's work area bounds in parent coordinates.
+ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParent(aura::Window* window);
 
-  // Returns the bounds of the physical display containing the shelf for
-  // |window|. Physical displays can differ from logical displays in unified
-  // desktop mode.
-  // TODO(oshima): Consider using physical displays in window layout, instead of
-  // root windows, and only use logical display in display management code.
-  static gfx::Rect GetDisplayBoundsWithShelf(aura::Window* window);
+// Returns the display's work area bounds in parent coordinates on lock
+// screen, i.e. for work area with forced bottom alignment.
+// Note that unlike |GetDisplayWorkAreaBoundsInParent|, this method uses
+// work area bounds that are updated when the screen is locked. For example
+// if shelf alignment is set to right before screen lock,
+// |GetDisplayWorkAreaBoundsInParent| will return work are bounds for right
+// shelf alignment - this method will return work area for bottom shelf
+// alignment (which is always used on lock screen).
+ASH_EXPORT gfx::Rect GetDisplayWorkAreaBoundsInParentForLockScreen(
+    aura::Window* window);
 
- private:
-  DISALLOW_IMPLICIT_CONSTRUCTORS(ScreenUtil);
-};
+// Returns the bounds of the physical display containing the shelf for
+// |window|. Physical displays can differ from logical displays in unified
+// desktop mode.
+// TODO(oshima): Consider using physical displays in window layout, instead of
+// root windows, and only use logical display in display management code.
+ASH_EXPORT gfx::Rect GetDisplayBoundsWithShelf(aura::Window* window);
+
+}  // namespace screen_util
 
 }  // namespace ash
 
diff --git a/ash/screen_util_unittest.cc b/ash/screen_util_unittest.cc
index ec9a64cd..ceecb2b 100644
--- a/ash/screen_util_unittest.cc
+++ b/ash/screen_util_unittest.cc
@@ -32,29 +32,29 @@
   // Maximized bounds. By default the shelf is 47px tall (ash::kShelfSize).
   EXPECT_EQ(
       gfx::Rect(0, 0, 600, 552).ToString(),
-      ScreenUtil::GetMaximizedWindowBoundsInParent(primary->GetNativeView())
+      screen_util::GetMaximizedWindowBoundsInParent(primary->GetNativeView())
           .ToString());
   EXPECT_EQ(
       gfx::Rect(0, 0, 500, 452).ToString(),
-      ScreenUtil::GetMaximizedWindowBoundsInParent(secondary->GetNativeView())
+      screen_util::GetMaximizedWindowBoundsInParent(secondary->GetNativeView())
           .ToString());
 
   // Display bounds
   EXPECT_EQ("0,0 600x600",
-            ScreenUtil::GetDisplayBoundsInParent(primary->GetNativeView())
+            screen_util::GetDisplayBoundsInParent(primary->GetNativeView())
                 .ToString());
   EXPECT_EQ("0,0 500x500",
-            ScreenUtil::GetDisplayBoundsInParent(secondary->GetNativeView())
+            screen_util::GetDisplayBoundsInParent(secondary->GetNativeView())
                 .ToString());
 
   // Work area bounds
   EXPECT_EQ(
       gfx::Rect(0, 0, 600, 552).ToString(),
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(primary->GetNativeView())
+      screen_util::GetDisplayWorkAreaBoundsInParent(primary->GetNativeView())
           .ToString());
   EXPECT_EQ(
       gfx::Rect(0, 0, 500, 452).ToString(),
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(secondary->GetNativeView())
+      screen_util::GetDisplayWorkAreaBoundsInParent(secondary->GetNativeView())
           .ToString());
 }
 
@@ -110,11 +110,11 @@
 
   UpdateDisplay("500x400");
   EXPECT_EQ("0,0 500x400",
-            ScreenUtil::GetDisplayBoundsWithShelf(window).ToString());
+            screen_util::GetDisplayBoundsWithShelf(window).ToString());
 
   UpdateDisplay("500x400,600x400");
   EXPECT_EQ("0,0 500x400",
-            ScreenUtil::GetDisplayBoundsWithShelf(window).ToString());
+            screen_util::GetDisplayBoundsWithShelf(window).ToString());
 
   // Move to the 2nd physical display. Shelf's display still should be
   // the first.
@@ -122,11 +122,11 @@
   ASSERT_EQ("800,0 100x100", widget->GetWindowBoundsInScreen().ToString());
 
   EXPECT_EQ("0,0 500x400",
-            ScreenUtil::GetDisplayBoundsWithShelf(window).ToString());
+            screen_util::GetDisplayBoundsWithShelf(window).ToString());
 
   UpdateDisplay("600x500");
   EXPECT_EQ("0,0 600x500",
-            ScreenUtil::GetDisplayBoundsWithShelf(window).ToString());
+            screen_util::GetDisplayBoundsWithShelf(window).ToString());
 }
 
 TEST_F(ScreenUtilTest, ShelfDisplayBoundsInUnifiedDesktopGrid) {
@@ -158,12 +158,12 @@
   // Regardless of where the window is, the shelf is always in the top left
   // display in the matrix.
   EXPECT_EQ(gfx::Rect(0, 0, 499, 400),
-            ScreenUtil::GetDisplayBoundsWithShelf(window));
+            screen_util::GetDisplayBoundsWithShelf(window));
 
   // Move to the bottom right display.
   widget->SetBounds(gfx::Rect(620, 940, 100, 100));
   EXPECT_EQ(gfx::Rect(0, 0, 499, 400),
-            ScreenUtil::GetDisplayBoundsWithShelf(window));
+            screen_util::GetDisplayBoundsWithShelf(window));
 }
 
 }  // namespace ash
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 59b29a3..3d64a13 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -195,7 +195,7 @@
 
 gfx::Rect ShelfLayoutManager::GetIdealBounds() {
   aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
-  gfx::Rect rect(ScreenUtil::GetDisplayBoundsInParent(shelf_window));
+  gfx::Rect rect(screen_util::GetDisplayBoundsInParent(shelf_window));
   return SelectValueForShelfAlignment(
       gfx::Rect(rect.x(), rect.bottom() - kShelfSize, rect.width(), kShelfSize),
       gfx::Rect(rect.x(), rect.y(), kShelfSize, rect.height()),
@@ -699,7 +699,7 @@
 
   aura::Window* shelf_window = shelf_widget_->GetNativeWindow();
   gfx::Rect available_bounds =
-      ScreenUtil::GetDisplayBoundsWithShelf(shelf_window);
+      screen_util::GetDisplayBoundsWithShelf(shelf_window);
   available_bounds.Inset(0, chromevox_panel_height_, 0, 0);
   int shelf_width = PrimaryAxisValue(available_bounds.width(), shelf_size);
   int shelf_height = PrimaryAxisValue(shelf_size, available_bounds.height());
@@ -783,7 +783,7 @@
   CHECK_EQ(GESTURE_DRAG_IN_PROGRESS, gesture_drag_status_);
   bool horizontal = shelf_->IsHorizontalAlignment();
   aura::Window* window = shelf_widget_->GetNativeWindow();
-  gfx::Rect available_bounds = ScreenUtil::GetDisplayBoundsWithShelf(window);
+  gfx::Rect available_bounds = screen_util::GetDisplayBoundsWithShelf(window);
   int resistance_free_region = 0;
 
   if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN &&
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 870a437e..547ade4 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -1840,7 +1840,7 @@
     gfx::Rect shelf_bounds =
         is_overflow_mode()
             ? owner_overflow_bubble_->bubble_view()->GetBubbleBounds()
-            : ScreenUtil::GetDisplayBoundsWithShelf(shelf_window);
+            : screen_util::GetDisplayBoundsWithShelf(shelf_window);
 
     switch (shelf_->alignment()) {
       case SHELF_ALIGNMENT_BOTTOM:
diff --git a/ash/system/toast/toast_manager_unittest.cc b/ash/system/toast/toast_manager_unittest.cc
index c08b6a6..b4d84bc 100644
--- a/ash/system/toast/toast_manager_unittest.cc
+++ b/ash/system/toast/toast_manager_unittest.cc
@@ -183,7 +183,7 @@
 
   gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
   gfx::Rect root_bounds =
-      ScreenUtil::GetDisplayBoundsWithShelf(shelf->GetWindow());
+      screen_util::GetDisplayBoundsWithShelf(shelf->GetWindow());
 
   EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds()));
   EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1);
@@ -210,7 +210,7 @@
 
   gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
   gfx::Rect root_bounds =
-      ScreenUtil::GetDisplayBoundsWithShelf(shelf->GetWindow());
+      screen_util::GetDisplayBoundsWithShelf(shelf->GetWindow());
 
   EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds()));
   EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1);
@@ -229,7 +229,7 @@
 
   gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
   gfx::Rect root_bounds =
-      ScreenUtil::GetDisplayBoundsWithShelf(shelf->GetWindow());
+      screen_util::GetDisplayBoundsWithShelf(shelf->GetWindow());
 
   EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds()));
   EXPECT_NEAR(root_bounds.CenterPoint().x(), toast_bounds.CenterPoint().x(), 1);
@@ -248,7 +248,7 @@
   gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
   gfx::RectF precise_toast_bounds(toast_bounds);
   gfx::Rect root_bounds =
-      ScreenUtil::GetDisplayBoundsWithShelf(shelf->GetWindow());
+      screen_util::GetDisplayBoundsWithShelf(shelf->GetWindow());
 
   EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds()));
   EXPECT_EQ(root_bounds.bottom() - ToastOverlay::kOffset,
@@ -274,7 +274,7 @@
 
   gfx::Rect toast_bounds = GetCurrentWidget()->GetWindowBoundsInScreen();
   gfx::Rect root_bounds =
-      ScreenUtil::GetDisplayBoundsWithShelf(shelf->GetWindow());
+      screen_util::GetDisplayBoundsWithShelf(shelf->GetWindow());
 
   EXPECT_TRUE(toast_bounds.Intersects(shelf->GetUserWorkAreaBounds()));
   EXPECT_TRUE(root_bounds.Contains(toast_bounds));
diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc
index 07f5f36..92aac5b 100644
--- a/ash/wm/default_state.cc
+++ b/ash/wm/default_state.cc
@@ -179,7 +179,7 @@
       // Use entire display instead of workarea. The logic ensures 30%
       // visibility which should be enough to see where the window gets
       // moved.
-      gfx::Rect display_area = ScreenUtil::GetDisplayBoundsInParent(window);
+      gfx::Rect display_area = screen_util::GetDisplayBoundsInParent(window);
       int min_width = bounds.width() * wm::kMinimumPercentOnScreenArea;
       int min_height = bounds.height() * wm::kMinimumPercentOnScreenArea;
       wm::AdjustBoundsToEnsureWindowVisibility(display_area, min_width,
@@ -196,7 +196,7 @@
         return;
       }
       gfx::Rect work_area_in_parent =
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
+          screen_util::GetDisplayWorkAreaBoundsInParent(window_state->window());
       gfx::Rect bounds = window_state->window()->GetTargetBounds();
       // When display bounds has changed, make sure the entire window is fully
       // visible.
@@ -221,7 +221,7 @@
         return;
       }
       gfx::Rect work_area_in_parent =
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_state->window());
+          screen_util::GetDisplayWorkAreaBoundsInParent(window_state->window());
       gfx::Rect bounds = window_state->window()->GetTargetBounds();
       if (!::wm::GetTransientParent(window_state->window())) {
         wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area_in_parent,
@@ -265,7 +265,7 @@
       return;
     case WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE: {
       gfx::Rect work_area =
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
+          screen_util::GetDisplayWorkAreaBoundsInParent(window);
 
       // Maximize vertically if:
       // - The window does not have a max height defined.
@@ -297,7 +297,7 @@
       if (!window_state->IsNormalOrSnapped())
         return;
       gfx::Rect work_area =
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
+          screen_util::GetDisplayWorkAreaBoundsInParent(window);
       if (window_state->IsNormalStateType() &&
           window_state->HasRestoreBounds() &&
           (window->bounds().width() == work_area.width() &&
@@ -392,12 +392,12 @@
   DCHECK(!window_state->allow_set_bounds_direct());
   if (window_state->IsMaximized()) {
     window_state->SetBoundsDirect(
-        ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->window()));
+        screen_util::GetMaximizedWindowBoundsInParent(window_state->window()));
     return true;
   }
   if (window_state->IsFullscreen()) {
     window_state->SetBoundsDirect(
-        ScreenUtil::GetDisplayBoundsInParent(window_state->window()));
+        screen_util::GetDisplayBoundsInParent(window_state->window()));
     return true;
   }
   return false;
@@ -431,7 +431,7 @@
     window_state->Restore();
   } else {
     gfx::Rect center_in_parent =
-        ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
+        screen_util::GetDisplayWorkAreaBoundsInParent(window);
     center_in_parent.ClampToCenteredSize(window->bounds().size());
     window_state->SetBoundsDirectAnimated(center_in_parent);
   }
@@ -558,7 +558,7 @@
     case mojom::WindowStateType::DEFAULT:
     case mojom::WindowStateType::NORMAL: {
       gfx::Rect work_area_in_parent =
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
+          screen_util::GetDisplayWorkAreaBoundsInParent(window);
       if (window_state->HasRestoreBounds()) {
         bounds_in_parent = window_state->GetRestoreBoundsInParent();
         // Check if the |window|'s restored size is bigger than the working area
@@ -585,13 +585,13 @@
       break;
     }
     case mojom::WindowStateType::MAXIMIZED:
-      bounds_in_parent = ScreenUtil::GetMaximizedWindowBoundsInParent(window);
+      bounds_in_parent = screen_util::GetMaximizedWindowBoundsInParent(window);
       break;
 
     case mojom::WindowStateType::FULLSCREEN:
     case mojom::WindowStateType::PINNED:
     case mojom::WindowStateType::TRUSTED_PINNED:
-      bounds_in_parent = ScreenUtil::GetDisplayBoundsInParent(window);
+      bounds_in_parent = screen_util::GetDisplayBoundsInParent(window);
       break;
 
     case mojom::WindowStateType::MINIMIZED:
diff --git a/ash/wm/lock_action_handler_layout_manager_unittest.cc b/ash/wm/lock_action_handler_layout_manager_unittest.cc
index 1225ae076..0eda2c3 100644
--- a/ash/wm/lock_action_handler_layout_manager_unittest.cc
+++ b/ash/wm/lock_action_handler_layout_manager_unittest.cc
@@ -214,7 +214,7 @@
   EXPECT_EQ(bounds.ToString(), window->GetBoundsInScreen().ToString());
 
   gfx::Rect work_area =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get());
+      screen_util::GetDisplayWorkAreaBoundsInParent(window.get());
   window->SetBounds(work_area);
 
   EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString());
diff --git a/ash/wm/lock_layout_manager.cc b/ash/wm/lock_layout_manager.cc
index a61ab8c..2f80ff80 100644
--- a/ash/wm/lock_layout_manager.cc
+++ b/ash/wm/lock_layout_manager.cc
@@ -99,7 +99,7 @@
   //    height.
   //  * LockActionHandlerLayoutManager windows bounds depend on the work area
   //    bound defined by the shelf layout (see
-  //    ScreenUtil::GetDisplayWorkAreaBoundsInParentForLockScreen).
+  //    screen_util::GetDisplayWorkAreaBoundsInParentForLockScreen).
   // In short, when shelf bounds change, the windows in this layout manager
   // should be updated, too.
   const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
diff --git a/ash/wm/lock_layout_manager_unittest.cc b/ash/wm/lock_layout_manager_unittest.cc
index 49fcfa1f..de79c8a8 100644
--- a/ash/wm/lock_layout_manager_unittest.cc
+++ b/ash/wm/lock_layout_manager_unittest.cc
@@ -119,7 +119,7 @@
   EXPECT_EQ(bounds.ToString(), window->GetBoundsInScreen().ToString());
 
   gfx::Rect work_area =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get());
+      screen_util::GetDisplayWorkAreaBoundsInParent(window.get());
   window->SetBounds(work_area);
 
   EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString());
@@ -155,7 +155,7 @@
             fullscreen_window->GetBoundsInScreen().ToString());
 
   gfx::Rect work_area =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(maximized_window.get());
+      screen_util::GetDisplayWorkAreaBoundsInParent(maximized_window.get());
   maximized_window->SetBounds(work_area);
 
   EXPECT_NE(work_area.ToString(),
@@ -164,7 +164,7 @@
             maximized_window->GetBoundsInScreen().ToString());
 
   work_area =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(fullscreen_window.get());
+      screen_util::GetDisplayWorkAreaBoundsInParent(fullscreen_window.get());
   fullscreen_window->SetBounds(work_area);
   EXPECT_NE(work_area.ToString(),
             fullscreen_window->GetBoundsInScreen().ToString());
@@ -327,7 +327,7 @@
   EXPECT_EQ("0,0 300x400", window->GetBoundsInScreen().ToString());
 
   gfx::Rect work_area =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get());
+      screen_util::GetDisplayWorkAreaBoundsInParent(window.get());
   window->SetBounds(work_area);
   // Usually work_area takes Shelf into account but that doesn't affect
   // LockScreen container windows.
diff --git a/ash/wm/lock_window_state.cc b/ash/wm/lock_window_state.cc
index d27367b..c308e41 100644
--- a/ash/wm/lock_window_state.cc
+++ b/ash/wm/lock_window_state.cc
@@ -177,7 +177,7 @@
 
 gfx::Rect LockWindowState::GetWindowBounds(aura::Window* window) {
   if (exclude_shelf_)
-    return ScreenUtil::GetDisplayWorkAreaBoundsInParentForLockScreen(window);
+    return screen_util::GetDisplayWorkAreaBoundsInParentForLockScreen(window);
 
   keyboard::KeyboardController* keyboard_controller =
       keyboard::KeyboardController::GetInstance();
@@ -185,7 +185,7 @@
       keyboard_controller
           ? keyboard_controller->GetKeyboardLockScreenOffsetBounds().height()
           : 0;
-  gfx::Rect bounds = ScreenUtil::GetDisplayBoundsWithShelf(window);
+  gfx::Rect bounds = screen_util::GetDisplayBoundsWithShelf(window);
   bounds.Inset(0, Shelf::ForWindow(window)->GetAccessibilityPanelHeight(), 0,
                keyboard_height);
   return bounds;
diff --git a/ash/wm/overview/overview_window_drag_controller.cc b/ash/wm/overview/overview_window_drag_controller.cc
index b7b063c..9b688f6 100644
--- a/ash/wm/overview/overview_window_drag_controller.cc
+++ b/ash/wm/overview/overview_window_drag_controller.cc
@@ -252,7 +252,7 @@
     const gfx::Point& location_in_screen) const {
   DCHECK(item_);
   gfx::Rect area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(item_->GetWindow()));
+      screen_util::GetDisplayWorkAreaBoundsInParent(item_->GetWindow()));
   ::wm::ConvertRectToScreen(item_->GetWindow()->GetRootWindow(), &area);
 
   blink::WebScreenOrientationLockType screen_orientation =
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index 72c18b0..678baa5 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -2131,7 +2131,7 @@
   const int drag_offset_snap_region =
       OverviewWindowDragController::kMinimumDragOffsetAlreadyInSnapRegionDp;
   const int screen_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(left_window.get()).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(left_window.get()).width();
   const int edge_inset = GetEdgeInset(screen_width);
   // The selector item has a margin which does not accept events. Inset any
   // event aimed at the selector items edge so events will reach it.
@@ -2323,7 +2323,7 @@
   ASSERT_TRUE(window_selector_controller()->IsSelecting());
 
   const int screen_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window.get()).width();
   const int edge_inset = GetEdgeInset(screen_width);
 
   // Verify the phantom window is visible when |selector_item|'s x is in the
@@ -2363,7 +2363,7 @@
   ASSERT_TRUE(window_selector_controller()->IsSelecting());
 
   const int screen_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get()).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window.get()).width();
 
   const int grid_index = 0;
   WindowSelectorItem* selector_item =
@@ -2390,7 +2390,7 @@
   ASSERT_TRUE(window_selector_controller()->IsSelecting());
 
   const int screen_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window1.get()).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window1.get()).width();
   const int edge_inset = GetEdgeInset(screen_width);
 
   // Verify that when are no snapped windows, the overlay is visible when a drag
@@ -2853,7 +2853,7 @@
   std::unique_ptr<aura::Window> window3(
       CreateWindowWithMinimumSize(bounds, size));
   const int screen_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window1.get()).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window1.get()).width();
   ToggleOverview();
 
   // Drag |window1| selector item to snap to left.
diff --git a/ash/wm/splitview/split_view_controller.cc b/ash/wm/splitview/split_view_controller.cc
index 09e413e..9a7f44e 100644
--- a/ash/wm/splitview/split_view_controller.cc
+++ b/ash/wm/splitview/split_view_controller.cc
@@ -276,7 +276,7 @@
 gfx::Rect SplitViewController::GetDisplayWorkAreaBoundsInParent(
     aura::Window* window) const {
   aura::Window* root_window = window->GetRootWindow();
-  return ScreenUtil::GetDisplayWorkAreaBoundsInParent(
+  return screen_util::GetDisplayWorkAreaBoundsInParent(
       root_window->GetChildById(kShellWindowId_DefaultContainer));
 }
 
diff --git a/ash/wm/splitview/split_view_controller_unittest.cc b/ash/wm/splitview/split_view_controller_unittest.cc
index 37c137c..db104c6 100644
--- a/ash/wm/splitview/split_view_controller_unittest.cc
+++ b/ash/wm/splitview/split_view_controller_unittest.cc
@@ -469,7 +469,7 @@
   gfx::Rect divider_bounds =
       split_view_divider()->GetDividerBoundsInScreen(false /* is_dragging */);
   const int screen_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window1.get()).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window1.get()).width();
   EXPECT_NEAR(window1_width, window2_width, 1);
   EXPECT_EQ(screen_width,
             window1_width + divider_bounds.width() + window2_width);
diff --git a/ash/wm/splitview/split_view_overview_overlay.cc b/ash/wm/splitview/split_view_overview_overlay.cc
index 36349d0b..333ad30 100644
--- a/ash/wm/splitview/split_view_overview_overlay.cc
+++ b/ash/wm/splitview/split_view_overview_overlay.cc
@@ -262,7 +262,7 @@
         Shell::GetContainer(root_window, kShellWindowId_OverlayContainer));
     widget_->SetContentsView(overlay_view_);
   }
-  gfx::Rect bounds = ScreenUtil::GetDisplayWorkAreaBoundsInParent(
+  gfx::Rect bounds = screen_util::GetDisplayWorkAreaBoundsInParent(
       root_window->GetChildById(kShellWindowId_OverlayContainer));
   ::wm::ConvertRectToScreen(root_window, &bounds);
   widget_->SetBounds(bounds);
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc b/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc
index 9124579..918e493 100644
--- a/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc
+++ b/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc
@@ -351,7 +351,7 @@
   EXPECT_EQ(rect.ToString(), fixed_window->bounds().ToString());
 
   gfx::Size workspace_size =
-      ScreenUtil::GetMaximizedWindowBoundsInParent(unlimited_window.get())
+      screen_util::GetMaximizedWindowBoundsInParent(unlimited_window.get())
           .size();
 
   // Create the manager and make sure that all qualifying windows were detected
@@ -423,7 +423,7 @@
   // Make sure that the position of the unresizable window is in the middle of
   // the screen.
   gfx::Size work_area_size =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(w3.get()).size();
+      screen_util::GetDisplayWorkAreaBoundsInParent(w3.get()).size();
   gfx::Point center =
       gfx::Point((work_area_size.width() - rect3.size().width()) / 2,
                  (work_area_size.height() - rect3.size().height()) / 2);
@@ -503,7 +503,7 @@
                                           rect));
 
   gfx::Size workspace_size =
-      ScreenUtil::GetMaximizedWindowBoundsInParent(unlimited_window.get())
+      screen_util::GetMaximizedWindowBoundsInParent(unlimited_window.get())
           .size();
 
   // All windows should be sized now as big as possible and be centered.
diff --git a/ash/wm/tablet_mode/tablet_mode_window_state.cc b/ash/wm/tablet_mode/tablet_mode_window_state.cc
index 25738cd..bd89cb7 100644
--- a/ash/wm/tablet_mode/tablet_mode_window_state.cc
+++ b/ash/wm/tablet_mode/tablet_mode_window_state.cc
@@ -46,7 +46,7 @@
   DCHECK(window_state->CanMaximize() || window_state->CanResize());
 
   gfx::Size workspace_size =
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window_state->window())
+      screen_util::GetMaximizedWindowBoundsInParent(window_state->window())
           .size();
 
   gfx::Size size = window_state->window()->delegate()
@@ -63,7 +63,7 @@
 gfx::Rect GetCenteredBounds(const gfx::Rect& bounds_in_parent,
                             wm::WindowState* state_object) {
   gfx::Rect work_area_in_parent =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(state_object->window());
+      screen_util::GetDisplayWorkAreaBoundsInParent(state_object->window());
   work_area_in_parent.ClampToCenteredSize(bounds_in_parent.size());
   return work_area_in_parent;
 }
@@ -80,7 +80,7 @@
 // Returns the maximized/full screen and/or centered bounds of a window.
 gfx::Rect GetBoundsInMaximizedMode(wm::WindowState* state_object) {
   if (state_object->IsFullscreen() || state_object->IsPinned())
-    return ScreenUtil::GetDisplayBoundsInParent(state_object->window());
+    return screen_util::GetDisplayBoundsInParent(state_object->window());
 
   if (state_object->GetStateType() == mojom::WindowStateType::LEFT_SNAPPED) {
     DCHECK(CanSnap(state_object));
diff --git a/ash/wm/window_positioner.cc b/ash/wm/window_positioner.cc
index 691c1691..a40a557 100644
--- a/ash/wm/window_positioner.cc
+++ b/ash/wm/window_positioner.cc
@@ -131,7 +131,7 @@
 // Move |window| into the center of the screen - or restore it to the previous
 // position.
 void AutoPlaceSingleWindow(aura::Window* window, bool animated) {
-  gfx::Rect work_area = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window);
+  gfx::Rect work_area = screen_util::GetDisplayWorkAreaBoundsInParent(window);
   gfx::Rect bounds = window->bounds();
   const base::Optional<gfx::Rect> user_defined_area =
       wm::GetWindowState(window)->pre_auto_manage_window_bounds();
@@ -319,7 +319,7 @@
     if (added_window_state->minimum_visibility()) {
       // Guarantee minimum visibility within the work area.
       gfx::Rect work_area =
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(added_window);
+          screen_util::GetDisplayWorkAreaBoundsInParent(added_window);
       gfx::Rect bounds = added_window->bounds();
       gfx::Rect new_bounds = bounds;
       wm::AdjustBoundsToEnsureMinimumWindowVisibility(work_area, &new_bounds);
@@ -345,7 +345,7 @@
 
   gfx::Rect other_bounds = other_shown_window->bounds();
   gfx::Rect work_area =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(added_window);
+      screen_util::GetDisplayWorkAreaBoundsInParent(added_window);
   bool move_other_right =
       other_bounds.CenterPoint().x() > work_area.x() + work_area.width() / 2;
 
diff --git a/ash/wm/window_positioning_utils.cc b/ash/wm/window_positioning_utils.cc
index 88269a3e8..8c39d2b 100644
--- a/ash/wm/window_positioning_utils.cc
+++ b/ash/wm/window_positioning_utils.cc
@@ -35,7 +35,7 @@
   const float kSnappedWidthWorkspaceRatio = 0.5f;
 
   int work_area_width =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window).width();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window).width();
   int min_width =
       window->delegate() ? window->delegate()->GetMinimumSize().width() : 0;
   int ideal_width =
@@ -91,7 +91,7 @@
 
 gfx::Rect GetDefaultLeftSnappedWindowBoundsInParent(aura::Window* window) {
   gfx::Rect work_area_in_parent(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window));
   return gfx::Rect(work_area_in_parent.x(), work_area_in_parent.y(),
                    GetDefaultSnappedWindowWidth(window),
                    work_area_in_parent.height());
@@ -99,7 +99,7 @@
 
 gfx::Rect GetDefaultRightSnappedWindowBoundsInParent(aura::Window* window) {
   gfx::Rect work_area_in_parent(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window));
   int width = GetDefaultSnappedWindowWidth(window);
   return gfx::Rect(work_area_in_parent.right() - width, work_area_in_parent.y(),
                    width, work_area_in_parent.height());
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc
index 1014909..2f93a7b 100644
--- a/ash/wm/window_state.cc
+++ b/ash/wm/window_state.cc
@@ -101,7 +101,7 @@
 
 float GetCurrentSnappedWidthRatio(aura::Window* window) {
   gfx::Rect maximized_bounds =
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window);
+      screen_util::GetMaximizedWindowBoundsInParent(window);
   return static_cast<float>(window->bounds().width()) /
          static_cast<float>(maximized_bounds.width());
 }
@@ -502,7 +502,7 @@
   if (is_dragged() || !IsSnapped())
     return;
   gfx::Rect maximized_bounds =
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window_);
+      screen_util::GetMaximizedWindowBoundsInParent(window_);
   if (snapped_width_ratio_) {
     bounds->set_width(
         static_cast<int>(*snapped_width_ratio_ * maximized_bounds.width()));
@@ -577,7 +577,7 @@
 
 void WindowState::SetBoundsConstrained(const gfx::Rect& bounds) {
   gfx::Rect work_area_in_parent =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_);
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_);
   gfx::Rect child_bounds(bounds);
   AdjustBoundsSmallerThan(work_area_in_parent.size(), &child_bounds);
   SetBoundsDirect(child_bounds);
diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc
index 31d7212..c1c4e3c 100644
--- a/ash/wm/workspace/workspace_event_handler_unittest.cc
+++ b/ash/wm/workspace/workspace_event_handler_unittest.cc
@@ -324,7 +324,7 @@
   wm::WindowState* window_state = wm::GetWindowState(window.get());
   gfx::Rect restore_bounds = window->bounds();
   gfx::Rect work_area_in_parent =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window.get());
+      screen_util::GetDisplayWorkAreaBoundsInParent(window.get());
 
   EXPECT_FALSE(window_state->IsMaximized());
 
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc
index 2c8e596..019c999 100644
--- a/ash/wm/workspace/workspace_layout_manager.cc
+++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -42,7 +42,7 @@
       root_window_(window->GetRootWindow()),
       root_window_controller_(RootWindowController::ForWindow(root_window_)),
       work_area_in_parent_(
-          ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_)),
+          screen_util::GetDisplayWorkAreaBoundsInParent(window_)),
       is_fullscreen_(wm::GetWindowForFullscreenMode(window) != nullptr),
       keyboard_observer_(this) {
   Shell::Get()->AddShellObserver(this);
@@ -301,7 +301,7 @@
   }
 
   const gfx::Rect work_area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_));
   if (work_area != work_area_in_parent_) {
     const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
     AdjustAllWindowsBoundsForWorkAreaChange(&event);
@@ -357,7 +357,7 @@
   DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
          event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
 
-  work_area_in_parent_ = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_);
+  work_area_in_parent_ = screen_util::GetDisplayWorkAreaBoundsInParent(window_);
 
   // Don't do any adjustments of the insets while we are in screen locked mode.
   // This would happen if the launcher was auto hidden before the login screen
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc
index 5ba177d..5a76832 100644
--- a/ash/wm/workspace/workspace_layout_manager_unittest.cc
+++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -683,7 +683,7 @@
   window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
   // Maximized window fills the work area, not the whole display.
   EXPECT_EQ(
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
+      screen_util::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
       window->bounds().ToString());
   window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL);
   EXPECT_EQ(bounds.ToString(), window->bounds().ToString());
@@ -776,16 +776,16 @@
       CreateTestWindowInShellWithBounds(bounds));
   window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED);
   gfx::Rect initial_work_area_bounds =
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window.get());
+      screen_util::GetMaximizedWindowBoundsInParent(window.get());
   EXPECT_EQ(initial_work_area_bounds.ToString(), window->bounds().ToString());
   // Enlarge the root window.  We should still match the work area size.
   UpdateDisplay("900x700");
   EXPECT_EQ(
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
+      screen_util::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
       window->bounds().ToString());
   EXPECT_NE(
       initial_work_area_bounds.ToString(),
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString());
+      screen_util::GetMaximizedWindowBoundsInParent(window.get()).ToString());
 }
 
 // Tests normal->fullscreen->normal.
@@ -994,10 +994,11 @@
   Shelf* shelf = GetPrimaryShelf();
   shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
 
-  window->SetBounds(ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()));
+  window->SetBounds(
+      screen_util::GetMaximizedWindowBoundsInParent(window.get()));
   gfx::Rect window_bounds = window->bounds();
   EXPECT_EQ(
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
+      screen_util::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
       window_bounds.ToString());
 
   // The window size should not get touched while we are in lock screen.
@@ -1010,7 +1011,7 @@
   GetSessionControllerClient()->UnlockScreen();
   shelf_layout_manager->UpdateVisibilityState();
   EXPECT_EQ(
-      ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
+      screen_util::GetMaximizedWindowBoundsInParent(window.get()).ToString(),
       window_bounds.ToString());
   EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString());
 }
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc
index 4a11a7bc..ace3d4d 100644
--- a/ash/wm/workspace/workspace_window_resizer.cc
+++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -521,7 +521,7 @@
 
 void WorkspaceWindowResizer::LayoutAttachedWindows(gfx::Rect* bounds) {
   gfx::Rect work_area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()));
+      screen_util::GetDisplayWorkAreaBoundsInParent(GetTarget()));
   int initial_size = PrimaryAxisSize(details().initial_bounds_in_parent.size());
   int current_size = PrimaryAxisSize(bounds->size());
   int start = PrimaryAxisCoordinate(bounds->right(), bounds->bottom());
@@ -935,11 +935,12 @@
     const gfx::Point& location) const {
   // TODO: this likely only wants total display area, not the area of a single
   // display.
-  gfx::Rect area(ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget()));
+  gfx::Rect area(screen_util::GetDisplayWorkAreaBoundsInParent(GetTarget()));
   if (details().source == ::wm::WINDOW_MOVE_SOURCE_TOUCH) {
     // Increase tolerance for touch-snapping near the screen edges. This is only
     // necessary when the work area left or right edge is same as screen edge.
-    gfx::Rect display_bounds(ScreenUtil::GetDisplayBoundsInParent(GetTarget()));
+    gfx::Rect display_bounds(
+        screen_util::GetDisplayBoundsInParent(GetTarget()));
     int inset_left = 0;
     if (area.x() == display_bounds.x())
       inset_left = kScreenEdgeInsetForTouchDrag;
@@ -961,7 +962,7 @@
   DCHECK(snapped_type == mojom::WindowStateType::LEFT_SNAPPED ||
          snapped_type == mojom::WindowStateType::RIGHT_SNAPPED);
   gfx::Rect snapped_bounds =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(GetTarget());
+      screen_util::GetDisplayWorkAreaBoundsInParent(GetTarget());
   if (snapped_type == mojom::WindowStateType::RIGHT_SNAPPED)
     snapped_bounds.set_x(snapped_bounds.right() - bounds_in_parent.width());
   snapped_bounds.set_width(bounds_in_parent.width());
diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc
index a36b93ba..e102b06 100644
--- a/ash/wm/workspace/workspace_window_resizer_unittest.cc
+++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc
@@ -592,7 +592,7 @@
     ASSERT_TRUE(resizer.get());
     resizer->Drag(CalculateDragPoint(*resizer, 499, 0), 0);
     int bottom =
-        ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
+        screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
     resizer->CompleteDrag();
     // With the resolution of 500x600 we will hit in this case the 50% screen
     // size setting.
@@ -881,7 +881,7 @@
 TEST_F(WorkspaceWindowResizerTest, ResizeWindowOutsideLeftWorkArea) {
   Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(),
                                          gfx::Insets(0, 0, 50, 0));
-  int left = ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).x();
+  int left = screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()).x();
   int pixels_to_left_border = 50;
   int window_width = 300;
   int window_x = left - window_width + pixels_to_left_border;
@@ -899,7 +899,7 @@
   Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(),
                                          gfx::Insets(0, 0, 50, 0));
   int right =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).right();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()).right();
   int pixels_to_right_border = 50;
   int window_width = 300;
   int window_x = right - pixels_to_right_border;
@@ -919,7 +919,7 @@
   Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(),
                                          gfx::Insets(0, 0, 50, 0));
   int bottom =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()).bottom();
   int delta_to_bottom = 50;
   int height = 380;
   window_->SetBounds(gfx::Rect(100, bottom - delta_to_bottom, 300, height));
@@ -942,7 +942,7 @@
   Shell::Get()->SetDisplayWorkAreaInsets(Shell::GetPrimaryRootWindow(),
                                          gfx::Insets(0, 0, 50, 0));
   int right =
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()).right();
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()).right();
   int pixels_to_right_border = 50;
   int window_width = 300;
   int window_x = right - pixels_to_right_border;
@@ -1069,7 +1069,7 @@
 TEST_F(WorkspaceWindowResizerTest, SnapToWorkArea_TOPRIGHT) {
   window_->SetBounds(gfx::Rect(100, 200, 20, 30));
   gfx::Rect work_area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()));
   std::unique_ptr<WindowResizer> resizer(
       CreateResizerForTest(window_.get(), gfx::Point(), HTTOPRIGHT));
   ASSERT_TRUE(resizer.get());
@@ -1085,7 +1085,7 @@
 TEST_F(WorkspaceWindowResizerTest, SnapToWorkArea_BOTTOMRIGHT) {
   window_->SetBounds(gfx::Rect(100, 200, 20, 30));
   gfx::Rect work_area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()));
   std::unique_ptr<WindowResizer> resizer(
       CreateResizerForTest(window_.get(), gfx::Point(), HTBOTTOMRIGHT));
   ASSERT_TRUE(resizer.get());
@@ -1102,7 +1102,7 @@
 TEST_F(WorkspaceWindowResizerTest, SnapToWorkArea_BOTTOMLEFT) {
   window_->SetBounds(gfx::Rect(100, 200, 20, 30));
   gfx::Rect work_area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()));
   std::unique_ptr<WindowResizer> resizer(
       CreateResizerForTest(window_.get(), gfx::Point(), HTBOTTOMLEFT));
   ASSERT_TRUE(resizer.get());
@@ -1131,7 +1131,7 @@
   EXPECT_EQ(expected.ToString(), window_->bounds().ToString());
 
   gfx::Rect work_area(
-      ScreenUtil::GetDisplayWorkAreaBoundsInParent(window_.get()));
+      screen_util::GetDisplayWorkAreaBoundsInParent(window_.get()));
 
   // The initial y position of |window_|.
   int initial_y = 10;
diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc
index bb9d4a26..17ac082 100644
--- a/ash/wm/workspace_controller_unittest.cc
+++ b/ash/wm/workspace_controller_unittest.cc
@@ -187,9 +187,9 @@
   EXPECT_TRUE(wm::IsActiveWindow(w1.get()));
 
   EXPECT_EQ(w1.get(), GetDesktop()->children()[0]);
-  EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(w1.get()).width(),
+  EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(w1.get()).width(),
             w1->bounds().width());
-  EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(w1.get()).height(),
+  EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(w1.get()).height(),
             w1->bounds().height());
 
   // Restore the window.
@@ -218,7 +218,7 @@
   EXPECT_EQ(w1.get(), GetDesktop()->children()[0]);
   EXPECT_EQ(w2.get(), GetDesktop()->children()[1]);
 
-  gfx::Rect work_area(ScreenUtil::GetMaximizedWindowBoundsInParent(w1.get()));
+  gfx::Rect work_area(screen_util::GetMaximizedWindowBoundsInParent(w1.get()));
   EXPECT_EQ(work_area.width(), w2->bounds().width());
   EXPECT_EQ(work_area.height(), w2->bounds().height());
 
@@ -448,7 +448,7 @@
   EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
   EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
   EXPECT_EQ(
-      ScreenUtil::GetMaximizedWindowBoundsInParent(w2->parent()).ToString(),
+      screen_util::GetMaximizedWindowBoundsInParent(w2->parent()).ToString(),
       w2->bounds().ToString());
 
   // Switch to w1.
@@ -456,7 +456,7 @@
   EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
   EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
   EXPECT_EQ(
-      ScreenUtil::GetMaximizedWindowBoundsInParent(w2->parent()).ToString(),
+      screen_util::GetMaximizedWindowBoundsInParent(w2->parent()).ToString(),
       w2->bounds().ToString());
 
   // Switch to w2.
@@ -464,7 +464,7 @@
   EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState());
   EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState());
   EXPECT_EQ("0,1 101x102", w1->bounds().ToString());
-  EXPECT_EQ(ScreenUtil::GetMaximizedWindowBoundsInParent(w2.get()).ToString(),
+  EXPECT_EQ(screen_util::GetMaximizedWindowBoundsInParent(w2.get()).ToString(),
             w2->bounds().ToString());
 
   // Turn off auto-hide, switch back to w2 (maximized) and verify overlap.
diff --git a/base/task_scheduler/scheduler_single_thread_task_runner_manager.cc b/base/task_scheduler/scheduler_single_thread_task_runner_manager.cc
index 285aa1eb..a47760c 100644
--- a/base/task_scheduler/scheduler_single_thread_task_runner_manager.cc
+++ b/base/task_scheduler/scheduler_single_thread_task_runner_manager.cc
@@ -419,21 +419,19 @@
 
 scoped_refptr<SingleThreadTaskRunner>
 SchedulerSingleThreadTaskRunnerManager::CreateSingleThreadTaskRunnerWithTraits(
-    const std::string& name,
     const TaskTraits& traits,
     SingleThreadTaskRunnerThreadMode thread_mode) {
-  return CreateTaskRunnerWithTraitsImpl<SchedulerWorkerDelegate>(name, traits,
+  return CreateTaskRunnerWithTraitsImpl<SchedulerWorkerDelegate>(traits,
                                                                  thread_mode);
 }
 
 #if defined(OS_WIN)
 scoped_refptr<SingleThreadTaskRunner>
 SchedulerSingleThreadTaskRunnerManager::CreateCOMSTATaskRunnerWithTraits(
-    const std::string& name,
     const TaskTraits& traits,
     SingleThreadTaskRunnerThreadMode thread_mode) {
   return CreateTaskRunnerWithTraitsImpl<SchedulerWorkerCOMDelegate>(
-      name, traits, thread_mode);
+      traits, thread_mode);
 }
 #endif  // defined(OS_WIN)
 
@@ -441,7 +439,6 @@
 scoped_refptr<
     SchedulerSingleThreadTaskRunnerManager::SchedulerSingleThreadTaskRunner>
 SchedulerSingleThreadTaskRunnerManager::CreateTaskRunnerWithTraitsImpl(
-    const std::string& name,
     const TaskTraits& traits,
     SingleThreadTaskRunnerThreadMode thread_mode) {
   DCHECK(thread_mode != SingleThreadTaskRunnerThreadMode::SHARED ||
@@ -467,12 +464,12 @@
     if (!worker) {
       const auto& environment_params =
           kEnvironmentParams[GetEnvironmentIndexForTraits(traits)];
-      std::string processed_name =
-          thread_mode == SingleThreadTaskRunnerThreadMode::DEDICATED
-              ? name + environment_params.name_suffix
-              : "Shared" + name + environment_params.name_suffix;
+      std::string worker_name;
+      if (thread_mode == SingleThreadTaskRunnerThreadMode::SHARED)
+        worker_name += "Shared";
+      worker_name += environment_params.name_suffix;
       worker = CreateAndRegisterSchedulerWorker<DelegateType>(
-          processed_name, environment_params.priority_hint);
+          worker_name, environment_params.priority_hint);
       new_worker = true;
     }
     started = started_;
diff --git a/base/task_scheduler/scheduler_single_thread_task_runner_manager.h b/base/task_scheduler/scheduler_single_thread_task_runner_manager.h
index 34eb81fd..1153a7b0 100644
--- a/base/task_scheduler/scheduler_single_thread_task_runner_manager.h
+++ b/base/task_scheduler/scheduler_single_thread_task_runner_manager.h
@@ -58,21 +58,19 @@
   void Start();
 
   // Creates a SingleThreadTaskRunner which runs tasks with |traits| on a thread
-  // named "TaskSchedulerSingleThread[Shared]" + |name| +
+  // named "TaskSchedulerSingleThread[Shared]" +
   // kEnvironmentParams[GetEnvironmentIndexForTraits(traits)].name_suffix +
   // index.
   scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits(
-      const std::string& name,
       const TaskTraits& traits,
       SingleThreadTaskRunnerThreadMode thread_mode);
 
 #if defined(OS_WIN)
   // Creates a SingleThreadTaskRunner which runs tasks with |traits| on a COM
-  // STA thread named "TaskSchedulerSingleThreadCOMSTA[Shared]" + |name| +
+  // STA thread named "TaskSchedulerSingleThreadCOMSTA[Shared]" +
   // kEnvironmentParams[GetEnvironmentIndexForTraits(traits)].name_suffix +
   // index.
   scoped_refptr<SingleThreadTaskRunner> CreateCOMSTATaskRunnerWithTraits(
-      const std::string& name,
       const TaskTraits& traits,
       SingleThreadTaskRunnerThreadMode thread_mode);
 #endif  // defined(OS_WIN)
@@ -84,7 +82,6 @@
 
   template <typename DelegateType>
   scoped_refptr<SchedulerSingleThreadTaskRunner> CreateTaskRunnerWithTraitsImpl(
-      const std::string& name,
       const TaskTraits& traits,
       SingleThreadTaskRunnerThreadMode thread_mode);
 
diff --git a/base/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc b/base/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc
index af432ef..f9365f6b 100644
--- a/base/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc
+++ b/base/task_scheduler/scheduler_single_thread_task_runner_manager_unittest.cc
@@ -98,12 +98,12 @@
   scoped_refptr<SingleThreadTaskRunner> task_runner_1 =
       single_thread_task_runner_manager_
           ->CreateSingleThreadTaskRunnerWithTraits(
-              "A", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+              {TaskShutdownBehavior::BLOCK_SHUTDOWN},
               SingleThreadTaskRunnerThreadMode::DEDICATED);
   scoped_refptr<SingleThreadTaskRunner> task_runner_2 =
       single_thread_task_runner_manager_
           ->CreateSingleThreadTaskRunnerWithTraits(
-              "B", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+              {TaskShutdownBehavior::BLOCK_SHUTDOWN},
               SingleThreadTaskRunnerThreadMode::DEDICATED);
 
   PlatformThreadRef thread_ref_1;
@@ -124,12 +124,12 @@
   scoped_refptr<SingleThreadTaskRunner> task_runner_1 =
       single_thread_task_runner_manager_
           ->CreateSingleThreadTaskRunnerWithTraits(
-              "A", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+              {TaskShutdownBehavior::BLOCK_SHUTDOWN},
               SingleThreadTaskRunnerThreadMode::SHARED);
   scoped_refptr<SingleThreadTaskRunner> task_runner_2 =
       single_thread_task_runner_manager_
           ->CreateSingleThreadTaskRunnerWithTraits(
-              "B", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+              {TaskShutdownBehavior::BLOCK_SHUTDOWN},
               SingleThreadTaskRunnerThreadMode::SHARED);
 
   PlatformThreadRef thread_ref_1;
@@ -151,12 +151,12 @@
   scoped_refptr<SingleThreadTaskRunner> task_runner_1 =
       single_thread_task_runner_manager_
           ->CreateSingleThreadTaskRunnerWithTraits(
-              "A", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+              {TaskShutdownBehavior::BLOCK_SHUTDOWN},
               SingleThreadTaskRunnerThreadMode::DEDICATED);
   scoped_refptr<SingleThreadTaskRunner> task_runner_2 =
       single_thread_task_runner_manager_
           ->CreateSingleThreadTaskRunnerWithTraits(
-              "B", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+              {TaskShutdownBehavior::BLOCK_SHUTDOWN},
               SingleThreadTaskRunnerThreadMode::DEDICATED);
 
   EXPECT_FALSE(task_runner_1->RunsTasksInCurrentSequence());
@@ -189,8 +189,7 @@
        SharedWithBaseSyncPrimitivesDCHECKs) {
   EXPECT_DCHECK_DEATH({
     single_thread_task_runner_manager_->CreateSingleThreadTaskRunnerWithTraits(
-        "A", {WithBaseSyncPrimitives()},
-        SingleThreadTaskRunnerThreadMode::SHARED);
+        {WithBaseSyncPrimitives()}, SingleThreadTaskRunnerThreadMode::SHARED);
   });
 }
 
@@ -216,12 +215,12 @@
   // events to determine when a task is run.
   scoped_refptr<SingleThreadTaskRunner> task_runner_background =
       single_thread_task_runner_manager_
-          ->CreateSingleThreadTaskRunnerWithTraits(
-              "Background", {TaskPriority::BACKGROUND}, GetParam());
+          ->CreateSingleThreadTaskRunnerWithTraits({TaskPriority::BACKGROUND},
+                                                   GetParam());
   scoped_refptr<SingleThreadTaskRunner> task_runner_normal =
       single_thread_task_runner_manager_
-          ->CreateSingleThreadTaskRunnerWithTraits(
-              "Normal", {TaskPriority::USER_VISIBLE}, GetParam());
+          ->CreateSingleThreadTaskRunnerWithTraits({TaskPriority::USER_VISIBLE},
+                                                   GetParam());
 
   ThreadPriority thread_priority_background;
   task_runner_background->PostTask(
@@ -260,8 +259,7 @@
                                      TaskShutdownBehavior::BLOCK_SHUTDOWN};
   scoped_refptr<SingleThreadTaskRunner> foo_task_runner =
       single_thread_task_runner_manager_
-          ->CreateSingleThreadTaskRunnerWithTraits("MyName", foo_traits,
-                                                   GetParam());
+          ->CreateSingleThreadTaskRunnerWithTraits(foo_traits, GetParam());
   std::string foo_captured_name;
   foo_task_runner->PostTask(FROM_HERE,
                             BindOnce(&CaptureThreadName, &foo_captured_name));
@@ -271,7 +269,7 @@
       TaskShutdownBehavior::BLOCK_SHUTDOWN};
   scoped_refptr<SingleThreadTaskRunner> user_blocking_task_runner =
       single_thread_task_runner_manager_
-          ->CreateSingleThreadTaskRunnerWithTraits("A", user_blocking_traits,
+          ->CreateSingleThreadTaskRunnerWithTraits(user_blocking_traits,
                                                    GetParam());
 
   std::string user_blocking_captured_name;
@@ -280,7 +278,6 @@
 
   task_tracker_.Shutdown();
 
-  EXPECT_NE(std::string::npos, foo_captured_name.find("MyName"));
   EXPECT_NE(std::string::npos,
             foo_captured_name.find(
                 kEnvironmentParams[GetEnvironmentIndexForTraits(foo_traits)]
@@ -302,9 +299,9 @@
 
 TEST_P(TaskSchedulerSingleThreadTaskRunnerManagerCommonTest,
        PostTaskAfterShutdown) {
-  auto task_runner = single_thread_task_runner_manager_
-                         ->CreateSingleThreadTaskRunnerWithTraits(
-                             "A", TaskTraits(), GetParam());
+  auto task_runner =
+      single_thread_task_runner_manager_
+          ->CreateSingleThreadTaskRunnerWithTraits(TaskTraits(), GetParam());
   task_tracker_.Shutdown();
   EXPECT_FALSE(task_runner->PostTask(FROM_HERE, BindOnce(&ShouldNotRun)));
 }
@@ -316,9 +313,9 @@
   // Post a task with a short delay.
   WaitableEvent task_ran(WaitableEvent::ResetPolicy::MANUAL,
                          WaitableEvent::InitialState::NOT_SIGNALED);
-  auto task_runner = single_thread_task_runner_manager_
-                         ->CreateSingleThreadTaskRunnerWithTraits(
-                             "A", TaskTraits(), GetParam());
+  auto task_runner =
+      single_thread_task_runner_manager_
+          ->CreateSingleThreadTaskRunnerWithTraits(TaskTraits(), GetParam());
   EXPECT_TRUE(task_runner->PostDelayedTask(
       FROM_HERE, BindOnce(&WaitableEvent::Signal, Unretained(&task_ran)),
       TestTimeouts::tiny_timeout()));
@@ -338,9 +335,9 @@
 // but doesn't crash.
 TEST_P(TaskSchedulerSingleThreadTaskRunnerManagerCommonTest,
        PostTaskAfterDestroy) {
-  auto task_runner = single_thread_task_runner_manager_
-                         ->CreateSingleThreadTaskRunnerWithTraits(
-                             "A", TaskTraits(), GetParam());
+  auto task_runner =
+      single_thread_task_runner_manager_
+          ->CreateSingleThreadTaskRunnerWithTraits(TaskTraits(), GetParam());
   EXPECT_TRUE(task_runner->PostTask(FROM_HERE, BindOnce(&DoNothing)));
   task_tracker_.Shutdown();
   TearDownSingleThreadTaskRunnerManager();
@@ -409,7 +406,7 @@
   {
     auto task_runner = single_thread_task_runner_manager_
                            ->CreateSingleThreadTaskRunnerWithTraits(
-                               "A", {WithBaseSyncPrimitives()},
+                               {WithBaseSyncPrimitives()},
                                SingleThreadTaskRunnerThreadMode::DEDICATED);
     EXPECT_TRUE(task_runner->PostTask(
         FROM_HERE,
@@ -439,7 +436,7 @@
   {
     auto task_runner = single_thread_task_runner_manager_
                            ->CreateSingleThreadTaskRunnerWithTraits(
-                               "A", {WithBaseSyncPrimitives()},
+                               {WithBaseSyncPrimitives()},
                                SingleThreadTaskRunnerThreadMode::DEDICATED);
     EXPECT_TRUE(task_runner->PostTask(
         FROM_HERE,
@@ -464,7 +461,7 @@
        COMSTAInitialized) {
   scoped_refptr<SingleThreadTaskRunner> com_task_runner =
       single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits(
-          "A", {TaskShutdownBehavior::BLOCK_SHUTDOWN}, GetParam());
+          {TaskShutdownBehavior::BLOCK_SHUTDOWN}, GetParam());
 
   com_task_runner->PostTask(FROM_HERE, BindOnce(&win::AssertComApartmentType,
                                                 win::ComApartmentType::STA));
@@ -475,11 +472,11 @@
 TEST_F(TaskSchedulerSingleThreadTaskRunnerManagerTest, COMSTASameThreadUsed) {
   scoped_refptr<SingleThreadTaskRunner> task_runner_1 =
       single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits(
-          "A", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+          {TaskShutdownBehavior::BLOCK_SHUTDOWN},
           SingleThreadTaskRunnerThreadMode::SHARED);
   scoped_refptr<SingleThreadTaskRunner> task_runner_2 =
       single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits(
-          "B", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+          {TaskShutdownBehavior::BLOCK_SHUTDOWN},
           SingleThreadTaskRunnerThreadMode::SHARED);
 
   PlatformThreadRef thread_ref_1;
@@ -544,7 +541,7 @@
 TEST_F(TaskSchedulerSingleThreadTaskRunnerManagerTestWin, PumpsMessages) {
   scoped_refptr<SingleThreadTaskRunner> com_task_runner =
       single_thread_task_runner_manager_->CreateCOMSTATaskRunnerWithTraits(
-          "A", {TaskShutdownBehavior::BLOCK_SHUTDOWN},
+          {TaskShutdownBehavior::BLOCK_SHUTDOWN},
           SingleThreadTaskRunnerThreadMode::DEDICATED);
   HWND hwnd = nullptr;
   // HWNDs process messages on the thread that created them, so we have to
@@ -597,7 +594,7 @@
                               WaitableEvent::InitialState::NOT_SIGNALED);
   single_thread_task_runner_manager_
       ->CreateSingleThreadTaskRunnerWithTraits(
-          "A", TaskTraits(), SingleThreadTaskRunnerThreadMode::DEDICATED)
+          TaskTraits(), SingleThreadTaskRunnerThreadMode::DEDICATED)
       ->PostTask(
           FROM_HERE,
           BindOnce(
diff --git a/base/task_scheduler/scheduler_worker_pool_impl.cc b/base/task_scheduler/scheduler_worker_pool_impl.cc
index 5e510b1..fb10e39 100644
--- a/base/task_scheduler/scheduler_worker_pool_impl.cc
+++ b/base/task_scheduler/scheduler_worker_pool_impl.cc
@@ -16,6 +16,7 @@
 #include "base/memory/ptr_util.h"
 #include "base/metrics/histogram.h"
 #include "base/sequence_token.h"
+#include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/task_scheduler/scheduler_worker_pool_params.h"
 #include "base/task_scheduler/task_tracker.h"
@@ -153,12 +154,13 @@
 };
 
 SchedulerWorkerPoolImpl::SchedulerWorkerPoolImpl(
-    const std::string& name,
+    StringPiece histogram_label,
+    StringPiece pool_label,
     ThreadPriority priority_hint,
     TaskTracker* task_tracker,
     DelayedTaskManager* delayed_task_manager)
     : SchedulerWorkerPool(task_tracker, delayed_task_manager),
-      name_(name),
+      pool_label_(pool_label.as_string()),
       priority_hint_(priority_hint),
       lock_(shared_priority_queue_.container_lock()),
       idle_workers_stack_cv_for_testing_(lock_.CreateConditionVariable()),
@@ -166,7 +168,9 @@
                                  WaitableEvent::InitialState::NOT_SIGNALED),
       // Mimics the UMA_HISTOGRAM_LONG_TIMES macro.
       detach_duration_histogram_(Histogram::FactoryTimeGet(
-          kDetachDurationHistogramPrefix + name_ + kPoolNameSuffix,
+          JoinString({kDetachDurationHistogramPrefix, histogram_label,
+                      kPoolNameSuffix},
+                     ""),
           TimeDelta::FromMilliseconds(1),
           TimeDelta::FromHours(1),
           50,
@@ -175,7 +179,9 @@
       // than 1000 tasks before detaching, there is no need to know the exact
       // number of tasks that ran.
       num_tasks_before_detach_histogram_(Histogram::FactoryGet(
-          kNumTasksBeforeDetachHistogramPrefix + name_ + kPoolNameSuffix,
+          JoinString({kNumTasksBeforeDetachHistogramPrefix, histogram_label,
+                      kPoolNameSuffix},
+                     ""),
           1,
           1000,
           50,
@@ -185,11 +191,16 @@
       // When it runs more than 100 tasks, there is no need to know the exact
       // number of tasks that ran.
       num_tasks_between_waits_histogram_(Histogram::FactoryGet(
-          kNumTasksBetweenWaitsHistogramPrefix + name_ + kPoolNameSuffix,
+          JoinString({kNumTasksBetweenWaitsHistogramPrefix, histogram_label,
+                      kPoolNameSuffix},
+                     ""),
           1,
           100,
           50,
-          HistogramBase::kUmaTargetedHistogramFlag)) {}
+          HistogramBase::kUmaTargetedHistogramFlag)) {
+  DCHECK(!histogram_label.empty());
+  DCHECK(!pool_label_.empty());
+}
 
 void SchedulerWorkerPoolImpl::Start(
     const SchedulerWorkerPoolParams& params,
@@ -366,7 +377,7 @@
   DCHECK_EQ(num_tasks_since_last_wait_, 0U);
 
   PlatformThread::SetName(
-      StringPrintf("TaskScheduler%sWorker", outer_->name_.c_str()));
+      StringPrintf("TaskScheduler%sWorker", outer_->pool_label_.c_str()));
 
   outer_->BindToCurrentThread();
   SetBlockingObserverForCurrentThread(this);
diff --git a/base/task_scheduler/scheduler_worker_pool_impl.h b/base/task_scheduler/scheduler_worker_pool_impl.h
index 49a23785..7a3d314 100644
--- a/base/task_scheduler/scheduler_worker_pool_impl.h
+++ b/base/task_scheduler/scheduler_worker_pool_impl.h
@@ -16,6 +16,7 @@
 #include "base/logging.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
+#include "base/strings/string_piece.h"
 #include "base/synchronization/atomic_flag.h"
 #include "base/synchronization/condition_variable.h"
 #include "base/task_runner.h"
@@ -58,17 +59,18 @@
 
   // Constructs a pool without workers.
   //
-  // |name| is used to label the pool's threads ("TaskScheduler" + |name| +
-  // index) and histograms ("TaskScheduler." + histogram name + "." + |name| +
-  // extra suffixes). |priority_hint| is the preferred thread priority; the
-  // actual thread priority depends on shutdown state and platform capabilities.
+  // |histogram_label| is used to label the pool's histograms ("TaskScheduler."
+  // + histogram_name + "." + |histogram_label| + extra suffixes), it must not
+  // be empty. |pool_label| is used to label the pool's threads, it must not be
+  // empty. |priority_hint| is the preferred thread priority; the actual thread
+  // priority depends on shutdown state and platform capabilities.
   // |task_tracker| keeps track of tasks. |delayed_task_manager| handles tasks
   // posted with a delay.
-  SchedulerWorkerPoolImpl(
-      const std::string& name,
-      ThreadPriority priority_hint,
-      TaskTracker* task_tracker,
-      DelayedTaskManager* delayed_task_manager);
+  SchedulerWorkerPoolImpl(StringPiece histogram_label,
+                          StringPiece pool_label,
+                          ThreadPriority priority_hint,
+                          TaskTracker* task_tracker,
+                          DelayedTaskManager* delayed_task_manager);
 
   // Creates workers following the |params| specification, allowing existing and
   // future tasks to run. Uses |service_thread_task_runner| to monitor for
@@ -204,7 +206,7 @@
   void DecrementWorkerCapacityLockRequired();
   void IncrementWorkerCapacityLockRequired();
 
-  const std::string name_;
+  const std::string pool_label_;
   const ThreadPriority priority_hint_;
 
   // PriorityQueue from which all threads of this worker pool get work.
diff --git a/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc b/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
index a93b75c..11ad614 100644
--- a/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
+++ b/base/task_scheduler/scheduler_worker_pool_impl_unittest.cc
@@ -85,7 +85,7 @@
     service_thread_.Start();
     delayed_task_manager_.Start(service_thread_.task_runner());
     worker_pool_ = std::make_unique<SchedulerWorkerPoolImpl>(
-        "TestWorkerPool", ThreadPriority::NORMAL, &task_tracker_,
+        "TestWorkerPool", "A", ThreadPriority::NORMAL, &task_tracker_,
         &delayed_task_manager_);
     ASSERT_TRUE(worker_pool_);
   }
@@ -785,7 +785,7 @@
       MakeRefCounted<TestSimpleTaskRunner>();
   delayed_task_manager.Start(service_thread_task_runner);
   auto worker_pool = std::make_unique<SchedulerWorkerPoolImpl>(
-      "OnePolicyWorkerPool", ThreadPriority::NORMAL, &task_tracker,
+      "OnePolicyWorkerPool", "A", ThreadPriority::NORMAL, &task_tracker,
       &delayed_task_manager);
   worker_pool->Start(SchedulerWorkerPoolParams(8U, TimeDelta::Max()),
                      service_thread_task_runner,
@@ -806,7 +806,7 @@
       MakeRefCounted<TestSimpleTaskRunner>();
   delayed_task_manager.Start(service_thread_task_runner);
   auto worker_pool = std::make_unique<SchedulerWorkerPoolImpl>(
-      "StandbyThreadWorkerPool", ThreadPriority::NORMAL, &task_tracker,
+      "StandbyThreadWorkerPool", "A", ThreadPriority::NORMAL, &task_tracker,
       &delayed_task_manager);
   worker_pool->Start(
       SchedulerWorkerPoolParams(worker_capacity, kReclaimTimeForCleanupTests),
@@ -1327,7 +1327,7 @@
   scoped_refptr<TaskRunner> service_thread_task_runner =
       MakeRefCounted<TestSimpleTaskRunner>();
   delayed_task_manager.Start(service_thread_task_runner);
-  SchedulerWorkerPoolImpl worker_pool("OverWorkerCapacityTestWorkerPool",
+  SchedulerWorkerPoolImpl worker_pool("OverWorkerCapacityTestWorkerPool", "A",
                                       ThreadPriority::NORMAL, &task_tracker,
                                       &delayed_task_manager);
   worker_pool.Start(
diff --git a/base/task_scheduler/scheduler_worker_pool_unittest.cc b/base/task_scheduler/scheduler_worker_pool_unittest.cc
index 818af0dd..1bade00 100644
--- a/base/task_scheduler/scheduler_worker_pool_unittest.cc
+++ b/base/task_scheduler/scheduler_worker_pool_unittest.cc
@@ -111,7 +111,7 @@
     switch (GetParam().pool_type) {
       case PoolType::GENERIC:
         worker_pool_ = std::make_unique<SchedulerWorkerPoolImpl>(
-            "TestWorkerPool", ThreadPriority::NORMAL, &task_tracker_,
+            "TestWorkerPool", "A", ThreadPriority::NORMAL, &task_tracker_,
             &delayed_task_manager_);
         break;
 #if defined(OS_WIN)
diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h
index 56393ab..6d67f25e 100644
--- a/base/task_scheduler/task_scheduler.h
+++ b/base/task_scheduler/task_scheduler.h
@@ -172,9 +172,9 @@
 
 #if !defined(OS_NACL)
   // Creates and starts a task scheduler using default params. |name| is used to
-  // label threads and histograms. It should identify the component that calls
-  // this. Start() is called by this method; it is invalid to call it again
-  // afterwards. CHECKs on failure. For tests, prefer
+  // label histograms, it must not be empty. It should identify the component
+  // that calls this. Start() is called by this method; it is invalid to call it
+  // again afterwards. CHECKs on failure. For tests, prefer
   // base::test::ScopedTaskEnvironment (ensures isolation).
   static void CreateAndStartWithDefaultParams(StringPiece name);
 
@@ -183,12 +183,12 @@
   void StartWithDefaultParams();
 #endif  // !defined(OS_NACL)
 
-  // Creates a ready to start task scheduler. |name| is used to label threads
-  // and histograms. It should identify the component that creates the
-  // TaskScheduler. The task scheduler doesn't create threads until Start() is
-  // called. Tasks can be posted at any time but will not run until after
-  // Start() is called. For tests, prefer base::test::ScopedTaskEnvironment
-  // (ensures isolation).
+  // Creates a ready to start task scheduler. |name| is used to label
+  // histograms, it must not be empty. It should identify the component that
+  // creates the TaskScheduler. The task scheduler doesn't create threads until
+  // Start() is called. Tasks can be posted at any time but will not run until
+  // after Start() is called. For tests, prefer
+  // base::test::ScopedTaskEnvironment (ensures isolation).
   static void Create(StringPiece name);
 
   // Registers |task_scheduler| to handle tasks posted through the post_task.h
diff --git a/base/task_scheduler/task_scheduler_impl.cc b/base/task_scheduler/task_scheduler_impl.cc
index 872593e8..624865c 100644
--- a/base/task_scheduler/task_scheduler_impl.cc
+++ b/base/task_scheduler/task_scheduler_impl.cc
@@ -4,6 +4,7 @@
 
 #include "base/task_scheduler/task_scheduler_impl.h"
 
+#include <string>
 #include <utility>
 
 #include "base/metrics/field_trial_params.h"
@@ -18,11 +19,14 @@
 namespace base {
 namespace internal {
 
+TaskSchedulerImpl::TaskSchedulerImpl(StringPiece histogram_label)
+    : TaskSchedulerImpl(histogram_label,
+                        std::make_unique<TaskTrackerImpl>(histogram_label)) {}
+
 TaskSchedulerImpl::TaskSchedulerImpl(
-    StringPiece name,
+    StringPiece histogram_label,
     std::unique_ptr<TaskTrackerImpl> task_tracker)
-    : name_(name),
-      service_thread_("TaskSchedulerServiceThread"),
+    : service_thread_("TaskSchedulerServiceThread"),
       task_tracker_(std::move(task_tracker)),
       single_thread_task_runner_manager_(task_tracker_.get(),
                                          &delayed_task_manager_) {
@@ -34,8 +38,14 @@
 
   for (int environment_type = 0; environment_type < ENVIRONMENT_COUNT;
        ++environment_type) {
+    std::string worker_pool_histogram_label(histogram_label);
+    if (!worker_pool_histogram_label.empty())
+      worker_pool_histogram_label += ".";
+    worker_pool_histogram_label +=
+        kEnvironmentParams[environment_type].name_suffix;
     worker_pools_[environment_type] = std::make_unique<SchedulerWorkerPoolImpl>(
-        name_ + kEnvironmentParams[environment_type].name_suffix,
+        std::move(worker_pool_histogram_label),
+        kEnvironmentParams[environment_type].name_suffix,
         kEnvironmentParams[environment_type].priority_hint, task_tracker_.get(),
         &delayed_task_manager_);
   }
@@ -143,7 +153,7 @@
     SingleThreadTaskRunnerThreadMode thread_mode) {
   return single_thread_task_runner_manager_
       .CreateSingleThreadTaskRunnerWithTraits(
-          name_, SetUserBlockingPriorityIfNeeded(traits), thread_mode);
+          SetUserBlockingPriorityIfNeeded(traits), thread_mode);
 }
 
 #if defined(OS_WIN)
@@ -152,7 +162,7 @@
     const TaskTraits& traits,
     SingleThreadTaskRunnerThreadMode thread_mode) {
   return single_thread_task_runner_manager_.CreateCOMSTATaskRunnerWithTraits(
-      name_, SetUserBlockingPriorityIfNeeded(traits), thread_mode);
+      SetUserBlockingPriorityIfNeeded(traits), thread_mode);
 }
 #endif  // defined(OS_WIN)
 
diff --git a/base/task_scheduler/task_scheduler_impl.h b/base/task_scheduler/task_scheduler_impl.h
index 2714989..d7c3493 100644
--- a/base/task_scheduler/task_scheduler_impl.h
+++ b/base/task_scheduler/task_scheduler_impl.h
@@ -50,12 +50,14 @@
       TaskTracker;
 #endif
 
-  // |name| is used to label threads and histograms. |task_tracker| can be used
-  // for tests that need more execution control. By default, the production
-  // TaskTracker is used.
-  explicit TaskSchedulerImpl(StringPiece name,
-                             std::unique_ptr<TaskTrackerImpl> task_tracker =
-                                 std::make_unique<TaskTrackerImpl>());
+  // Creates a TaskSchedulerImpl with a production TaskTracker.
+  //|histogram_label| is used to label histograms.
+  explicit TaskSchedulerImpl(StringPiece histogram_label);
+
+  // For testing only. Creates a TaskSchedulerImpl with a custom TaskTracker.
+  TaskSchedulerImpl(StringPiece histogram_label,
+                    std::unique_ptr<TaskTrackerImpl> task_tracker);
+
   ~TaskSchedulerImpl() override;
 
   // TaskScheduler:
@@ -92,7 +94,6 @@
   // |all_tasks_user_blocking_| is set.
   TaskTraits SetUserBlockingPriorityIfNeeded(const TaskTraits& traits) const;
 
-  const std::string name_;
   Thread service_thread_;
   const std::unique_ptr<TaskTrackerImpl> task_tracker_;
   DelayedTaskManager delayed_task_manager_;
diff --git a/base/task_scheduler/task_tracker.cc b/base/task_scheduler/task_tracker.cc
index 2069f4d..7ba855ea 100644
--- a/base/task_scheduler/task_tracker.cc
+++ b/base/task_scheduler/task_tracker.cc
@@ -73,16 +73,22 @@
 // its implementation details.
 const char kRunFunctionName[] = "TaskSchedulerRunTask";
 
-HistogramBase* GetTaskLatencyHistogram(const char* suffix) {
+HistogramBase* GetTaskLatencyHistogram(StringPiece histogram_label,
+                                       StringPiece task_type_suffix) {
   // Mimics the UMA_HISTOGRAM_TIMES macro except we don't specify bounds with
   // TimeDeltas as FactoryTimeGet assumes millisecond granularity. The minimums
   // and maximums were chosen to place the 1ms mark at around the 70% range
   // coverage for buckets giving us good info for tasks that have a latency
   // below 1ms (most of them) and enough info to assess how bad the latency is
   // for tasks that exceed this threshold.
-  return Histogram::FactoryGet(
-      std::string("TaskScheduler.TaskLatencyMicroseconds.") + suffix, 1, 20000,
-      50, HistogramBase::kUmaTargetedHistogramFlag);
+  std::string histogram_name = "TaskScheduler.TaskLatencyMicroseconds.";
+  if (!histogram_label.empty()) {
+    histogram_label.AppendToString(&histogram_name);
+    histogram_name.push_back('.');
+  }
+  task_type_suffix.AppendToString(&histogram_name);
+  return Histogram::FactoryGet(histogram_name, 1, 20000, 50,
+                               HistogramBase::kUmaTargetedHistogramFlag);
 }
 
 // Upper bound for the
@@ -214,19 +220,23 @@
   CanScheduleSequenceObserver* observer = nullptr;
 };
 
-TaskTracker::TaskTracker(int max_num_scheduled_background_sequences)
+TaskTracker::TaskTracker(StringPiece histogram_label,
+                         int max_num_scheduled_background_sequences)
     : state_(new State),
       flush_cv_(flush_lock_.CreateConditionVariable()),
       shutdown_lock_(&flush_lock_),
       max_num_scheduled_background_sequences_(
           max_num_scheduled_background_sequences),
       task_latency_histograms_{
-          {GetTaskLatencyHistogram("BackgroundTaskPriority"),
-           GetTaskLatencyHistogram("BackgroundTaskPriority.MayBlock")},
-          {GetTaskLatencyHistogram("UserVisibleTaskPriority"),
-           GetTaskLatencyHistogram("UserVisibleTaskPriority.MayBlock")},
-          {GetTaskLatencyHistogram("UserBlockingTaskPriority"),
-           GetTaskLatencyHistogram("UserBlockingTaskPriority.MayBlock")}} {
+          {GetTaskLatencyHistogram(histogram_label, "BackgroundTaskPriority"),
+           GetTaskLatencyHistogram(histogram_label,
+                                   "BackgroundTaskPriority_MayBlock")},
+          {GetTaskLatencyHistogram(histogram_label, "UserVisibleTaskPriority"),
+           GetTaskLatencyHistogram(histogram_label,
+                                   "UserVisibleTaskPriority_MayBlock")},
+          {GetTaskLatencyHistogram(histogram_label, "UserBlockingTaskPriority"),
+           GetTaskLatencyHistogram(histogram_label,
+                                   "UserBlockingTaskPriority_MayBlock")}} {
   // Confirm that all |task_latency_histograms_| have been initialized above.
   DCHECK(*(&task_latency_histograms_[static_cast<int>(TaskPriority::HIGHEST) +
                                      1][0] -
diff --git a/base/task_scheduler/task_tracker.h b/base/task_scheduler/task_tracker.h
index d425027..fc856b47 100644
--- a/base/task_scheduler/task_tracker.h
+++ b/base/task_scheduler/task_tracker.h
@@ -15,6 +15,7 @@
 #include "base/logging.h"
 #include "base/macros.h"
 #include "base/metrics/histogram_base.h"
+#include "base/strings/string_piece.h"
 #include "base/synchronization/waitable_event.h"
 #include "base/task_scheduler/can_schedule_sequence_observer.h"
 #include "base/task_scheduler/scheduler_lock.h"
@@ -84,9 +85,11 @@
 // TaskPriority::USER_BLOCKING.
 class BASE_EXPORT TaskTracker {
  public:
+  // |histogram_label| is used as a suffix for histograms (optional)
   // |max_num_scheduled_background_sequences| is the maximum number of
-  // background sequences that be scheduled concurrently.
-  TaskTracker(int max_num_scheduled_background_sequences =
+  // background sequences that can be scheduled concurrently (default to max())
+  TaskTracker(StringPiece histogram_label = StringPiece(),
+              int max_num_scheduled_background_sequences =
                   std::numeric_limits<int>::max());
   virtual ~TaskTracker();
 
diff --git a/base/task_scheduler/task_tracker_posix.cc b/base/task_scheduler/task_tracker_posix.cc
index a1e3137b..8289d90 100644
--- a/base/task_scheduler/task_tracker_posix.cc
+++ b/base/task_scheduler/task_tracker_posix.cc
@@ -11,7 +11,7 @@
 namespace base {
 namespace internal {
 
-TaskTrackerPosix::TaskTrackerPosix() = default;
+TaskTrackerPosix::TaskTrackerPosix(StringPiece name) : TaskTracker(name) {}
 TaskTrackerPosix::~TaskTrackerPosix() = default;
 
 void TaskTrackerPosix::RunOrSkipTask(Task task,
diff --git a/base/task_scheduler/task_tracker_posix.h b/base/task_scheduler/task_tracker_posix.h
index 70c28825..a8a0d33c 100644
--- a/base/task_scheduler/task_tracker_posix.h
+++ b/base/task_scheduler/task_tracker_posix.h
@@ -27,7 +27,7 @@
 // TaskTracker can run tasks.
 class BASE_EXPORT TaskTrackerPosix : public TaskTracker {
  public:
-  TaskTrackerPosix();
+  TaskTrackerPosix(StringPiece name = StringPiece());
   ~TaskTrackerPosix() override;
 
   // Sets the MessageLoopForIO with which to setup FileDescriptorWatcher in the
diff --git a/base/task_scheduler/task_tracker_unittest.cc b/base/task_scheduler/task_tracker_unittest.cc
index 3ae81375..f00f221 100644
--- a/base/task_scheduler/task_tracker_unittest.cc
+++ b/base/task_scheduler/task_tracker_unittest.cc
@@ -901,7 +901,7 @@
 TEST_F(TaskSchedulerTaskTrackerTest,
        WillScheduleBackgroundSequenceWithMaxBackgroundSequences) {
   constexpr int kMaxNumDispatchedBackgroundSequences = 2;
-  TaskTracker tracker(kMaxNumDispatchedBackgroundSequences);
+  TaskTracker tracker(StringPiece(), kMaxNumDispatchedBackgroundSequences);
 
   // Simulate posting |kMaxNumDispatchedBackgroundSequences| background tasks
   // and scheduling the associated sequences. This should succeed.
@@ -980,7 +980,7 @@
 TEST_F(TaskSchedulerTaskTrackerTest,
        RunNextBackgroundTaskWithEarlierPendingBackgroundTask) {
   constexpr int kMaxNumDispatchedBackgroundSequences = 1;
-  TaskTracker tracker(kMaxNumDispatchedBackgroundSequences);
+  TaskTracker tracker(StringPiece(), kMaxNumDispatchedBackgroundSequences);
   testing::StrictMock<MockCanScheduleSequenceObserver> never_notified_observer;
 
   // Simulate posting a background task and scheduling the associated sequence.
@@ -1115,29 +1115,33 @@
   struct {
     const TaskTraits traits;
     const char* const expected_histogram;
-  } tests[] = {
-      {{TaskPriority::BACKGROUND},
-       "TaskScheduler.TaskLatencyMicroseconds.BackgroundTaskPriority"},
-      {{MayBlock(), TaskPriority::BACKGROUND},
-       "TaskScheduler.TaskLatencyMicroseconds.BackgroundTaskPriority.MayBlock"},
-      {{WithBaseSyncPrimitives(), TaskPriority::BACKGROUND},
-       "TaskScheduler.TaskLatencyMicroseconds.BackgroundTaskPriority.MayBlock"},
-      {{TaskPriority::USER_VISIBLE},
-       "TaskScheduler.TaskLatencyMicroseconds.UserVisibleTaskPriority"},
-      {{MayBlock(), TaskPriority::USER_VISIBLE},
-       "TaskScheduler.TaskLatencyMicroseconds.UserVisibleTaskPriority."
-       "MayBlock"},
-      {{WithBaseSyncPrimitives(), TaskPriority::USER_VISIBLE},
-       "TaskScheduler.TaskLatencyMicroseconds.UserVisibleTaskPriority."
-       "MayBlock"},
-      {{TaskPriority::USER_BLOCKING},
-       "TaskScheduler.TaskLatencyMicroseconds.UserBlockingTaskPriority"},
-      {{MayBlock(), TaskPriority::USER_BLOCKING},
-       "TaskScheduler.TaskLatencyMicroseconds.UserBlockingTaskPriority."
-       "MayBlock"},
-      {{WithBaseSyncPrimitives(), TaskPriority::USER_BLOCKING},
-       "TaskScheduler.TaskLatencyMicroseconds.UserBlockingTaskPriority."
-       "MayBlock"}};
+  } tests[] = {{{TaskPriority::BACKGROUND},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "BackgroundTaskPriority"},
+               {{MayBlock(), TaskPriority::BACKGROUND},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "BackgroundTaskPriority_MayBlock"},
+               {{WithBaseSyncPrimitives(), TaskPriority::BACKGROUND},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "BackgroundTaskPriority_MayBlock"},
+               {{TaskPriority::USER_VISIBLE},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "UserVisibleTaskPriority"},
+               {{MayBlock(), TaskPriority::USER_VISIBLE},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "UserVisibleTaskPriority_MayBlock"},
+               {{WithBaseSyncPrimitives(), TaskPriority::USER_VISIBLE},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "UserVisibleTaskPriority_MayBlock"},
+               {{TaskPriority::USER_BLOCKING},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "UserBlockingTaskPriority"},
+               {{MayBlock(), TaskPriority::USER_BLOCKING},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "UserBlockingTaskPriority_MayBlock"},
+               {{WithBaseSyncPrimitives(), TaskPriority::USER_BLOCKING},
+                "TaskScheduler.TaskLatencyMicroseconds."
+                "UserBlockingTaskPriority_MayBlock"}};
 
   for (const auto& test : tests) {
     Task task(FROM_HERE, Bind(&DoNothing), test.traits, TimeDelta());
diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py
index 54a7fe3..42202e95 100755
--- a/build/android/gyp/javac.py
+++ b/build/android/gyp/javac.py
@@ -33,6 +33,10 @@
   'ArgumentSelectionDefectChecker',
   # TODO(crbug.com/801268): Follow steps in bug.
   'NarrowingCompoundAssignment',
+  # TODO(crbug.com/802073): Follow steps in bug.
+  'TypeParameterUnusedInFormals',
+  # TODO(crbug.com/802075): Follow steps in bug
+  'ReferenceEquality',
   # Android platform default is always UTF-8.
   # https://developer.android.com/reference/java/nio/charset/Charset.html#defaultCharset()
   'DefaultCharset',
@@ -46,8 +50,34 @@
   'OperatorPrecedence',
   # Just false positives in our code.
   'ThreadJoinLoop',
-  # Alias of ParameterName warning
+  # Alias of ParameterName warning.
   'NamedParameters',
+  # Low priority corner cases with String.split.
+  'StringSplitter',
+  # Preferred to use another method since it propagates exceptions better.
+  'ClassNewInstance',
+  # Nice to have static inner classes but not necessary.
+  'ClassCanBeStatic',
+  # Explicit is better than implicit.
+  'FloatCast',
+  # Results in false positives.
+  'ThreadLocalUsage',
+  # Also just false positives.
+  'Finally',
+  # False positives for Chromium.
+  'FragmentNotInstantiable',
+  # Low priority to fix.
+  'HidingField',
+  # Low priority.
+  'IntLongMath',
+  # Low priority.
+  'BadComparable',
+  # Low priority.
+  'EqualsHashCode',
+  # Nice to fix but low priority.
+  'TypeParameterShadowing',
+  # Good to have immutable enums, also low priority.
+  'ImmutableEnumChecker',
 ]
 
 ERRORPRONE_WARNINGS_TO_ERROR = [
diff --git a/build/cipd/android/android.ensure b/build/cipd/android/android.ensure
index 9a2c705c..a6327b33 100644
--- a/build/cipd/android/android.ensure
+++ b/build/cipd/android/android.ensure
@@ -70,7 +70,7 @@
 # endless merge conflicts
 
 @Subdir third_party/guava
-chromium/third_party/guava version:20.0-cr0
+chromium/third_party/guava version:23.0-cr0
 
 # Three unchanging lines
 # avoid the horror that is
diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn
index 26a96c5..ae4a1bf 100644
--- a/build/config/posix/BUILD.gn
+++ b/build/config/posix/BUILD.gn
@@ -63,29 +63,16 @@
     } else {
       ldflags += [ "-nodefaultlibs" ]
 
-      # Unfortunately, there's no way to disable linking against just
-      # libc++ (besides using clang instead of clang++); -nodefaultlibs
-      # removes all of the default libraries, so add back the ones that we
-      # need.
+      # Unfortunately, there's no way to disable linking against just libc++
+      # (gcc doesn't have -notstdlib++:
+      # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83931); -nodefaultlibs
+      # removes all of the default libraries, so add back the ones that we need.
       libs += [
         "c",
+        "gcc_s",
         "m",
+        "rt",
       ]
-
-      if (!is_mac && !is_fuchsia && !is_android) {
-        libs += [
-          "gcc_s",
-          "rt",
-        ]
-      }
-
-      if (is_mac && using_sanitizer) {
-        lib_dirs += [ "//third_party/llvm-build/Release+Asserts/lib/clang/$clang_version/lib/darwin" ]
-
-        if (is_asan) {
-          libs += [ "clang_rt.asan_osx_dynamic" ]
-        }
-      }
     }
   }
 
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index f17b46fe..e7f884a 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -6,6 +6,7 @@
 #include <stdint.h>
 
 #include "base/memory/ptr_util.h"
+#include "build/build_config.h"
 #include "cc/layers/heads_up_display_layer.h"
 #include "cc/layers/layer_impl.h"
 #include "cc/layers/painted_scrollbar_layer.h"
@@ -1348,7 +1349,11 @@
   UIResourceId test_id1_;
 };
 
-SINGLE_AND_MULTI_THREAD_TEST_F(UIResourceLostBeforeCommit);
+// http://crbug.com/803532 : Flaky on Win 7 (dbg).
+#if defined(NDEBUG) || defined(OS_WIN)
+SINGLE_THREAD_TEST_F(UIResourceLostBeforeCommit);
+#endif
+MULTI_THREAD_TEST_F(UIResourceLostBeforeCommit);
 
 // Losing UI resource before the pending trees is activated but after the
 // commit.  Impl-side-painting only.
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
index 09135d0..800ba16 100644
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -361,25 +361,6 @@
             android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize">
             {{ self.supports_vr() }}
         </activity>
-        <!-- This alias allows us to dynamically toggle whether the Chrome icon shows up in Daydream
-             home. It starts off disabled and is enabled dynamically via a feature flag when Chrome
-             is started. -->
-        <activity-alias android:name="com.google.android.apps.chrome.VrIntentDispatcher"
-            android:targetActivity="org.chromium.chrome.browser.vr.VrMainActivity"
-            android:enabled="false"
-            android:exported="true">
-            <!-- These icons are placeholders, and only show up behind a flag that's disabled by
-                 default. -->
-            <meta-data android:name="com.google.android.vr.icon"
-                android:resource="@drawable/ic_launcher" />
-            <meta-data android:name="com.google.android.vr.icon_background"
-                android:resource="@drawable/ic_launcher" />
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <!-- Show icon in Daydream app launcher. -->
-                <category android:name="com.google.intent.category.DAYDREAM" />
-            </intent-filter>
-        </activity-alias>
         <activity android:name="org.chromium.chrome.browser.vr.CustomTabVrActivity"
             android:theme="@style/VrSupportTheme"
             android:screenOrientation="landscape"
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
index 1bfa6fe..f8215688 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
@@ -248,7 +248,6 @@
     public static final String VR_BROWSING = "VrBrowsing";
     public static final String VR_BROWSING_FEEDBACK = "VrBrowsingFeedback";
     public static final String VR_BROWSING_IN_CUSTOM_TAB = "VrBrowsingInCustomTab";
-    public static final String VR_ICON_IN_DAYDREAM_HOME = "VrIconInDaydreamHome";
     public static final String VR_LAUNCH_INTENT = "VrLaunchIntents";
     public static final String WEB_PAYMENTS = "WebPayments";
     public static final String WEB_PAYMENTS_METHOD_SECTION_ORDER_V2 =
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelMetrics.java
index 04dd2bd..4e2e55c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelMetrics.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/contextualsearch/ContextualSearchPanelMetrics.java
@@ -58,6 +58,8 @@
     // The current set of heuristics to be logged through ranker with results seen when the panel
     // closes.
     private ContextualSearchRankerLogger mRankerLogger;
+    // Whether Ranker Outcomes are valid, because we showed the panel.
+    private boolean mAreOutcomesValid;
 
     /**
      * Log information when the panel's state has changed.
@@ -160,6 +162,7 @@
             } else {
                 mWasAnyHeuristicSatisfiedOnPanelShow = false;
             }
+            mAreOutcomesValid = true;
         }
 
         // Log state changes. We only log the first transition to a state within a contextual
@@ -323,15 +326,14 @@
      */
     public void setRankerLogger(ContextualSearchRankerLogger rankerLogger) {
         mRankerLogger = rankerLogger;
+        mAreOutcomesValid = false;
     }
 
     /**
      * Writes all the outcome features to the Ranker Logger and resets the logger.
-     * @param rankerLogger The {@link ContextualSearchRankerLogger} currently being used to measure
-     *                     or suppress the UI by Ranker.
      */
     public void writeRankerLoggerOutcomesAndReset() {
-        if (mRankerLogger != null && mWasActivatedByTap) {
+        if (mRankerLogger != null && mWasActivatedByTap && mAreOutcomesValid) {
             // Tell Ranker about the primary outcome.
             mRankerLogger.logOutcome(ContextualSearchRankerLogger.Feature.OUTCOME_WAS_PANEL_OPENED,
                     mWasSearchContentViewSeen);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
index 6b5f8bf..05e4154 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
@@ -1574,6 +1574,10 @@
             @Override
             public void tapGestureCommit() {
                 mInternalStateController.notifyStartingWorkOn(InternalState.TAP_GESTURE_COMMIT);
+                if (!mPolicy.isTapSupported()) {
+                    hideContextualSearch(StateChangeReason.UNKNOWN);
+                    return;
+                }
                 // We may be processing a chained search (aka a retap -- a tap near a previous tap).
                 // If it's chained we need to log the outcomes and reset, because we won't be hiding
                 // the panel at the end of the previous search (we'll update it to the new Search).
@@ -1598,11 +1602,7 @@
             @Override
             public void startShowingTapUi() {
                 WebContents baseWebContents = getBaseWebContents();
-                // TODO(donnd): Call isTapSupported earlier so we don't waste time gathering
-                // surrounding text and deciding suppression when unsupported, or remove the whole
-                // idea of unsupported taps in favor of deciding suppression better.
-                // Details in crbug.com/715297.
-                if (baseWebContents != null && mPolicy.isTapSupported()) {
+                if (baseWebContents != null) {
                     mInternalStateController.notifyStartingWorkOn(
                             InternalState.START_SHOWING_TAP_UI);
                     mSelectWordAroundCaretCounter++;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLogger.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLogger.java
index d2ea2aa5..19ce6e04 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLogger.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLogger.java
@@ -13,6 +13,9 @@
  */
 public interface ContextualSearchRankerLogger {
     // TODO(donnd): consider changing this enum to an IntDef.
+    // NOTE: this list needs to be kept in sync with the white list in
+    // predictor_config_definitions.cc, the names list in ContextualSearchRankerLoggerImpl.java
+    // and with ukm.xml!
     enum Feature {
         UNKNOWN,
         // Outcome labels:
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLoggerImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLoggerImpl.java
index 5f7a07f..bb6a30a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLoggerImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchRankerLoggerImpl.java
@@ -35,6 +35,8 @@
         outcomes.put(Feature.OUTCOME_WAS_CARDS_DATA_SHOWN, "OutcomeWasCardsDataShown");
         OUTCOMES = Collections.unmodifiableMap(outcomes);
 
+        // NOTE: this list needs to be kept in sync with the white list in
+        // predictor_config_definitions.cc and with ukm.xml!
         Map<Feature, String> features = new HashMap<Feature, String>();
         features.put(Feature.DURATION_AFTER_SCROLL_MS, "DurationAfterScrollMs");
         features.put(Feature.SCREEN_TOP_DPS, "ScreenTopDps");
@@ -102,6 +104,7 @@
      * no longer in use.  The nativeDestroy will call the destructor on the native instance.
      */
     void destroy() {
+        // TODO(donnd): looks like this is never being called.  Fix.
         if (isEnabled()) {
             assert mNativePointer != 0;
             writeLogAndReset();
@@ -135,17 +138,17 @@
 
     @Override
     public void logOutcome(Feature feature, Object value) {
+        assert mIsLoggingReadyForPage;
+        assert mHasInferenceOccurred;
         if (!isEnabled()) return;
 
-        // Since the panel can be closed at any time, we might try to log that outcome immediately.
-        if (!mIsLoggingReadyForPage) return;
-
-        if (mHasInferenceOccurred) logInternal(feature, value);
+        logInternal(feature, value);
     }
 
     @Override
     public @AssistRankerPrediction int runPredictionForTapSuppression() {
         assert mIsLoggingReadyForPage;
+        assert !mHasInferenceOccurred;
         mHasInferenceOccurred = true;
         if (isEnabled() && mBasePageWebContents != null && mFeaturesToLog != null
                 && !mFeaturesToLog.isEmpty()) {
@@ -155,6 +158,7 @@
             mFeaturesLoggedForTesting = mFeaturesToLog;
             mFeaturesToLog = new HashMap<Feature, Object>();
             mAssistRankerPrediction = nativeRunInference(mNativePointer);
+            ContextualSearchUma.logRecordedFeaturesToRanker();
         }
         return mAssistRankerPrediction;
     }
@@ -186,6 +190,7 @@
                     logObject(entry.getKey(), entry.getValue());
                 }
                 mOutcomesLoggedForTesting = mFeaturesToLog;
+                ContextualSearchUma.logRecordedOutcomesToRanker();
             }
             nativeWriteLogAndReset(mNativePointer);
         }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchUma.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchUma.java
index d66b984..27617194 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchUma.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchUma.java
@@ -1314,6 +1314,25 @@
         }
     }
 
+    /** Logs that Ranker recorded a set of features for training or inference. */
+    public static void logRecordedFeaturesToRanker() {
+        logRecordedToRanker(false);
+    }
+
+    /** Logs that Ranker recorded a set of outcomes for training or inference. */
+    public static void logRecordedOutcomesToRanker() {
+        logRecordedToRanker(true);
+    }
+
+    /**
+     * Logs that Ranker recorded some data for training or inference.
+     * @param areOutcomes Whether the data are outcomes.
+     */
+    private static void logRecordedToRanker(boolean areOutcomes) {
+        RecordHistogram.recordBooleanHistogram(
+                "Search.ContextualSearch.Ranker.Recorded", areOutcomes);
+    }
+
     /**
      * Gets the state-change code for the given parameters by doing a lookup in the given map.
      * @param state The panel state.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
index 22320609..98235ce 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java
@@ -717,8 +717,12 @@
      */
     public static String getPendingStatusString(PendingState pendingState) {
         Context context = ContextUtils.getApplicationContext();
-        if (ChromeFeatureList.isEnabled(
-                    ChromeFeatureList.OFFLINE_PAGES_DESCRIPTIVE_PENDING_STATUS)) {
+        // When foreground service restarts and there is no connection to native, use the default
+        // pending status. The status will be replaced when connected to native.
+        if (BrowserStartupController.get(LibraryProcessType.PROCESS_BROWSER)
+                        .isStartupSuccessfullyCompleted()
+                && ChromeFeatureList.isEnabled(
+                           ChromeFeatureList.OFFLINE_PAGES_DESCRIPTIVE_PENDING_STATUS)) {
             switch (pendingState) {
                 case PENDING_NETWORK:
                     return context.getString(R.string.download_notification_pending_network);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java
index 7721d0d59..8f8a2531 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ui/OfflineGroupHeaderView.java
@@ -79,6 +79,7 @@
 
     @Override
     public void setChecked(boolean checked) {
+        if (checked == isChecked()) return;
         super.setChecked(checked);
         updateCheckIcon(checked);
     }
@@ -105,6 +106,7 @@
         mDescriptionTextView.setText(description);
         updateExpandIcon(header.isExpanded());
         setChecked(mSelectionDelegate.isHeaderSelected(header));
+        updateCheckIcon(isChecked());
     }
 
     private void updateExpandIcon(boolean expanded) {
@@ -124,8 +126,9 @@
                 mIconImageView.setBackgroundColor(mIconBackgroundColorSelected);
             }
 
-            mIconImageView.setImageResource(R.drawable.ic_check_googblue_24dp);
+            mIconImageView.setImageDrawable(mCheckDrawable);
             mIconImageView.setTint(mCheckedIconForegroundColorList);
+            mCheckDrawable.start();
         } else {
             if (FeatureUtilities.isChromeHomeEnabled()) {
                 mIconImageView.setBackgroundResource(mIconBackgroundResId);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
index 63f7af07..108d1db 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
@@ -56,12 +56,13 @@
     @Override
     public void onPause() {
         super.onPause();
+        UmaUtils.recordBackgroundTime();
         flushPersistentData();
     }
 
     @Override
-    public void onStart() {
-        super.onStart();
+    public void onResume() {
+        super.onResume();
         // Since the FRE may be shown before any tab is shown, mark that this is the point at
         // which Chrome went to foreground. This is needed as otherwise an assert will be hit
         // in UmaUtils.getForegroundStartTicks() when recording the time taken to load the first
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java
index 3c1a1dc..19e614cd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/UmaUtils.java
@@ -67,7 +67,7 @@
     public static void registerFinishNavigation(boolean isTrackedPage) {
         if (!isRunningApplicationStart()) return;
 
-        if (isTrackedPage) {
+        if (isTrackedPage && hasComeToForeground() && !hasComeToBackground()) {
             sFirstCommitTimeMs = SystemClock.uptimeMillis() - sApplicationStartTimeMs;
             RecordHistogram.recordLongTimesHistogram100(
                     "Startup.Android.Experimental.Cold.TimeToFirstNavigationCommit",
@@ -86,9 +86,11 @@
         // record if the first commit time wasn't recorded.
         if (sFirstCommitTimeMs == 0) return;
 
-        RecordHistogram.recordLongTimesHistogram100(
-                "Startup.Android.Experimental.Cold.TimeToFirstContentfulPaint",
-                firstContentfulPaintMs - sApplicationStartTimeMs, TimeUnit.MILLISECONDS);
+        if (hasComeToForeground() && !hasComeToBackground()) {
+            RecordHistogram.recordLongTimesHistogram100(
+                    "Startup.Android.Experimental.Cold.TimeToFirstContentfulPaint",
+                    firstContentfulPaintMs - sApplicationStartTimeMs, TimeUnit.MILLISECONDS);
+        }
     }
 
     /**
@@ -99,6 +101,13 @@
     }
 
     /**
+     * Determines if Chrome was brought to background.
+     */
+    public static boolean hasComeToBackground() {
+        return sBackgroundTimeMs != 0;
+    }
+
+    /**
      * Whether the application is in the early stage since the browser process start. Currently, the
      * very first finished navigation in the lifetime of the process ends the "application start".
      * Must only be called on the UI thread.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java
index cec5530..16888e56 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxy.java
@@ -9,6 +9,7 @@
 import android.app.NotificationChannel;
 import android.app.NotificationChannelGroup;
 import android.os.Build;
+import android.service.notification.StatusBarNotification;
 
 import java.util.List;
 
@@ -44,4 +45,7 @@
 
     @TargetApi(Build.VERSION_CODES.O)
     void deleteNotificationChannelGroup(String groupId);
+
+    @TargetApi(Build.VERSION_CODES.M)
+    StatusBarNotification[] getActiveNotifications();
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxyImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxyImpl.java
index ca60a71f..0ca812f0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxyImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationManagerProxyImpl.java
@@ -10,6 +10,7 @@
 import android.app.NotificationChannelGroup;
 import android.app.NotificationManager;
 import android.os.Build;
+import android.service.notification.StatusBarNotification;
 
 import java.util.List;
 
@@ -103,4 +104,11 @@
         assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
         mNotificationManager.deleteNotificationChannelGroup(groupId);
     }
+
+    @TargetApi(Build.VERSION_CODES.M)
+    @Override
+    public StatusBarNotification[] getActiveNotifications() {
+        assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
+        return mNotificationManager.getActiveNotifications();
+    }
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
index d88d637..01644968 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
@@ -15,6 +15,7 @@
 import android.net.Uri;
 import android.os.Build;
 import android.os.Bundle;
+import android.service.notification.StatusBarNotification;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
@@ -742,6 +743,27 @@
     }
 
     /**
+     * Returns the list of Notification Ids belonging to all active notifications, according to
+     * the OS.
+     *
+     * Even though the getActiveNotifications() API from NotificationManager class is available
+     * on Android M onwards, the data provided by Android is only used on Android O and above
+     * because earlier versions were subject to a race condition briefly after showing or closing a
+     * notification, during which, this data would be incorrect.
+     */
+    @CalledByNative
+    private String[] getActiveNotificationsIds() {
+        assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
+        StatusBarNotification[] activeNotifications = mNotificationManager.getActiveNotifications();
+        if (activeNotifications == null) return null;
+        String[] result = new String[activeNotifications.length];
+        for (int i = 0; i < activeNotifications.length; i++) {
+            result[i] = activeNotifications[i].getTag();
+        }
+        return result;
+    }
+
+    /**
      * Calls NotificationPlatformBridgeAndroid::OnNotificationClicked in native code to indicate
      * that the notification with the given parameters has been clicked on.
      *
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 5b61d35..e85d706 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -9,12 +9,10 @@
 import android.app.ActivityOptions;
 import android.app.PendingIntent;
 import android.content.BroadcastReceiver;
-import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.pm.ActivityInfo;
-import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.graphics.Color;
 import android.net.Uri;
@@ -100,9 +98,6 @@
     static final String VR_ENTRY_RESULT_ACTION =
             "org.chromium.chrome.browser.vr_shell.VrEntryResult";
 
-    private static final String VR_INTENT_DISPATCHER_COMPONENT =
-            "com.google.android.apps.chrome.VrIntentDispatcher";
-
     private static final long REENTER_VR_TIMEOUT_MS = 1000;
     private static final int EXPECT_DON_TIMEOUT_MS = 2000;
 
@@ -117,9 +112,8 @@
     private static VrBroadcastReceiver sVrBroadcastReceiver;
     private static boolean sRegisteredDaydreamHook;
     private static boolean sAddedBlackOverlayView;
-    private static boolean sRegisteredVrAssetsComponent;
-    private static boolean sChromeStarted;
-    private static Boolean sIconComponentEnabled;
+    private static boolean sRegisteredVrAssetsComponent = false;
+    private static boolean sChromeStarted = false;
 
     private ChromeActivity mActivity;
 
@@ -351,7 +345,6 @@
                 int vrSupportLevel =
                         getVrSupportLevel(api, wrapper.createVrCoreVersionChecker(), null);
                 if (!isVrShellEnabled(vrSupportLevel)) return null;
-                updateDayreamIconComponentState(activity);
                 return api;
             }
 
@@ -464,19 +457,6 @@
         return sInstance;
     }
 
-    private static void updateDayreamIconComponentState(ChromeActivity activity) {
-        boolean enabled = ChromeFeatureList.isEnabled(ChromeFeatureList.VR_ICON_IN_DAYDREAM_HOME);
-
-        if (sIconComponentEnabled != null && enabled == sIconComponentEnabled) return;
-
-        int componentState = enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
-                                     : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
-        ComponentName component = new ComponentName(activity, VR_INTENT_DISPATCHER_COMPONENT);
-        activity.getPackageManager().setComponentEnabledSetting(
-                component, componentState, PackageManager.DONT_KILL_APP);
-        sIconComponentEnabled = enabled;
-    }
-
     private static boolean activitySupportsPresentation(Activity activity) {
         return activity instanceof ChromeTabbedActivity || activity instanceof CustomTabActivity
                 || activity instanceof WebappActivity;
@@ -980,24 +960,25 @@
      * This is called when ChromeTabbedActivity gets a new intent before native is initialized.
      */
     public static void maybeHandleVrIntentPreNative(ChromeActivity activity, Intent intent) {
-        if (!VrIntentUtils.isVrIntent(intent)) return;
-        // If we get an intent while we're already in VR, we do nothing. This is mostly
-        // because crbug.com/780673 since on Android O, every intent gets dispatched twice.
-        if (sInstance != null && sInstance.mInVr) return;
-        if (DEBUG_LOGS) Log.i(TAG, "maybeHandleVrIntentPreNative: preparing for transition");
-        // We add a black overlay view so that we can show black while the VR UI is loading.
-        // Note that this alone isn't sufficient to prevent 2D UI from showing when
-        // auto-presenting WebVR. See comment about the custom animation in {@link
-        // getVrIntentOptions}.
-        // TODO(crbug.com/775574): This hack doesn't really work to hide the 2D UI on Samsung
-        // devices since Chrome gets paused and we prematurely remove the overlay.
-        addBlackOverlayViewForActivity(activity);
+        if (VrIntentUtils.isVrIntent(intent)) {
+            // If we get an intent while we're already in VR, we do nothing. This is mostly
+            // because crbug.com/780673 since on Android O, every intent gets dispatched twice.
+            if (sInstance != null && sInstance.mInVr) return;
+            if (DEBUG_LOGS) Log.i(TAG, "maybeHandleVrIntentPreNative: preparing for transition");
+            // We add a black overlay view so that we can show black while the VR UI is loading.
+            // Note that this alone isn't sufficient to prevent 2D UI from showing when
+            // auto-presenting WebVR. See comment about the custom animation in {@link
+            // getVrIntentOptions}.
+            // TODO(crbug.com/775574): This hack doesn't really work to hide the 2D UI on Samsung
+            // devices since Chrome gets paused and we prematurely remove the overlay.
+            addBlackOverlayViewForActivity(activity);
 
-        // Enable VR mode and hide system UI. We do this here so we don't get kicked out of
-        // VR mode and to prevent seeing a flash of system UI.
-        getVrClassesWrapper().setVrModeEnabled(activity, true);
-        activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
-        activity.getWindow().getDecorView().setSystemUiVisibility(VR_SYSTEM_UI_FLAGS);
+            // Enable VR mode and hide system UI. We do this here so we don't get kicked out of
+            // VR mode and to prevent seeing a flash of system UI.
+            getVrClassesWrapper().setVrModeEnabled(activity, true);
+            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+            activity.getWindow().getDecorView().setSystemUiVisibility(VR_SYSTEM_UI_FLAGS);
+        }
     }
 
     /**
@@ -1248,7 +1229,6 @@
                     if (!sRegisteredVrAssetsComponent) {
                         registerVrAssetsComponentIfDaydreamUser(isDaydreamCurrentViewer());
                     }
-                    updateDayreamIconComponentState(mActivity);
                 }
             });
         }
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
index 82493e7..82d7287 100644
--- a/chrome/android/java/strings/android_chrome_strings.grd
+++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -731,8 +731,8 @@
       <message name="IDS_READER_FOR_ACCESSIBILITY_TITLE" desc="Title of preference that allows the user to use simplified view on any articles, even if the page is mobile-friendly. Simplified view is the new user-facing name for Reader Mode, which extracts the content of an article and removes clutter from a web page and puts the result in a easier-to-read format.">
         Simplified view
       </message>
-      <message name="IDS_READER_FOR_ACCESSIBILITY_SUMMARY" desc="Summary of preference that allows the user to use simplified view on any articles, even if the page is mobile-friendly.">
-        Enable simplified view on all articles
+      <message name="IDS_READER_FOR_ACCESSIBILITY_SUMMARY" desc="Summary of preference that allows the user to use simplified view on any supported articles, even if the page is mobile-friendly.">
+        Offer to show articles in simplified view, when supported
       </message>
 
       <!-- Site settings -->
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
index 56abfe1..fb4c28a 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/history/HistoryActivityTest.java
@@ -38,7 +38,6 @@
 import org.chromium.base.ThreadUtils;
 import org.chromium.base.test.util.CallbackHelper;
 import org.chromium.base.test.util.CommandLineFlags;
-import org.chromium.base.test.util.DisabledTest;
 import org.chromium.base.test.util.Restriction;
 import org.chromium.base.test.util.RetryOnFailure;
 import org.chromium.chrome.R;
@@ -353,8 +352,7 @@
 
     @Test
     @SmallTest
-    //@RetryOnFailure(message = "https://crbug.com/752520")
-    @DisabledTest(message = "https://crbug.com/776251")
+    @RetryOnFailure(message = "https://crbug.com/752520")
     public void testSupervisedUser() throws Exception {
         final HistoryManagerToolbar toolbar = mHistoryManager.getToolbarForTests();
         final SelectableItemView<HistoryItem> item = getItemView(2);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java
index e732920..6760423 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/metrics/StartupLoadingMetricsTest.java
@@ -5,6 +5,7 @@
 package org.chromium.chrome.browser.metrics;
 
 import android.content.Context;
+import android.content.Intent;
 import android.support.test.InstrumentationRegistry;
 import android.support.test.filters.LargeTest;
 
@@ -23,6 +24,7 @@
 import org.chromium.chrome.browser.ChromeTabbedActivity;
 import org.chromium.chrome.test.ChromeActivityTestRule;
 import org.chromium.chrome.test.ChromeJUnit4ClassRunner;
+import org.chromium.chrome.test.util.ApplicationTestUtils;
 import org.chromium.net.test.EmbeddedTestServer;
 
 /**
@@ -38,6 +40,7 @@
     private static final String TEST_PAGE = "/chrome/test/data/android/google.html";
     private static final String TEST_PAGE_2 = "/chrome/test/data/android/test.html";
     private static final String ERROR_PAGE = "/close-socket";
+    private static final String SLOW_PAGE = "/slow?2";
     private static final String FIRST_COMMIT_HISTOGRAM =
             "Startup.Android.Experimental.Cold.TimeToFirstNavigationCommit";
     private static final String FIRST_CONTENTFUL_PAINT_HISTOGRAM =
@@ -46,6 +49,7 @@
     private String mTestPage;
     private String mTestPage2;
     private String mErrorPage;
+    private String mSlowPage;
     private EmbeddedTestServer mTestServer;
 
     @Before
@@ -57,6 +61,7 @@
         mTestPage = mTestServer.getURL(TEST_PAGE);
         mTestPage2 = mTestServer.getURL(TEST_PAGE_2);
         mErrorPage = mTestServer.getURL(ERROR_PAGE);
+        mSlowPage = mTestServer.getURL(SLOW_PAGE);
     }
 
     @After
@@ -64,10 +69,9 @@
         mTestServer.stopAndDestroyServer();
     }
 
-    private interface InterruptibleRunnable { void run() throws InterruptedException; }
+    private interface CheckedRunnable { void run() throws Exception; }
 
-    private void runAndWaitForPageLoadMetricsRecorded(InterruptibleRunnable runnable)
-            throws InterruptedException {
+    private void runAndWaitForPageLoadMetricsRecorded(CheckedRunnable runnable) throws Exception {
         PageLoadMetricsTest.PageLoadMetricsTestObserver testObserver =
                 new PageLoadMetricsTest.PageLoadMetricsTestObserver();
         ThreadUtils.runOnUiThreadBlockingNoException(
@@ -80,11 +84,11 @@
                 () -> PageLoadMetrics.removeObserver(testObserver));
     }
 
-    private void loadUrlAndWaitForPageLoadMetricsRecorded(String url) throws InterruptedException {
+    private void loadUrlAndWaitForPageLoadMetricsRecorded(String url) throws Exception {
         runAndWaitForPageLoadMetricsRecorded(() -> mActivityTestRule.loadUrl(url));
     }
 
-    private void assertHistogramsRecorded(int expectedCount) throws InterruptedException {
+    private void assertHistogramsRecorded(int expectedCount) {
         Assert.assertEquals(expectedCount,
                 RecordHistogram.getHistogramTotalCountForTesting(FIRST_COMMIT_HISTOGRAM));
         Assert.assertEquals(expectedCount,
@@ -97,7 +101,7 @@
     @Test
     @LargeTest
     @RetryOnFailure
-    public void testStartWithURLRecorded() throws InterruptedException {
+    public void testStartWithURLRecorded() throws Exception {
         runAndWaitForPageLoadMetricsRecorded(
                 () -> mActivityTestRule.startMainActivityWithURL(mTestPage));
         assertHistogramsRecorded(1);
@@ -112,7 +116,7 @@
     @Test
     @LargeTest
     @RetryOnFailure
-    public void testFromExternalAppRecorded() throws InterruptedException {
+    public void testFromExternalAppRecorded() throws Exception {
         runAndWaitForPageLoadMetricsRecorded(
                 () -> mActivityTestRule.startMainActivityFromExternalApp(mTestPage, null));
         assertHistogramsRecorded(1);
@@ -126,7 +130,7 @@
     @Test
     @LargeTest
     @RetryOnFailure
-    public void testNTPNotRecorded() throws InterruptedException {
+    public void testNTPNotRecorded() throws Exception {
         runAndWaitForPageLoadMetricsRecorded(
                 () -> mActivityTestRule.startMainActivityFromLauncher());
         assertHistogramsRecorded(0);
@@ -141,7 +145,7 @@
     @Test
     @LargeTest
     @RetryOnFailure
-    public void testBlankPageNotRecorded() throws InterruptedException {
+    public void testBlankPageNotRecorded() throws Exception {
         runAndWaitForPageLoadMetricsRecorded(
                 () -> mActivityTestRule.startMainActivityOnBlankPage());
         assertHistogramsRecorded(0);
@@ -156,11 +160,40 @@
     @Test
     @LargeTest
     @RetryOnFailure
-    public void testErrorPageNotRecorded() throws InterruptedException {
+    public void testErrorPageNotRecorded() throws Exception {
         runAndWaitForPageLoadMetricsRecorded(
                 () -> mActivityTestRule.startMainActivityWithURL(mErrorPage));
         assertHistogramsRecorded(0);
         loadUrlAndWaitForPageLoadMetricsRecorded(mTestPage2);
         assertHistogramsRecorded(0);
     }
+
+    /**
+     * Tests that the startup loading histograms are not recorded if the application is in
+     * background at the time of the page loading.
+     */
+    @Test
+    @LargeTest
+    @RetryOnFailure
+    public void testBackgroundedPageNotRecorded() throws Exception {
+        runAndWaitForPageLoadMetricsRecorded(() -> {
+            Intent intent = new Intent(Intent.ACTION_VIEW);
+            intent.addCategory(Intent.CATEGORY_LAUNCHER);
+
+            // mSlowPage will hang for 2 seconds before sending a response. It should be enough to
+            // put Chrome in background before the page is committed.
+            mActivityTestRule.prepareUrlIntent(intent, mSlowPage);
+            mActivityTestRule.startActivityCompletely(intent);
+
+            // Put Chrome in background before the page is committed.
+            ApplicationTestUtils.fireHomeScreenIntent(InstrumentationRegistry.getTargetContext());
+        });
+        assertHistogramsRecorded(0);
+        runAndWaitForPageLoadMetricsRecorded(() -> {
+            // Put Chrome in foreground before loading a new page.
+            ApplicationTestUtils.launchChrome(InstrumentationRegistry.getTargetContext());
+            mActivityTestRule.loadUrl(mTestPage);
+        });
+        assertHistogramsRecorded(0);
+    }
 }
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
index 6e76934..f7eb37d 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTest.java
@@ -83,12 +83,9 @@
         SyncTestUtil.waitForSyncActive();
     }
 
-    /*
-     * @LargeTest
-     * @Feature({"Sync"})
-     */
     @Test
-    @DisabledTest(message = "crbug.com/776251")
+    @LargeTest
+    @Feature({"Sync"})
     public void testStopAndClear() {
         mSyncTestRule.setUpTestAccountAndSignIn();
         CriteriaHelper.pollUiThread(
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 98598e04..43cc80c8 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -9251,15 +9251,22 @@
         </message>
       </if>
 
-      <message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE" desc="The title text that is used in the manage passwords bubble when the user has generated a password.">
-        Password saved
-      </message>
+      <if expr="use_titlecase">
+        <message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE" desc="In Title Case: The title text that is used in the manage passwords bubble when the user has generated a password.">
+            Password Saved
+        </message>
+      </if>
+      <if expr="not use_titlecase">
+        <message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TITLE" desc="The title text that is used in the manage passwords bubble when the user has generated a password.">
+          Password saved
+        </message>
+      </if>
       <message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT" desc="A message that the browser shows after saving a password it has autogenerated for the user. This message appears in a bubble and contains a link to all the user's saved autogenerated passwords. The link text is a separate string in the translation console and appears here as placeholder text.">
-        Access your passwords from any device at <ph name="SAVED_PASSWORDS_LINK">$1<ex>passwords.google.com</ex></ph>
+        View and manage saved passwords at <ph name="SAVED_PASSWORDS_LINK">$1<ex>passwords.google.com</ex></ph>
       </message>
       <if expr="is_android">
         <message name="IDS_MANAGE_PASSWORDS_CONFIRM_GENERATED_TEXT_INFOBAR" desc="A message that the browser shows after saving a password it has autogenerated for the user. This message appears in an infobar and contains a link to all the user's saved autogenerated passwords. The link text is a separate string in the translation console and appears here as placeholder text.">
-          Password saved. Access your passwords from any device at <ph name="SAVED_PASSWORDS_LINK">$1<ex>passwords.google.com</ex></ph>
+          Password saved. View and manage saved passwords at <ph name="SAVED_PASSWORDS_LINK">$1<ex>passwords.google.com</ex></ph>
         </message>
       </if>
       <message name="IDS_MANAGE_PASSWORDS_BUBBLE_LINK" desc="The label of the 'Manage passwords' link in the Manage Passwords bubble view">
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
index 86c1fa7..c6d45433 100644
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -618,7 +618,7 @@
     Export passwords
   </message>
   <message name="IDS_SETTINGS_PASSWORDS_EXPORT_DESCRIPTION" desc="Text shown to the user on the dialog for exporting passwords, before any passwords have been exported.">
-    Your passwords will be visible to anyone who can see the exported file. Do not share the file with anyone and delete it after importing it.
+    Your passwords will be visible to anyone who can see the exported file.
   </message>
   <message name="IDS_SETTINGS_PASSWORDS_EXPORT" desc="A button in the dialog for exporting passwords from Chrome. A password list will be written to a destination, which the user will be asked to choose after initiating this action.">
     Export passwords...
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 47d6c04..6ca9e0ef 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -1180,7 +1180,7 @@
      arraysize(kMarkHttpAsWarningAndDangerousOnPasswordsAndCreditCards),
      nullptr}};
 
-#if defined(OS_ANDROID)
+#if defined(OS_ANDROID) && BUILDFLAG(ENABLE_VR)
 const FeatureEntry::FeatureParam kWebXrRenderPathChoiceClientWait[] = {
     {features::kWebXrRenderPathParamName,
      features::kWebXrRenderPathParamValueClientWait}};
@@ -1195,7 +1195,7 @@
     {flag_descriptions::kWebXrRenderPathChoiceGpuFenceDescription,
      kWebXrRenderPathChoiceGpuFence, arraysize(kWebXrRenderPathChoiceGpuFence),
      nullptr}};
-#endif  // defined(OS_ANDROID)
+#endif  // defined(OS_ANDROID) && BUILDFLAG(ENABLE_VR)
 
 // RECORDING USER METRICS FOR FLAGS:
 // -----------------------------------------------------------------------------
@@ -1610,9 +1610,11 @@
      flag_descriptions::kPasswordGenerationDescription, kOsAll,
      ENABLE_DISABLE_VALUE_TYPE(autofill::switches::kEnablePasswordGeneration,
                                autofill::switches::kDisablePasswordGeneration)},
-    {"PasswordForceSaving", flag_descriptions::kPasswordForceSavingName,
+    {"PasswordForceSaving",
+     flag_descriptions::kPasswordForceSavingName,
      flag_descriptions::kPasswordForceSavingDescription, kOsAll,
-     FEATURE_VALUE_TYPE(password_manager::features::kPasswordForceSaving)},
+     FEATURE_VALUE_TYPE(
+         password_manager::features::kPasswordForceSaving)},
     {"enable-manual-password-generation",
      flag_descriptions::kManualPasswordGenerationName,
      flag_descriptions::kManualPasswordGenerationDescription, kOsAll,
@@ -2251,9 +2253,6 @@
     {"vr-browsing-in-custom-tab", flag_descriptions::kVrBrowsingInCustomTabName,
      flag_descriptions::kVrBrowsingInCustomTabDescription, kOsAndroid,
      FEATURE_VALUE_TYPE(chrome::android::kVrBrowsingInCustomTab)},
-    {"vr-icon-in-daydream-home", flag_descriptions::kVrIconInDaydreamHomeName,
-     flag_descriptions::kVrIconInDaydreamHomeDescription, kOsAndroid,
-     FEATURE_VALUE_TYPE(chrome::android::kVrIconInDaydreamHome)},
     {"vr-launch-intents", flag_descriptions::kVrLaunchIntentsName,
      flag_descriptions::kVrLaunchIntentsDescription, kOsAndroid,
      FEATURE_VALUE_TYPE(chrome::android::kVrLaunchIntents)},
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc
index 61558db4..3eb51f0 100644
--- a/chrome/browser/android/chrome_feature_list.cc
+++ b/chrome/browser/android/chrome_feature_list.cc
@@ -123,7 +123,6 @@
     &kVideoPersistence,
     &kVrBrowsingFeedback,
     &kVrBrowsingInCustomTab,
-    &kVrIconInDaydreamHome,
     &kVrLaunchIntents,
     &payments::features::kWebPaymentsMethodSectionOrderV2,
     &payments::features::kWebPaymentsModifiers,
@@ -378,9 +377,6 @@
 const base::Feature kVrBrowsingInCustomTab{"VrBrowsingInCustomTab",
                                            base::FEATURE_DISABLED_BY_DEFAULT};
 
-const base::Feature kVrIconInDaydreamHome{"VrIconInDaydreamHome",
-                                          base::FEATURE_DISABLED_BY_DEFAULT};
-
 const base::Feature kVrLaunchIntents{"VrLaunchIntents",
                                      base::FEATURE_DISABLED_BY_DEFAULT};
 
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h
index 8b841ac..9ce8cd2 100644
--- a/chrome/browser/android/chrome_feature_list.h
+++ b/chrome/browser/android/chrome_feature_list.h
@@ -84,7 +84,6 @@
 extern const base::Feature kVideoPersistence;
 extern const base::Feature kVrBrowsingFeedback;
 extern const base::Feature kVrBrowsingInCustomTab;
-extern const base::Feature kVrIconInDaydreamHome;
 extern const base::Feature kVrLaunchIntents;
 extern const base::Feature kWebPaymentsSingleAppUiSkip;
 extern const base::Feature kWebVrAutopresentFromIntent;
diff --git a/chrome/browser/android/compositor/scene_layer/contextual_search_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/contextual_search_scene_layer.cc
index 6d3029e..a29a5fd 100644
--- a/chrome/browser/android/compositor/scene_layer/contextual_search_scene_layer.cc
+++ b/chrome/browser/android/compositor/scene_layer/contextual_search_scene_layer.cc
@@ -14,10 +14,10 @@
 #include "content/public/browser/android/compositor.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "jni/ContextualSearchSceneLayer_jni.h"
 #include "net/base/load_flags.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "ui/android/resources/resource_manager_impl.h"
 #include "ui/android/view_android.h"
 #include "ui/gfx/android/java_bitmap.h"
@@ -193,7 +193,7 @@
 
   GURL gurl(thumbnail_url_);
   Profile* profile = ProfileAndroid::FromProfileAndroid(j_profile);
-  content::mojom::URLLoaderFactory* loader_factory =
+  network::mojom::URLLoaderFactory* loader_factory =
       content::BrowserContext::GetDefaultStoragePartition(profile)
           ->GetURLLoaderFactoryForBrowserProcess();
   fetcher_ =
diff --git a/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.cc b/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.cc
index 32908708..6864fda 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.cc
+++ b/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.cc
@@ -28,6 +28,8 @@
 
 const char kContextualSearchRankerDidPredict[] = "OutcomeRankerDidPredict";
 const char kContextualSearchRankerPrediction[] = "OutcomeRankerPrediction";
+const char kContextualSearchImportantFeature[] = "DidOptIn";
+const char kContextualSearchImportantOutcome[] = "OutcomeWasPanelOpened";
 
 }  // namespace
 
@@ -125,11 +127,23 @@
   if (predictor_ && ranker_example_ && source_id_ != ukm::kInvalidSourceId) {
     predictor_->LogExampleToUkm(*ranker_example_.get(), source_id_);
     source_id_ = ukm::kInvalidSourceId;
+    logImportantFeaturePresent(kContextualSearchImportantFeature, false);
+    logImportantFeaturePresent(kContextualSearchImportantOutcome, true);
   }
   has_predicted_decision_ = false;
   ranker_example_ = std::make_unique<assist_ranker::RankerExample>();
 }
 
+void ContextualSearchRankerLoggerImpl::logImportantFeaturePresent(
+    const std::string& feature,
+    bool is_outcome) const {
+  if (ranker_example_->features().count(feature) > 0) {
+    DCHECK(ranker_example_->features().count(feature) < 2);
+    base::UmaHistogramBoolean("Search.ContextualSearch.Ranker.RecordedNative",
+                              is_outcome);
+  }
+}
+
 bool ContextualSearchRankerLoggerImpl::IsQueryEnabled(JNIEnv* env,
                                                       jobject obj) {
   return IsQueryEnabledInternal();
diff --git a/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.h b/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.h
index a62bad96..83d69081 100644
--- a/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.h
+++ b/chrome/browser/android/contextualsearch/contextual_search_ranker_logger_impl.h
@@ -76,6 +76,10 @@
   // Sets up the Ranker Predictor for the given |web_contents|.
   void SetupRankerPredictor(const content::WebContents& web_contents);
 
+  // Logs to UMA when an important feature or outcome is present in the example.
+  void logImportantFeaturePresent(const std::string& feature,
+                                  bool is_outcome) const;
+
   // The source_id for UKMs for the current page.
   ukm::SourceId source_id_ = ukm::kInvalidSourceId;
 
diff --git a/chrome/browser/background/background_contents_service.cc b/chrome/browser/background/background_contents_service.cc
index 1240beb..b4be647 100644
--- a/chrome/browser/background/background_contents_service.cc
+++ b/chrome/browser/background/background_contents_service.cc
@@ -24,7 +24,8 @@
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/notifications/notification_ui_manager.h"
+#include "chrome/browser/notifications/notification_common.h"
+#include "chrome/browser/notifications/notification_display_service.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/ui/browser.h"
@@ -77,19 +78,12 @@
 const char kNotifierId[] = "app.background.crashed";
 bool g_disable_close_balloon_for_testing = false;
 
-void CloseBalloon(const std::string& balloon_id, ProfileID profile_id) {
-  g_browser_process->notification_ui_manager()->CancelById(balloon_id,
-                                                           profile_id);
-}
-
-// Closes the crash notification balloon for the app/extension with this id.
-void ScheduleCloseBalloon(const std::string& extension_id, Profile* profile) {
+void CloseBalloon(const std::string& extension_id, Profile* profile) {
   if (g_disable_close_balloon_for_testing)
     return;
-  base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE,
-      base::BindOnce(&CloseBalloon, kNotificationPrefix + extension_id,
-                     NotificationUIManager::GetProfileID(profile)));
+
+  NotificationDisplayService::GetForProfile(profile)->Close(
+      NotificationHandler::Type::TRANSIENT, kNotificationPrefix + extension_id);
 }
 
 // Delegate for the app/extension crash notification balloon. Restarts the
@@ -129,9 +123,7 @@
           ReloadExtension(copied_extension_id);
     }
 
-    // Closing the crash notification balloon for the app/extension here should
-    // be OK, but it causes a crash on Mac, see: http://crbug.com/78167
-    ScheduleCloseBalloon(copied_extension_id, profile_);
+    CloseBalloon(copied_extension_id, profile_);
   }
 
  private:
@@ -169,10 +161,11 @@
       notification_icon, base::string16(), GURL("chrome://extension-crash"),
       message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
                                  kNotifierId),
-      message_center::RichNotificationData(), delegate.get());
+      {}, delegate);
   notification.set_clickable(true);
 
-  g_browser_process->notification_ui_manager()->Add(notification, profile);
+  NotificationDisplayService::GetForProfile(profile)->Display(
+      NotificationHandler::Type::TRANSIENT, notification);
 }
 
 // Show a popup notification balloon with a crash message for a given app/
@@ -478,7 +471,7 @@
   }
 
   // Close the crash notification balloon for the app/extension, if any.
-  ScheduleCloseBalloon(extension->id(), profile);
+  CloseBalloon(extension->id(), profile);
   SendChangeNotification(profile);
 }
 
@@ -525,7 +518,7 @@
   // uninstalled/reloaded. We cannot do this from UNLOADED since a crashed
   // extension is unloaded immediately after the crash, not when user reloads or
   // uninstalls the extension.
-  ScheduleCloseBalloon(extension->id(), profile);
+  CloseBalloon(extension->id(), profile);
 }
 
 void BackgroundContentsService::RestartForceInstalledExtensionOnCrash(
@@ -788,7 +781,7 @@
   contents_map_[details->application_id].contents = details->contents;
   contents_map_[details->application_id].frame_name = details->frame_name;
 
-  ScheduleCloseBalloon(details->application_id, profile);
+  CloseBalloon(details->application_id, profile);
 }
 
 // Used by test code and debug checks to verify whether a given
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
index 0003c87e..c20a0f4 100644
--- a/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
+++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher.cc
@@ -35,7 +35,7 @@
                                                     traffic_annotation_);
 }
 
-void BitmapFetcher::Start(content::mojom::URLLoaderFactory* loader_factory) {
+void BitmapFetcher::Start(network::mojom::URLLoaderFactory* loader_factory) {
   if (simple_loader_) {
     content::SimpleURLLoader::BodyAsStringCallback callback = base::BindOnce(
         &BitmapFetcher::OnSimpleLoaderComplete, base::Unretained(this));
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher.h b/chrome/browser/bitmap_fetcher/bitmap_fetcher.h
index 9f052351..edc7495 100644
--- a/chrome/browser/bitmap_fetcher/bitmap_fetcher.h
+++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher.h
@@ -12,9 +12,9 @@
 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_delegate.h"
 #include "chrome/browser/image_decoder.h"
 #include "content/public/common/simple_url_loader.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "net/url_request/url_request.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "url/gurl.h"
 
 class SkBitmap;
@@ -44,7 +44,7 @@
   // asynchronously when done.  Start may be called more than once in some
   // cases.  If so, subsequent starts will be ignored since the operation is
   // already in progress.
-  void Start(content::mojom::URLLoaderFactory* loader_factory);
+  void Start(network::mojom::URLLoaderFactory* loader_factory);
 
   // Methods inherited from ImageDecoder::ImageRequest
 
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 188678dd..8d04261 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3843,7 +3843,7 @@
 bool ChromeContentBrowserClient::ShowPaymentHandlerWindow(
     content::BrowserContext* browser_context,
     const GURL& url,
-    base::OnceCallback<void(bool)> callback) {
+    base::OnceCallback<void(bool, int, int)> callback) {
 #if defined(OS_ANDROID)
   return false;
 #else
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 046f483..615751b 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -397,7 +397,7 @@
   bool ShowPaymentHandlerWindow(
       content::BrowserContext* browser_context,
       const GURL& url,
-      base::OnceCallback<void(bool)> callback) override;
+      base::OnceCallback<void(bool, int, int)> callback) override;
 
  protected:
   static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context);
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
index 7eca0f1..875188f5 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc
@@ -25,7 +25,6 @@
 #include "components/prefs/pref_service.h"
 #include "components/prefs/scoped_user_pref_update.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "extensions/browser/extension_system.h"
 #include "extensions/browser/image_loader.h"
 #include "extensions/browser/sandboxed_unpacker.h"
@@ -35,6 +34,7 @@
 #include "extensions/common/manifest_constants.h"
 #include "extensions/common/manifest_handlers/icons_handler.h"
 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "ui/gfx/codec/png_codec.h"
 #include "ui/gfx/image/image.h"
 
@@ -194,7 +194,7 @@
   void Start(const std::string& app_id,
              const std::string& manifest,
              const GURL& icon_url,
-             content::mojom::URLLoaderFactory* loader_factory) {
+             network::mojom::URLLoaderFactory* loader_factory) {
     scoped_refptr<extensions::WebstoreInstallHelper> webstore_helper =
         new extensions::WebstoreInstallHelper(this, app_id, manifest, icon_url);
     webstore_helper->Start(loader_factory);
@@ -367,7 +367,7 @@
   return g_browser_process->system_request_context();
 }
 
-content::mojom::URLLoaderFactory* KioskAppData::GetURLLoaderFactory() {
+network::mojom::URLLoaderFactory* KioskAppData::GetURLLoaderFactory() {
   return g_browser_process->system_network_context_manager()
       ->GetURLLoaderFactory();
 }
diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.h b/chrome/browser/chromeos/app_mode/kiosk_app_data.h
index 359152f..25b2ce84 100644
--- a/chrome/browser/chromeos/app_mode/kiosk_app_data.h
+++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.h
@@ -27,14 +27,14 @@
 class Image;
 }
 
-namespace content {
+namespace net {
+class URLRequestContextGetter;
+}
+
+namespace network {
 namespace mojom {
 class URLLoaderFactory;
 }
-}  // namespace content
-
-namespace net {
-class URLRequestContextGetter;
 }
 
 namespace chromeos {
@@ -106,7 +106,7 @@
   net::URLRequestContextGetter* GetRequestContextGetter();
 
   // Returns URLLoaderFactory to use for fetching web store data.
-  content::mojom::URLLoaderFactory* GetURLLoaderFactory();
+  network::mojom::URLLoaderFactory* GetURLLoaderFactory();
 
   // Loads the locally cached data. Return false if there is none.
   bool LoadFromCache();
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc
index d5ecc48..18cd4ad 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -925,6 +925,9 @@
   // ARC must be started only if no pending data removal request exists.
   DCHECK(!profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
 
+  for (auto& observer : observer_list_)
+    observer.OnArcStarted();
+
   arc_start_time_ = base::Time::Now();
   provisioning_reported_ = false;
   arc_session_runner_->RequestStart(ArcInstanceMode::FULL_INSTANCE);
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h
index e6c3e2e..dfb8d66 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.h
+++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -108,6 +108,9 @@
     // during the opt-in flow.
     virtual void OnArcOptInManagementCheckStarted() {}
 
+    // Called to notify that ARC begins to start.
+    virtual void OnArcStarted() {}
+
     // Called to notify that ARC has been initialized successfully.
     virtual void OnArcInitialStart() {}
 
diff --git a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc
index 96a44436..dfa97ef2 100644
--- a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc
+++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.cc
@@ -12,6 +12,7 @@
 #include "chrome/browser/notifications/notification_display_service.h"
 #include "chrome/browser/notifications/notification_display_service_factory.h"
 #include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profiles_state.h"
 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
 #include "chrome/grit/generated_resources.h"
 #include "chrome/grit/theme_resources.h"
@@ -112,6 +113,12 @@
     HideNotification();
 }
 
+void ArcProvisionNotificationService::OnArcStarted() {
+  // Show notification only for Public Session when ARC is going to start.
+  if (profiles::IsPublicSession())
+    ShowNotification();
+}
+
 void ArcProvisionNotificationService::OnArcOptInManagementCheckStarted() {
   // This observer is notified at an early phase of the opt-in flow, so start
   // showing the notification if the opt-in flow happens silently (due to the
diff --git a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h
index 54acf6c..6a50843 100644
--- a/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h
+++ b/chrome/browser/chromeos/arc/notification/arc_provision_notification_service.h
@@ -38,6 +38,7 @@
 
   // ArcSessionManager::Observer:
   void OnArcPlayStoreEnabledChanged(bool enabled) override;
+  void OnArcStarted() override;
   void OnArcOptInManagementCheckStarted() override;
   void OnArcInitialStart() override;
   void OnArcSessionStopped(ArcStopReason stop_reason) override;
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc
index bf309f9..d3412e2 100644
--- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc
+++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge.cc
@@ -32,6 +32,7 @@
 #include "components/policy/core/common/policy_namespace.h"
 #include "components/policy/policy_constants.h"
 #include "components/prefs/pref_service.h"
+#include "components/user_manager/user.h"
 #include "content/public/common/service_manager_connection.h"
 #include "crypto/sha2.h"
 #include "services/data_decoder/public/cpp/safe_json_parser.h"
@@ -195,7 +196,8 @@
   filtered_policies->Set(kArcCaCerts, std::move(ca_certs));
 }
 
-std::string GetFilteredJSONPolicies(const policy::PolicyMap& policy_map) {
+std::string GetFilteredJSONPolicies(const policy::PolicyMap& policy_map,
+                                    bool is_affiliated) {
   base::DictionaryValue filtered_policies;
   // Parse ArcPolicy as JSON string before adding other policies to the
   // dictionary.
@@ -238,6 +240,9 @@
   // Add CA certificates.
   AddOncCaCertsToPolicies(policy_map, &filtered_policies);
 
+  if (!is_affiliated)
+    filtered_policies.RemoveKey("apkCacheEnabled");
+
   std::string policy_json;
   JSONStringValueSerializer serializer(&policy_json);
   serializer.Serialize(filtered_policies);
@@ -408,7 +413,12 @@
                                                  std::string());
   const policy::PolicyMap& policy_map =
       policy_service_->GetPolicies(policy_namespace);
-  return GetFilteredJSONPolicies(policy_map);
+
+  const Profile* const profile = Profile::FromBrowserContext(context_);
+  const user_manager::User* const user =
+      chromeos::ProfileHelper::Get()->GetUserByProfile(profile);
+
+  return GetFilteredJSONPolicies(policy_map, user->IsAffiliated());
 }
 
 void ArcPolicyBridge::OnReportComplianceParseSuccess(
diff --git a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc
index 37b2912..5c1dfa2 100644
--- a/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc
+++ b/chrome/browser/chromeos/arc/policy/arc_policy_bridge_unittest.cc
@@ -114,11 +114,11 @@
 
 namespace arc {
 
-class ArcPolicyBridgeTest : public testing::Test {
+class ArcPolicyBridgeTestBase {
  public:
-  ArcPolicyBridgeTest() {}
+  ArcPolicyBridgeTestBase() = default;
 
-  void SetUp() override {
+  void DoSetUp(bool is_affiliated) {
     bridge_service_ = std::make_unique<ArcBridgeService>();
     EXPECT_CALL(policy_service_,
                 GetPolicies(policy::PolicyNamespace(
@@ -134,7 +134,7 @@
         base::WrapUnique(fake_user_manager));
     const AccountId account_id(
         AccountId::FromUserEmailGaiaId("user@gmail.com", "1111111111"));
-    fake_user_manager->AddUser(account_id);
+    fake_user_manager->AddUserWithAffiliation(account_id, is_affiliated);
     fake_user_manager->LoginUser(account_id);
     testing_profile_manager_ = std::make_unique<TestingProfileManager>(
         TestingBrowserProcess::GetGlobal());
@@ -152,7 +152,7 @@
     WaitForInstanceReady(bridge_service_->policy());
   }
 
-  void TearDown() override {
+  void DoTearDown() {
     bridge_service_->policy()->CloseInstance(policy_instance_.get());
     policy_instance_.reset();
   }
@@ -182,7 +182,27 @@
   policy::PolicyMap policy_map_;
   policy::MockPolicyService policy_service_;
 
-  DISALLOW_COPY_AND_ASSIGN(ArcPolicyBridgeTest);
+  DISALLOW_COPY_AND_ASSIGN(ArcPolicyBridgeTestBase);
+};
+
+class ArcPolicyBridgeTest : public ArcPolicyBridgeTestBase,
+                            public testing::Test {
+ public:
+  void SetUp() override { DoSetUp(true /* affiliated */); }
+
+  void TearDown() override { DoTearDown(); }
+};
+
+class ArcPolicyBridgeAffiliatedTest : public ArcPolicyBridgeTestBase,
+                                      public testing::TestWithParam<bool> {
+ public:
+  ArcPolicyBridgeAffiliatedTest() : is_affiliated_(GetParam()) {}
+  void SetUp() override { DoSetUp(is_affiliated_); }
+
+  void TearDown() override { DoTearDown(); }
+
+ protected:
+  const bool is_affiliated_;
 };
 
 TEST_F(ArcPolicyBridgeTest, UnmanagedTest) {
@@ -437,4 +457,23 @@
   policy_instance()->CallGetPolicies(PolicyStringCallback("{}"));
 }
 
+TEST_P(ArcPolicyBridgeAffiliatedTest, ApkCacheEnabledTest) {
+  const std::string apk_cache_enabled_policy("{\"apkCacheEnabled\":true}");
+  policy_map().Set(policy::key::kArcPolicy, policy::POLICY_LEVEL_MANDATORY,
+                   policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
+                   std::make_unique<base::Value>(apk_cache_enabled_policy),
+                   nullptr);
+  if (is_affiliated_) {
+    policy_bridge()->GetPolicies(
+        PolicyStringCallback(apk_cache_enabled_policy));
+  } else {
+    policy_bridge()->GetPolicies(PolicyStringCallback("{}"));
+  }
+}
+
+// Boolean parameter means if user is affiliated on the device. Affiliated
+// users belong to the domain that owns the device.
+INSTANTIATE_TEST_CASE_P(ArcPolicyBridgeAffiliatedTestInstance,
+                        ArcPolicyBridgeAffiliatedTest,
+                        testing::Bool());
 }  // namespace arc
diff --git a/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.cc b/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.cc
index 401519e9..f4769c2 100644
--- a/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.cc
+++ b/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.cc
@@ -16,9 +16,13 @@
 
 void ChromeComponentUpdaterServiceProviderDelegate::LoadComponent(
     const std::string& name,
-    base::OnceCallback<void(const base::FilePath&)> load_callback) {
+    bool mount,
+    LoadCallback load_callback) {
   g_browser_process->platform_part()->cros_component_manager()->Load(
-      name, std::move(load_callback));
+      name,
+      mount ? component_updater::CrOSComponentManager::MountPolicy::kMount
+            : component_updater::CrOSComponentManager::MountPolicy::kDontMount,
+      std::move(load_callback));
 }
 
 bool ChromeComponentUpdaterServiceProviderDelegate::UnloadComponent(
diff --git a/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.h b/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.h
index 0f80f62..ec84b30 100644
--- a/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.h
+++ b/chrome/browser/chromeos/dbus/chrome_component_updater_service_provider_delegate.h
@@ -18,9 +18,9 @@
   ~ChromeComponentUpdaterServiceProviderDelegate() override;
 
   // ComponentUpdaterServiceProvider::Delegate:
-  void LoadComponent(
-      const std::string& name,
-      base::OnceCallback<void(const base::FilePath&)> load_callback) override;
+  void LoadComponent(const std::string& name,
+                     bool mount,
+                     LoadCallback load_callback) override;
   bool UnloadComponent(const std::string& name) override;
 
  private:
diff --git a/chrome/browser/chromeos/file_manager/gallery_browsertest.cc b/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
index 37b98cf..0c7ee32 100644
--- a/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
+++ b/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
@@ -56,7 +56,15 @@
   StartTest();
 }
 
-IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, OpenMultipleImagesOnDownloads) {
+// http://crbug.com/803505 : Flaky due to crash on linux-chromeos-dbg
+#if !defined(NDEBUG)
+#define MAYBE_OpenMultipleImagesOnDownloads \
+  DISABLED_OpenMultipleImagesOnDownloads
+#else
+#define MAYBE_OpenMultipleImagesOnDownloads OpenMultipleImagesOnDownloads
+#endif
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTest,
+                       MAYBE_OpenMultipleImagesOnDownloads) {
   set_test_case_name("openMultipleImagesOnDownloads");
   StartTest();
 }
diff --git a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
index dbe3b57c..e6262588 100644
--- a/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
+++ b/chrome/browser/chromeos/first_run/drive_first_run_controller.cc
@@ -21,6 +21,7 @@
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
 #include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/notifications/notification_display_service.h"
 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
 #include "chrome/browser/ui/singleton_tabs.h"
 #include "chrome/grit/generated_resources.h"
@@ -44,7 +45,6 @@
 #include "extensions/common/extension_set.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/resource/resource_bundle.h"
-#include "ui/message_center/message_center.h"
 #include "ui/message_center/notification.h"
 #include "ui/message_center/notification_delegate.h"
 #include "url/gurl.h"
@@ -460,19 +460,18 @@
   data.buttons.push_back(message_center::ButtonInfo(
       l10n_util::GetStringUTF16(IDS_DRIVE_OFFLINE_NOTIFICATION_BUTTON)));
   ui::ResourceBundle& resource_bundle = ui::ResourceBundle::GetSharedInstance();
-  std::unique_ptr<message_center::Notification> notification(
-      new message_center::Notification(
-          message_center::NOTIFICATION_TYPE_SIMPLE, kDriveOfflineNotificationId,
-          base::string16(),  // title
-          l10n_util::GetStringUTF16(IDS_DRIVE_OFFLINE_NOTIFICATION_MESSAGE),
-          resource_bundle.GetImageNamed(IDR_NOTIFICATION_DRIVE),
-          base::UTF8ToUTF16(extension->name()), GURL(),
-          message_center::NotifierId(message_center::NotifierId::APPLICATION,
-                                     kDriveHostedAppId),
-          data, new DriveOfflineNotificationDelegate(profile_)));
-  notification->set_priority(message_center::LOW_PRIORITY);
-  message_center::MessageCenter::Get()->AddNotification(
-      std::move(notification));
+  message_center::Notification notification(
+      message_center::NOTIFICATION_TYPE_SIMPLE, kDriveOfflineNotificationId,
+      base::string16(),  // title
+      l10n_util::GetStringUTF16(IDS_DRIVE_OFFLINE_NOTIFICATION_MESSAGE),
+      resource_bundle.GetImageNamed(IDR_NOTIFICATION_DRIVE),
+      base::UTF8ToUTF16(extension->name()), GURL(),
+      message_center::NotifierId(message_center::NotifierId::APPLICATION,
+                                 kDriveHostedAppId),
+      data, new DriveOfflineNotificationDelegate(profile_));
+  notification.set_priority(message_center::LOW_PRIORITY);
+  NotificationDisplayService::GetForProfile(profile_)->Display(
+      NotificationHandler::Type::TRANSIENT, notification);
 }
 
 }  // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc b/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc
index 3651506..4685afb 100644
--- a/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc
+++ b/chrome/browser/chromeos/login/screens/terms_of_service_screen.cc
@@ -21,9 +21,9 @@
 #include "components/prefs/pref_service.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/simple_url_loader.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/http/http_response_headers.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "url/gurl.h"
 
 namespace chromeos {
@@ -124,7 +124,7 @@
   // download.
   terms_of_service_loader_->SetRetryOptions(
       3, content::SimpleURLLoader::RETRY_ON_NETWORK_CHANGE);
-  content::mojom::URLLoaderFactory* loader_factory =
+  network::mojom::URLLoaderFactory* loader_factory =
       g_browser_process->system_network_context_manager()
           ->GetURLLoaderFactory();
   terms_of_service_loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie(
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc
index d3e2cf87..0a226d4 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -128,7 +128,6 @@
 #include "ui/base/ime/chromeos/input_method_descriptor.h"
 #include "ui/base/ime/chromeos/input_method_manager.h"
 #include "ui/base/ime/chromeos/input_method_util.h"
-#include "ui/message_center/message_center.h"
 #include "url/gurl.h"
 
 #if BUILDFLAG(ENABLE_RLZ)
diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
index 9825bf37..809baa40 100644
--- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
+++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc
@@ -123,8 +123,9 @@
           ActiveDirectoryPolicyManager::CreateForDevicePolicy(
               std::move(device_cloud_policy_store))
               .release();
-      AddPolicyProvider(base::WrapUnique<ConfigurationPolicyProvider>(
-          device_active_directory_policy_manager_));
+      providers_for_init_.push_back(
+          base::WrapUnique<ConfigurationPolicyProvider>(
+              device_active_directory_policy_manager_));
     } else {
       state_keys_broker_ = std::make_unique<ServerBackedStateKeysBroker>(
           chromeos::DBusThreadManager::Get()->GetSessionManagerClient());
@@ -132,13 +133,14 @@
       device_cloud_policy_manager_ = new DeviceCloudPolicyManagerChromeOS(
           std::move(device_cloud_policy_store),
           base::ThreadTaskRunnerHandle::Get(), state_keys_broker_.get());
-      AddPolicyProvider(base::WrapUnique<ConfigurationPolicyProvider>(
-          device_cloud_policy_manager_));
+      providers_for_init_.push_back(
+          base::WrapUnique<ConfigurationPolicyProvider>(
+              device_cloud_policy_manager_));
     }
   }
 
   global_user_cloud_policy_provider_ = new ProxyPolicyProvider();
-  AddPolicyProvider(std::unique_ptr<ConfigurationPolicyProvider>(
+  providers_for_init_.push_back(std::unique_ptr<ConfigurationPolicyProvider>(
       global_user_cloud_policy_provider_));
 }
 
@@ -353,6 +355,13 @@
   RestartDeviceCloudPolicyInitializer();
 }
 
+void BrowserPolicyConnectorChromeOS::BuildPolicyProviders(
+    std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers) {
+  for (auto& provider_ptr : providers_for_init_)
+    providers->push_back(std::move(provider_ptr));
+  providers_for_init_.clear();
+}
+
 void BrowserPolicyConnectorChromeOS::SetTimezoneIfPolicyAvailable() {
   typedef chromeos::CrosSettingsProvider Provider;
   Provider::TrustedStatus result =
diff --git a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h
index a67ad3d..d79f700 100644
--- a/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h
+++ b/chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h
@@ -58,6 +58,7 @@
 
   ~BrowserPolicyConnectorChromeOS() override;
 
+  // ChromeBrowserPolicyConnector:
   void Init(
       PrefService* local_state,
       scoped_refptr<net::URLRequestContextGetter> request_context) override;
@@ -177,6 +178,12 @@
 
   chromeos::AffiliationIDSet GetDeviceAffiliationIDs() const;
 
+ protected:
+  // ChromeBrowserPolicyConnector:
+  void BuildPolicyProviders(
+      std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers)
+      override;
+
  private:
   // Set the timezone as soon as the policies are available.
   void SetTimezoneIfPolicyAvailable();
@@ -223,6 +230,10 @@
   std::unique_ptr<DeviceNetworkConfigurationUpdater>
       device_network_configuration_updater_;
 
+  // The ConfigurationPolicyProviders created in the constructor are initially
+  // added here, and then pushed to the super class in BuildPolicyProviders().
+  std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers_for_init_;
+
   base::WeakPtrFactory<BrowserPolicyConnectorChromeOS> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorChromeOS);
diff --git a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc
index 48a9c92..70da940 100644
--- a/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc
+++ b/chrome/browser/chromeos/policy/cloud_external_data_policy_observer_unittest.cc
@@ -333,8 +333,10 @@
   PolicyServiceImpl::Providers providers;
   providers.push_back(device_local_account_policy_provider_.get());
   TestingProfile::Builder builder;
-  builder.SetPolicyService(
-      std::unique_ptr<PolicyService>(new PolicyServiceImpl(providers)));
+  std::unique_ptr<PolicyServiceImpl> policy_service =
+      std::make_unique<PolicyServiceImpl>();
+  policy_service->SetProviders(providers);
+  builder.SetPolicyService(std::move(policy_service));
   builder.SetPath(chromeos::ProfileHelper::Get()->GetProfilePathByUserIdHash(
       chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting(
           account_id.GetUserEmail())));
@@ -367,8 +369,10 @@
   PolicyServiceImpl::Providers providers;
   providers.push_back(&user_policy_provider_);
   TestingProfile::Builder builder;
-  builder.SetPolicyService(
-      std::unique_ptr<PolicyService>(new PolicyServiceImpl(providers)));
+  std::unique_ptr<PolicyServiceImpl> policy_service =
+      std::make_unique<PolicyServiceImpl>();
+  policy_service->SetProviders(providers);
+  builder.SetPolicyService(std::move(policy_service));
   builder.SetPath(chromeos::ProfileHelper::Get()->GetProfilePathByUserIdHash(
       chromeos::ProfileHelper::GetUserIdHashByUserIdForTesting(
           kRegularUserID)));
diff --git a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
index 0b6a8b1..6dfce50 100644
--- a/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
+++ b/chrome/browser/chromeos/policy/network_configuration_updater_unittest.cc
@@ -220,7 +220,8 @@
     provider_.Init();
     PolicyServiceImpl::Providers providers;
     providers.push_back(&provider_);
-    policy_service_.reset(new PolicyServiceImpl(providers));
+    policy_service_ = std::make_unique<PolicyServiceImpl>();
+    policy_service_->SetProviders(providers);
 
     std::unique_ptr<base::DictionaryValue> fake_toplevel_onc =
         chromeos::onc::ReadDictionaryFromJson(kFakeONC);
diff --git a/chrome/browser/chromeos/printing/printer_configurer.cc b/chrome/browser/chromeos/printing/printer_configurer.cc
index 9fda8eb1..04f6065 100644
--- a/chrome/browser/chromeos/printing/printer_configurer.cc
+++ b/chrome/browser/chromeos/printing/printer_configurer.cc
@@ -215,6 +215,7 @@
         auto& component_name = *components_requested.begin();
         g_browser_process->platform_part()->cros_component_manager()->Load(
             component_name,
+            component_updater::CrOSComponentManager::MountPolicy::kMount,
             base::BindOnce(&PrinterConfigurerImpl::OnComponentLoad,
                            weak_factory_.GetWeakPtr(), printer, ppd_contents,
                            std::move(cb)));
diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc
index d7701dd..1c245c8 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider.cc
@@ -385,8 +385,10 @@
          i != allowed_connection_types.end(); ++i) {
       list->AppendInteger(*i);
     }
-    new_values_cache->SetValue(kAllowedConnectionTypesForUpdate,
-                               std::move(list));
+    if (!list->empty()) {
+      new_values_cache->SetValue(kAllowedConnectionTypesForUpdate,
+                                 std::move(list));
+    }
   }
 }
 
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
index cab5254e..e1a71e7 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -44,6 +44,14 @@
 
 const char kDisabledMessage[] = "This device has been disabled.";
 
+constexpr em::AutoUpdateSettingsProto_ConnectionType kConnectionTypes[] = {
+    em::AutoUpdateSettingsProto::CONNECTION_TYPE_ETHERNET,
+    em::AutoUpdateSettingsProto::CONNECTION_TYPE_WIFI,
+    em::AutoUpdateSettingsProto::CONNECTION_TYPE_WIMAX,
+    em::AutoUpdateSettingsProto::CONNECTION_TYPE_BLUETOOTH,
+    em::AutoUpdateSettingsProto::CONNECTION_TYPE_CELLULAR,
+};
+
 }  // namespace
 
 class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
@@ -211,6 +219,22 @@
                       ptr_to_expected_value);
   }
 
+  // Helper routine to set AutoUpdates connection types policy.
+  void SetAutoUpdateConnectionTypes(const std::vector<int>& values) {
+    EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1));
+
+    em::AutoUpdateSettingsProto* proto =
+        device_policy_.payload().mutable_auto_update_settings();
+    proto->set_update_disabled(false);
+    for (auto const& value : values) {
+      proto->add_allowed_connection_types(kConnectionTypes[value]);
+    }
+    device_policy_.Build();
+    session_manager_client_.set_device_policy(device_policy_.GetBlob());
+    ReloadDeviceSettings();
+    Mock::VerifyAndClearExpectations(this);
+  }
+
   // Helper routine to set HostnameTemplate policy.
   void SetHostnameTemplate(const std::string& hostname_template) {
     EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1));
@@ -541,6 +565,23 @@
   VerifyDomainAutoComplete(&domain_value);
 }
 
+TEST_F(DeviceSettingsProviderTest, EmptyAllowedConnectionTypesForUpdate) {
+  // By default AllowedConnectionTypesForUpdate policy should not be set.
+  VerifyPolicyValue(kAllowedConnectionTypesForUpdate, nullptr);
+
+  // In case of empty list policy should not be set.
+  const std::vector<int> no_values = {};
+  SetAutoUpdateConnectionTypes(no_values);
+  VerifyPolicyValue(kAllowedConnectionTypesForUpdate, nullptr);
+
+  const std::vector<int> single_value = {0};
+  // Check some meaningful value. Policy should be set.
+  SetAutoUpdateConnectionTypes(single_value);
+  base::ListValue allowed_connections;
+  allowed_connections.AppendInteger(0);
+  VerifyPolicyValue(kAllowedConnectionTypesForUpdate, &allowed_connections);
+}
+
 TEST_F(DeviceSettingsProviderTest, DecodeHostnameTemplate) {
   // By default DeviceHostnameTemplate policy should not be set.
   VerifyPolicyValue(kDeviceHostnameTemplate, nullptr);
diff --git a/chrome/browser/chromeos/tether/tether_service.cc b/chrome/browser/chromeos/tether/tether_service.cc
index b8d6171..f6fffcf 100644
--- a/chrome/browser/chromeos/tether/tether_service.cc
+++ b/chrome/browser/chromeos/tether/tether_service.cc
@@ -31,7 +31,6 @@
 #include "components/prefs/pref_service.h"
 #include "components/proximity_auth/logging/logging.h"
 #include "device/bluetooth/bluetooth_adapter_factory.h"
-#include "ui/message_center/message_center.h"
 
 namespace {
 
diff --git a/chrome/browser/chromeos/ui/low_disk_notification.cc b/chrome/browser/chromeos/ui/low_disk_notification.cc
index c0c88cce..2b4f1b0d 100644
--- a/chrome/browser/chromeos/ui/low_disk_notification.cc
+++ b/chrome/browser/chromeos/ui/low_disk_notification.cc
@@ -22,7 +22,6 @@
 #include "content/public/browser/browser_thread.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/chromeos/resources/grit/ui_chromeos_resources.h"
-#include "ui/message_center/message_center.h"
 #include "ui/message_center/notification.h"
 #include "ui/message_center/notification_types.h"
 #include "ui/message_center/notifier_id.h"
diff --git a/chrome/browser/component_updater/cros_component_installer.cc b/chrome/browser/component_updater/cros_component_installer.cc
index e661bc7..9daf137 100644
--- a/chrome/browser/component_updater/cros_component_installer.cc
+++ b/chrome/browser/component_updater/cros_component_installer.cc
@@ -179,16 +179,20 @@
 
 CrOSComponentManager::~CrOSComponentManager() {}
 
-void CrOSComponentManager::Load(
-    const std::string& name,
-    base::OnceCallback<void(const base::FilePath&)> load_callback) {
+void CrOSComponentManager::Load(const std::string& name,
+                                MountPolicy mount_policy,
+                                LoadCallback load_callback) {
   if (!IsCompatible(name)) {
     // A compatible component is not installed, start installation process.
     auto* const cus = g_browser_process->component_updater();
-    Install(cus, name, std::move(load_callback));
-  } else {
-    // A compatible component is intalled, load it directly.
+    Install(cus, name, mount_policy, std::move(load_callback));
+  } else if (mount_policy == MountPolicy::kMount) {
+    // A compatible component is installed, load it.
     LoadInternal(name, std::move(load_callback));
+  } else {
+    // A compatible component is installed, do not load it.
+    base::PostTask(FROM_HERE,
+                   base::BindOnce(std::move(load_callback), base::FilePath()));
   }
 }
 
@@ -241,10 +245,10 @@
   installer->Register(cus, std::move(register_callback));
 }
 
-void CrOSComponentManager::Install(
-    ComponentUpdateService* cus,
-    const std::string& name,
-    base::OnceCallback<void(const base::FilePath&)> load_callback) {
+void CrOSComponentManager::Install(ComponentUpdateService* cus,
+                                   const std::string& name,
+                                   MountPolicy mount_policy,
+                                   LoadCallback load_callback) {
   const ConfigMap components = CONFIG_MAP_CONTENT;
   const auto it = components.find(name);
   if (it == components.end()) {
@@ -255,12 +259,12 @@
   ComponentConfig config(it->first, it->second.find("env_version")->second,
                          it->second.find("sha2hashstr")->second);
   Register(cus, config,
-           base::BindOnce(&CrOSComponentManager::StartInstall,
-                          base::Unretained(this), cus,
-                          GenerateId(it->second.find("sha2hashstr")->second),
-                          base::BindOnce(&CrOSComponentManager::FinishInstall,
-                                         base::Unretained(this), name,
-                                         std::move(load_callback))));
+           base::BindOnce(
+               &CrOSComponentManager::StartInstall, base::Unretained(this), cus,
+               GenerateId(it->second.find("sha2hashstr")->second),
+               base::BindOnce(&CrOSComponentManager::FinishInstall,
+                              base::Unretained(this), name, mount_policy,
+                              std::move(load_callback))));
 }
 
 void CrOSComponentManager::StartInstall(
@@ -270,16 +274,20 @@
   cus->GetOnDemandUpdater().OnDemandUpdate(id, std::move(install_callback));
 }
 
-void CrOSComponentManager::FinishInstall(
-    const std::string& name,
-    base::OnceCallback<void(const base::FilePath&)> load_callback,
-    update_client::Error error) {
-  LoadInternal(name, std::move(load_callback));
+void CrOSComponentManager::FinishInstall(const std::string& name,
+                                         MountPolicy mount_policy,
+                                         LoadCallback load_callback,
+                                         update_client::Error error) {
+  if (mount_policy == MountPolicy::kMount) {
+    LoadInternal(name, std::move(load_callback));
+  } else {
+    base::PostTask(FROM_HERE,
+                   base::BindOnce(std::move(load_callback), base::FilePath()));
+  }
 }
 
-void CrOSComponentManager::LoadInternal(
-    const std::string& name,
-    base::OnceCallback<void(const base::FilePath&)> load_callback) {
+void CrOSComponentManager::LoadInternal(const std::string& name,
+                                        LoadCallback load_callback) {
   DCHECK(IsCompatible(name));
   const base::FilePath path = GetCompatiblePath(name);
   // path is empty if no compatible component is available to load.
@@ -296,9 +304,8 @@
   }
 }
 
-void CrOSComponentManager::FinishLoad(
-    base::OnceCallback<void(const base::FilePath&)> load_callback,
-    base::Optional<base::FilePath> result) {
+void CrOSComponentManager::FinishLoad(LoadCallback load_callback,
+                                      base::Optional<base::FilePath> result) {
   PostTask(FROM_HERE, base::BindOnce(std::move(load_callback),
                                      result.value_or(base::FilePath())));
 }
diff --git a/chrome/browser/component_updater/cros_component_installer.h b/chrome/browser/component_updater/cros_component_installer.h
index d76c7f4..c05c8274 100644
--- a/chrome/browser/component_updater/cros_component_installer.h
+++ b/chrome/browser/component_updater/cros_component_installer.h
@@ -69,12 +69,19 @@
 // This class contains functions used to register and install a component.
 class CrOSComponentManager {
  public:
+  using LoadCallback = base::OnceCallback<void(const base::FilePath&)>;
+  enum class MountPolicy {
+    kMount,
+    kDontMount,
+  };
+
   CrOSComponentManager();
   ~CrOSComponentManager();
   // Installs a component and keeps it up-to-date. |load_callback| returns the
   // mount point path.
   void Load(const std::string& name,
-            base::OnceCallback<void(const base::FilePath&)> load_callback);
+            MountPolicy mount_policy,
+            LoadCallback load_callback);
 
   // Stops updating and removes a component.
   // Returns true if the component was successfully unloaded
@@ -110,7 +117,8 @@
   // Installs a component with a dedicated ComponentUpdateService instance.
   void Install(ComponentUpdateService* cus,
                const std::string& name,
-               base::OnceCallback<void(const base::FilePath&)> load_callback);
+               MountPolicy mount_policy,
+               LoadCallback load_callback);
 
   // Calls OnDemandUpdate to install the component right after being registered.
   // |id| is the component id generated from its sha2 hash.
@@ -119,19 +127,17 @@
                     update_client::Callback install_callback);
 
   // Calls LoadInternal to load the installed component.
-  void FinishInstall(
-      const std::string& name,
-      base::OnceCallback<void(const base::FilePath&)> load_callback,
-      update_client::Error error);
+  void FinishInstall(const std::string& name,
+                     MountPolicy mount_policy,
+                     LoadCallback load_callback,
+                     update_client::Error error);
 
   // Internal function to load a component.
-  void LoadInternal(
-      const std::string& name,
-      base::OnceCallback<void(const base::FilePath&)> load_callback);
+  void LoadInternal(const std::string& name, LoadCallback load_callback);
 
   // Calls load_callback and pass in the parameter |result| (component mount
   // point).
-  void FinishLoad(base::OnceCallback<void(const base::FilePath&)> load_callback,
+  void FinishLoad(LoadCallback load_callback,
                   base::Optional<base::FilePath> result);
 
   // Returns all installed components.
diff --git a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
index 6a13f81..c7d8abd 100644
--- a/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
+++ b/chrome/browser/extensions/api/dashboard_private/dashboard_private_api.cc
@@ -74,7 +74,7 @@
     }
   }
 
-  content::mojom::URLLoaderFactory* loader_factory = nullptr;
+  network::mojom::URLLoaderFactory* loader_factory = nullptr;
   if (!icon_url.is_empty()) {
     loader_factory =
         content::BrowserContext::GetDefaultStoragePartition(browser_context())
diff --git a/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc b/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc
index 29fdfad..46218419 100644
--- a/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc
+++ b/chrome/browser/extensions/api/media_perception_private/media_perception_api_delegate_chromeos.cc
@@ -41,7 +41,9 @@
     const media_perception::ComponentType& type,
     LoadCrOSComponentCallback load_callback) {
   g_browser_process->platform_part()->cros_component_manager()->Load(
-      GetComponentNameForComponentType(type), std::move(load_callback));
+      GetComponentNameForComponentType(type),
+      component_updater::CrOSComponentManager::MountPolicy::kMount,
+      std::move(load_callback));
 }
 
 }  // namespace extensions
diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
index 254f5091..1b82d54 100644
--- a/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+++ b/chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
@@ -217,7 +217,7 @@
   ActiveInstallData install_data(details().id);
   scoped_active_install_.reset(new ScopedActiveInstall(tracker, install_data));
 
-  content::mojom::URLLoaderFactory* loader_factory = nullptr;
+  network::mojom::URLLoaderFactory* loader_factory = nullptr;
   if (!icon_url.is_empty()) {
     loader_factory =
         content::BrowserContext::GetDefaultStoragePartition(browser_context())
diff --git a/chrome/browser/extensions/chrome_url_request_util.h b/chrome/browser/extensions/chrome_url_request_util.h
index 1077ef24..ce03bee 100644
--- a/chrome/browser/extensions/chrome_url_request_util.h
+++ b/chrome/browser/extensions/chrome_url_request_util.h
@@ -8,7 +8,6 @@
 #include <string>
 
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "ui/base/page_transition_types.h"
 
 class GURL;
diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc
index f927121..57ec77e6 100644
--- a/chrome/browser/extensions/extension_service_unittest.cc
+++ b/chrome/browser/extensions/extension_service_unittest.cc
@@ -4423,6 +4423,60 @@
             prefs->GetDisableReasons(good_crx));
 }
 
+// Test that if an external extension warning is ignored three times, the
+// extension no longer prompts
+TEST_F(ExtensionServiceTest, ExternalExtensionRemainsDisabledIfIgnored) {
+  FeatureSwitch::ScopedOverride prompt_override(
+      FeatureSwitch::prompt_for_external_extensions(), true);
+  InitializeEmptyExtensionService();
+
+  // Register and install an external extension.
+  MockExternalProvider* provider =
+      AddMockExternalProvider(Manifest::EXTERNAL_PREF);
+  provider->UpdateOrAddExtension(good_crx, "1.0.0.0",
+                                 data_dir().AppendASCII("good.crx"));
+
+  WaitForExternalExtensionInstalled();
+
+  EXPECT_TRUE(registry()->disabled_extensions().Contains(good_crx));
+  ExtensionPrefs* prefs = ExtensionPrefs::Get(profile());
+  EXPECT_FALSE(prefs->IsExternalExtensionAcknowledged(good_crx));
+  EXPECT_EQ(extensions::disable_reason::DISABLE_EXTERNAL_EXTENSION,
+            prefs->GetDisableReasons(good_crx));
+
+  extensions::ExternalInstallManager* external_install_manager =
+      service()->external_install_manager();
+
+  for (int i = 0; i < 3; ++i) {
+    std::vector<ExternalInstallError*> errors =
+        external_install_manager->GetErrorsForTesting();
+    ASSERT_EQ(1u, errors.size());
+    errors[0]->OnInstallPromptDone(ExtensionInstallPrompt::Result::ABORTED);
+    base::RunLoop().RunUntilIdle();
+    // Note: Calling OnInstallPromptDone() can result in the removal of the
+    // error by the manager (which owns the object), so the contents |errors|
+    // are invalidated now!
+    EXPECT_TRUE(external_install_manager->GetErrorsForTesting().empty());
+    external_install_manager->ClearShownIdsForTesting();
+    external_install_manager->UpdateExternalExtensionAlert();
+  }
+
+  // We should have stopped prompting, since the user was shown the warning
+  // three times.
+  EXPECT_TRUE(external_install_manager->GetErrorsForTesting().empty());
+  EXPECT_TRUE(prefs->IsExternalExtensionAcknowledged(good_crx));
+  EXPECT_TRUE(registry()->disabled_extensions().Contains(good_crx));
+  EXPECT_EQ(extensions::disable_reason::DISABLE_EXTERNAL_EXTENSION,
+            prefs->GetDisableReasons(good_crx));
+
+  // The extension should remain disabled.
+  service()->ReloadExtensionsForTest();
+  EXPECT_TRUE(prefs->IsExternalExtensionAcknowledged(good_crx));
+  EXPECT_TRUE(registry()->disabled_extensions().Contains(good_crx));
+  EXPECT_EQ(extensions::disable_reason::DISABLE_EXTERNAL_EXTENSION,
+            prefs->GetDisableReasons(good_crx));
+}
+
 #if !defined(OS_CHROMEOS)
 // This tests if default apps are installed correctly.
 TEST_F(ExtensionServiceTest, DefaultAppsInstall) {
diff --git a/chrome/browser/extensions/external_install_manager.cc b/chrome/browser/extensions/external_install_manager.cc
index 76052ee..b3ba8c0 100644
--- a/chrome/browser/extensions/external_install_manager.cc
+++ b/chrome/browser/extensions/external_install_manager.cc
@@ -122,7 +122,8 @@
     if (iter->second.get() == currently_visible_install_alert_)
       currently_visible_install_alert_ = nullptr;
     errors_.erase(iter);
-    unacknowledged_ids_.erase(extension_id_copy);
+    // No need to erase the ID from |unacknowledged_ids_|; it's already in
+    // |shown_ids_|.
     UpdateExternalExtensionAlert();
   }
 }
@@ -194,6 +195,10 @@
   return errors;
 }
 
+void ExternalInstallManager::ClearShownIdsForTesting() {
+  shown_ids_.clear();
+}
+
 void ExternalInstallManager::OnExtensionLoaded(
     content::BrowserContext* browser_context,
     const Extension* extension) {
diff --git a/chrome/browser/extensions/external_install_manager.h b/chrome/browser/extensions/external_install_manager.h
index 0f0b73d..323e089 100644
--- a/chrome/browser/extensions/external_install_manager.h
+++ b/chrome/browser/extensions/external_install_manager.h
@@ -64,6 +64,9 @@
   // Returns a mutable copy of the list of global errors for testing purposes.
   std::vector<ExternalInstallError*> GetErrorsForTesting();
 
+  // Clears the record of shown IDs for testing.
+  void ClearShownIdsForTesting();
+
  private:
   // ExtensionRegistryObserver implementation.
   void OnExtensionLoaded(content::BrowserContext* browser_context,
diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/browser/extensions/webstore_install_helper.cc
index d3fea6f..7bb5c72 100644
--- a/chrome/browser/extensions/webstore_install_helper.cc
+++ b/chrome/browser/extensions/webstore_install_helper.cc
@@ -39,7 +39,7 @@
 WebstoreInstallHelper::~WebstoreInstallHelper() {}
 
 void WebstoreInstallHelper::Start(
-    content::mojom::URLLoaderFactory* loader_factory) {
+    network::mojom::URLLoaderFactory* loader_factory) {
   CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
 
   data_decoder::SafeJsonParser::Parse(
diff --git a/chrome/browser/extensions/webstore_install_helper.h b/chrome/browser/extensions/webstore_install_helper.h
index 6ddf60ee..0bbfcc7 100644
--- a/chrome/browser/extensions/webstore_install_helper.h
+++ b/chrome/browser/extensions/webstore_install_helper.h
@@ -20,11 +20,11 @@
 
 class BitmapFetcher;
 
-namespace content {
+namespace network {
 namespace mojom {
 class URLLoaderFactory;
 }
-}  // namespace content
+}  // namespace network
 
 namespace safe_json {
 class SafeJsonParser;
@@ -70,7 +70,7 @@
                         const std::string& id,
                         const std::string& manifest,
                         const GURL& icon_url);
-  void Start(content::mojom::URLLoaderFactory* loader_factory);
+  void Start(network::mojom::URLLoaderFactory* loader_factory);
 
  private:
   friend class base::RefCounted<WebstoreInstallHelper>;
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
index c806df50..b7f8dad 100644
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -2807,10 +2807,6 @@
 const char kVrBrowsingInCustomTabDescription[] =
     "Allow browsing within a VR headset while in a Custom Tab.";
 
-const char kVrIconInDaydreamHomeName[] = "Chrome icon in Daydream Home";
-const char kVrIconInDaydreamHomeDescription[] =
-    "Adds an icon to Daydream Home that allows launching Chrome in VR.";
-
 const char kVrLaunchIntentsName[] = "VR intents";
 const char kVrLaunchIntentsDescription[] =
     "Allow intents to launch Chrome in VR mode.";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
index bf94ac1..bb2facb 100644
--- a/chrome/browser/flag_descriptions.h
+++ b/chrome/browser/flag_descriptions.h
@@ -1728,9 +1728,6 @@
 extern const char kVrBrowsingInCustomTabName[];
 extern const char kVrBrowsingInCustomTabDescription[];
 
-extern const char kVrIconInDaydreamHomeName[];
-extern const char kVrIconInDaydreamHomeDescription[];
-
 extern const char kVrLaunchIntentsName[];
 extern const char kVrLaunchIntentsDescription[];
 
diff --git a/chrome/browser/lifetime/browser_close_manager_browsertest.cc b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
index e98a45e..7a53077 100644
--- a/chrome/browser/lifetime/browser_close_manager_browsertest.cc
+++ b/chrome/browser/lifetime/browser_close_manager_browsertest.cc
@@ -54,10 +54,9 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/download_test_observer.h"
+#include "content/public/test/slow_download_http_response.h"
 #include "content/public/test/test_navigation_observer.h"
 #include "net/test/embedded_test_server/embedded_test_server.h"
-#include "net/test/url_request/url_request_mock_http_job.h"
-#include "net/test/url_request/url_request_slow_download_job.h"
 
 #if defined(OS_CHROMEOS)
 #include "chromeos/chromeos_switches.h"
@@ -267,6 +266,9 @@
     content::BrowserThread::PostTask(
         content::BrowserThread::IO, FROM_HERE,
         base::BindOnce(&chrome_browser_net::SetUrlRequestMocksEnabled, true));
+    embedded_test_server()->RegisterRequestHandler(base::BindRepeating(
+        &content::SlowDownloadHttpResponse::HandleSlowDownloadRequest));
+    ASSERT_TRUE(embedded_test_server()->Start());
   }
 
   void SetUpCommandLine(base::CommandLine* command_line) override {
@@ -279,11 +281,15 @@
   }
 
   void CreateStalledDownload(Browser* browser) {
+    ASSERT_TRUE(embedded_test_server()->Started());
+
+    GURL slow_download_url = embedded_test_server()->GetURL(
+        content::SlowDownloadHttpResponse::kKnownSizeUrl);
+
     content::DownloadTestObserverInProgress observer(
         content::BrowserContext::GetDownloadManager(browser->profile()), 1);
     ui_test_utils::NavigateToURLWithDisposition(
-        browser, GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl),
-        WindowOpenDisposition::NEW_BACKGROUND_TAB,
+        browser, slow_download_url, WindowOpenDisposition::NEW_BACKGROUND_TAB,
         ui_test_utils::BROWSER_TEST_NONE);
     observer.WaitForFinished();
     EXPECT_EQ(
@@ -304,7 +310,6 @@
 };
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest, TestSingleTabShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/beforeunload.html")));
   PrepareForDialog(browser());
@@ -328,7 +333,6 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestShutdownMoreThanOnce) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/beforeunload.html")));
   PrepareForDialog(browser());
@@ -354,7 +358,6 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        PRE_TestSessionRestore) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/beforeunload.html")));
   AddBlankTabAndShow(browser());
@@ -408,7 +411,6 @@
 // Test that browser windows are only closed if all browsers are ready to close
 // and that all beforeunload dialogs are shown again after a cancel.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest, TestMultipleWindows) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
@@ -458,7 +460,6 @@
 // early.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestHangInBeforeUnloadMultipleTabs) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload_hang.html")));
   AddBlankTabAndShow(browsers_[0]);
@@ -494,7 +495,6 @@
 // early.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestHangInBeforeUnloadMultipleWindows) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
@@ -532,7 +532,6 @@
 // user chose to cancel browser close.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestUnloadMultipleSlowTabs) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   const int kTabCount = 5;
   const int kResposiveTabIndex = 2;
   // Create tab strip with all tabs except one responding after
@@ -579,7 +578,6 @@
 // Regression for crbug.com/365052 caused CHECK in tabstrip.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestBeforeUnloadMultipleSlowWindows) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   const int kBrowserCount = 5;
   const int kResposiveBrowserIndex = 2;
   // Create multiple browsers with all tabs except one responding after
@@ -632,7 +630,6 @@
 // Test that a window created during shutdown is closed.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        MAYBE_TestAddWindowDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   PrepareForDialog(browsers_[0]);
@@ -651,7 +648,6 @@
 // cancel the shutdown.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestAddWindowWithBeforeUnloadDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   PrepareForDialog(browsers_[0]);
@@ -684,7 +680,6 @@
 // Test that tabs added during shutdown are closed.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestAddTabDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
@@ -710,7 +705,6 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestAddTabWithBeforeUnloadDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   browsers_.push_back(CreateBrowser(browser()->profile()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
@@ -766,7 +760,6 @@
   if (GetParam())
     return;
 
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browser(), embedded_test_server()->GetURL("/title1.html")));
 
@@ -858,7 +851,6 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestCloseTabDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   PrepareForDialog(browsers_[0]);
@@ -893,7 +885,6 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestOpenAndCloseWindowDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   PrepareForDialog(browsers_[0]);
@@ -928,7 +919,6 @@
 
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerBrowserTest,
                        TestCloseWindowDuringShutdown) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
       browsers_[0], embedded_test_server()->GetURL("/beforeunload.html")));
   browsers_.push_back(CreateBrowser(browser()->profile()));
@@ -994,7 +984,6 @@
 #if defined(OS_MACOSX)
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        TestWithDownloads) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
 
@@ -1017,7 +1006,6 @@
 // Test shutdown with a DANGEROUS_URL download undecided.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
     TestWithDangerousUrlDownload) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
 
   // Set up the fake delegate that forces the download to be malicious.
@@ -1059,7 +1047,6 @@
 // Test shutdown with a download in progress.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        TestWithDownloads) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
   content::TestNavigationObserver navigation_observer(
@@ -1088,7 +1075,6 @@
 // Test shutdown with a download in progress in an off-the-record profile.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        TestWithOffTheRecordDownloads) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   Profile* otr_profile = browser()->profile()->GetOffTheRecordProfile();
   SetDownloadPathForProfile(otr_profile);
   Browser* otr_browser = CreateBrowser(otr_profile);
@@ -1187,7 +1173,6 @@
   profile_manager->RegisterTestingProfile(other_profile, true, false);
   Browser* other_profile_browser = CreateBrowser(other_profile);
 
-  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   SetDownloadPathForProfile(other_profile);
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
@@ -1230,7 +1215,6 @@
 // Test shutdown with downloads in progress and beforeunload handlers.
 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
                        DISABLED_TestBeforeUnloadAndDownloads) {
-  ASSERT_TRUE(embedded_test_server()->Start());
   SetDownloadPathForProfile(browser()->profile());
   ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
   ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(
diff --git a/chrome/browser/media/android/remote/remote_media_player_manager.cc b/chrome/browser/media/android/remote/remote_media_player_manager.cc
index 3962ca6..53d37e8 100644
--- a/chrome/browser/media/android/remote/remote_media_player_manager.cc
+++ b/chrome/browser/media/android/remote/remote_media_player_manager.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/media/android/remote/remote_media_player_manager.h"
 
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/android/tab_android.h"
 #include "chrome/common/chrome_content_client.h"
 #include "content/common/media/media_player_messages_android.h"
@@ -143,7 +142,7 @@
 
 RemoteMediaPlayerBridge* RemoteMediaPlayerManager::CreateRemoteMediaPlayer(
     int player_id) {
-  alternative_players_.push_back(base::MakeUnique<RemoteMediaPlayerBridge>(
+  alternative_players_.push_back(std::make_unique<RemoteMediaPlayerBridge>(
       player_id, GetUserAgent(), this));
   RemoteMediaPlayerBridge* remote =
       static_cast<RemoteMediaPlayerBridge*>(alternative_players_.back().get());
diff --git a/chrome/browser/media/android/router/media_router_android.cc b/chrome/browser/media/android/router/media_router_android.cc
index 1568c4c..0135ccd 100644
--- a/chrome/browser/media/android/router/media_router_android.cc
+++ b/chrome/browser/media/android/router/media_router_android.cc
@@ -9,7 +9,6 @@
 
 #include "base/guid.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/android/tab_android.h"
 #include "chrome/browser/media/router/media_routes_observer.h"
 #include "chrome/browser/media/router/media_sinks_observer.h"
@@ -67,7 +66,7 @@
       && web_contents->GetBrowserContext()->IsOffTheRecord();
 
   int route_request_id =
-      route_requests_.Add(base::MakeUnique<MediaRouteRequest>(
+      route_requests_.Add(std::make_unique<MediaRouteRequest>(
           MediaSource(source_id), presentation_id, std::move(callbacks)));
   bridge_->CreateRoute(source_id, sink_id, presentation_id, origin, tab_id,
                        is_incognito, route_request_id);
@@ -102,7 +101,7 @@
   DVLOG(2) << "JoinRoute: " << source_id << ", " << presentation_id << ", "
            << origin.GetURL().spec() << ", " << tab_id;
 
-  int request_id = route_requests_.Add(base::MakeUnique<MediaRouteRequest>(
+  int request_id = route_requests_.Add(std::make_unique<MediaRouteRequest>(
       MediaSource(source_id), presentation_id, std::move(callbacks)));
   bridge_->JoinRoute(source_id, presentation_id, origin, tab_id, request_id);
 }
@@ -115,7 +114,7 @@
                                           const std::string& message,
                                           SendRouteMessageCallback callback) {
   int callback_id = message_callbacks_.Add(
-      base::MakeUnique<SendRouteMessageCallback>(std::move(callback)));
+      std::make_unique<SendRouteMessageCallback>(std::move(callback)));
   bridge_->SendRouteMessage(route_id, message, callback_id);
 }
 
@@ -152,7 +151,7 @@
   const std::string& source_id = observer->source().id();
   auto& observer_list = sinks_observers_[source_id];
   if (!observer_list) {
-    observer_list = base::MakeUnique<base::ObserverList<MediaSinksObserver>>();
+    observer_list = std::make_unique<base::ObserverList<MediaSinksObserver>>();
   } else {
     DCHECK(!observer_list->HasObserver(observer));
   }
@@ -201,7 +200,7 @@
   auto& observer_list = message_observers_[route_id];
   if (!observer_list) {
     observer_list =
-        base::MakeUnique<base::ObserverList<RouteMessageObserver>>();
+        std::make_unique<base::ObserverList<RouteMessageObserver>>();
   } else {
     DCHECK(!observer_list->HasObserver(observer));
   }
diff --git a/chrome/browser/media/cast_remoting_connector.cc b/chrome/browser/media/cast_remoting_connector.cc
index 8996361..1a03c51 100644
--- a/chrome/browser/media/cast_remoting_connector.cc
+++ b/chrome/browser/media/cast_remoting_connector.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/media/cast_remoting_connector.h"
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/callback.h"
@@ -213,7 +215,7 @@
 void CastRemotingConnector::CreateBridge(media::mojom::RemotingSourcePtr source,
                                          media::mojom::RemoterRequest request) {
   mojo::MakeStrongBinding(
-      base::MakeUnique<RemotingBridge>(std::move(source), this),
+      std::make_unique<RemotingBridge>(std::move(source), this),
       std::move(request));
 }
 
diff --git a/chrome/browser/media/cast_remoting_connector_unittest.cc b/chrome/browser/media/cast_remoting_connector_unittest.cc
index 5c71c85..668e80e 100644
--- a/chrome/browser/media/cast_remoting_connector_unittest.cc
+++ b/chrome/browser/media/cast_remoting_connector_unittest.cc
@@ -4,11 +4,11 @@
 
 #include "chrome/browser/media/cast_remoting_connector.h"
 
+#include <memory>
 #include <utility>
 #include <vector>
 
 #include "base/callback.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/run_loop.h"
 #include "chrome/browser/media/router/test/mock_media_router.h"
@@ -214,7 +214,7 @@
   RemoterPtr remoter = CreateRemoter(&source);
 
   std::unique_ptr<MockMediaRemoter> media_remoter =
-      base::MakeUnique<MockMediaRemoter>(&media_router_);
+      std::make_unique<MockMediaRemoter>(&media_router_);
 
   EXPECT_CALL(source, OnSinkAvailable(_)).Times(1);
   media_remoter->OnSinkAvailable();
@@ -233,7 +233,7 @@
   RemoterPtr remoter2 = CreateRemoter(&source2);
 
   std::unique_ptr<MockMediaRemoter> media_remoter =
-      base::MakeUnique<MockMediaRemoter>(&media_router_);
+      std::make_unique<MockMediaRemoter>(&media_router_);
 
   EXPECT_CALL(source1, OnSinkAvailable(_)).Times(1);
   EXPECT_CALL(source2, OnSinkAvailable(_)).Times(1);
@@ -251,7 +251,7 @@
   RemoterPtr remoter = CreateRemoter(source.get());
 
   std::unique_ptr<MockMediaRemoter> media_remoter =
-      base::MakeUnique<MockMediaRemoter>(&media_router_);
+      std::make_unique<MockMediaRemoter>(&media_router_);
 
   EXPECT_CALL(*source, OnSinkAvailable(_)).Times(1);
   media_remoter->OnSinkAvailable();
@@ -266,7 +266,7 @@
   RemoterPtr remoter = CreateRemoter(&source);
 
   std::unique_ptr<MockMediaRemoter> media_remoter =
-      base::MakeUnique<MockMediaRemoter>(&media_router_);
+      std::make_unique<MockMediaRemoter>(&media_router_);
 
   EXPECT_CALL(source, OnSinkAvailable(_)).Times(1);
   media_remoter->OnSinkAvailable();
@@ -294,7 +294,7 @@
   RemoterPtr remoter2 = CreateRemoter(&source2);
 
   std::unique_ptr<MockMediaRemoter> media_remoter =
-      base::MakeUnique<MockMediaRemoter>(&media_router_);
+      std::make_unique<MockMediaRemoter>(&media_router_);
 
   EXPECT_CALL(source1, OnSinkAvailable(_)).Times(1);
   EXPECT_CALL(source2, OnSinkAvailable(_)).Times(1);
@@ -340,7 +340,7 @@
   std::unique_ptr<MockRemotingSource> other_source(new MockRemotingSource());
   RemoterPtr other_remoter = CreateRemoter(other_source.get());
   std::unique_ptr<MockMediaRemoter> media_remoter =
-      base::MakeUnique<MockMediaRemoter>(&media_router_);
+      std::make_unique<MockMediaRemoter>(&media_router_);
 
   // Throughout this test |other_source| should not participate in the
   // remoting session, and so these method calls should never occur:
diff --git a/chrome/browser/media/cast_remoting_sender.cc b/chrome/browser/media/cast_remoting_sender.cc
index b2327b47..b06004f 100644
--- a/chrome/browser/media/cast_remoting_sender.cc
+++ b/chrome/browser/media/cast_remoting_sender.cc
@@ -6,12 +6,12 @@
 
 #include <algorithm>
 #include <map>
+#include <memory>
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/callback.h"
 #include "base/lazy_instance.h"
-#include "base/memory/ptr_util.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/stl_util.h"
 #include "base/threading/thread_task_runner_handle.h"
@@ -104,7 +104,7 @@
   pointer_in_map = this;
 
   transport_->InitializeStream(
-      config, base::MakeUnique<RemotingRtcpClient>(weak_factory_.GetWeakPtr()));
+      config, std::make_unique<RemotingRtcpClient>(weak_factory_.GetWeakPtr()));
 
   if (!frame_event_cb_.is_null())
     DCHECK(logging_flush_interval_ > base::TimeDelta());
@@ -167,7 +167,7 @@
   sender->error_callback_ = error_callback;
 
   sender->data_pipe_reader_ =
-      base::MakeUnique<media::MojoDataPipeReader>(std::move(pipe));
+      std::make_unique<media::MojoDataPipeReader>(std::move(pipe));
   sender->binding_.Bind(std::move(request));
   sender->binding_.set_connection_error_handler(sender->error_callback_);
 }
diff --git a/chrome/browser/media/cast_transport_host_filter.cc b/chrome/browser/media/cast_transport_host_filter.cc
index f7a36b8..855617971 100644
--- a/chrome/browser/media/cast_transport_host_filter.cc
+++ b/chrome/browser/media/cast_transport_host_filter.cc
@@ -6,7 +6,6 @@
 
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/common/cast_messages.h"
@@ -185,7 +184,7 @@
   std::unique_ptr<media::cast::CastTransport> transport =
       media::cast::CastTransport::Create(
           base::DefaultTickClock::GetInstance(), kSendEventsInterval,
-          base::MakeUnique<TransportClient>(channel_id, this),
+          std::make_unique<TransportClient>(channel_id, this),
           std::move(udp_transport), base::ThreadTaskRunnerHandle::Get());
   transport->SetOptions(options);
   id_map_.AddWithID(std::move(transport), channel_id);
@@ -227,7 +226,7 @@
         config.rtp_payload_type == media::cast::RtpPayloadType::REMOTE_VIDEO) {
       // Create CastRemotingSender for this RTP stream.
       remoting_sender_map_.AddWithID(
-          base::MakeUnique<CastRemotingSender>(
+          std::make_unique<CastRemotingSender>(
               transport, config, kSendEventsInterval,
               base::Bind(&CastTransportHostFilter::OnCastRemotingSenderEvents,
                          weak_factory_.GetWeakPtr(), channel_id)),
@@ -238,7 +237,7 @@
       stream_id_map_.insert(std::make_pair(channel_id, config.rtp_stream_id));
     } else {
       transport->InitializeStream(
-          config, base::MakeUnique<RtcpClient>(channel_id, config.ssrc,
+          config, std::make_unique<RtcpClient>(channel_id, config.ssrc,
                                                weak_factory_.GetWeakPtr()));
     }
   } else {
diff --git a/chrome/browser/media/media_engagement_contents_observer.cc b/chrome/browser/media/media_engagement_contents_observer.cc
index 41173e0f..7dcae036 100644
--- a/chrome/browser/media/media_engagement_contents_observer.cc
+++ b/chrome/browser/media/media_engagement_contents_observer.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/media/media_engagement_contents_observer.h"
 
+#include <memory>
+
 #include "base/metrics/histogram.h"
 #include "base/metrics/histogram_macros.h"
 #include "chrome/browser/media/media_engagement_preloaded_list.h"
@@ -433,7 +435,7 @@
       return;
 
     std::unique_ptr<base::Timer> new_timer =
-        base::MakeUnique<base::Timer>(true, false);
+        std::make_unique<base::Timer>(true, false);
     if (task_runner_)
       new_timer->SetTaskRunner(task_runner_);
 
diff --git a/chrome/browser/media/media_engagement_score.cc b/chrome/browser/media/media_engagement_score.cc
index 50b89446..059fecc 100644
--- a/chrome/browser/media/media_engagement_score.cc
+++ b/chrome/browser/media/media_engagement_score.cc
@@ -40,7 +40,7 @@
     const HostContentSettingsMap* settings,
     const GURL& origin_url) {
   if (!settings)
-    return base::MakeUnique<base::DictionaryValue>();
+    return std::make_unique<base::DictionaryValue>();
 
   std::unique_ptr<base::DictionaryValue> value =
       base::DictionaryValue::From(settings->GetWebsiteSetting(
@@ -49,7 +49,7 @@
 
   if (value.get())
     return value;
-  return base::MakeUnique<base::DictionaryValue>();
+  return std::make_unique<base::DictionaryValue>();
 }
 
 }  // namespace
diff --git a/chrome/browser/media/media_engagement_score_unittest.cc b/chrome/browser/media/media_engagement_score_unittest.cc
index 42c16c2..a037a338 100644
--- a/chrome/browser/media/media_engagement_score_unittest.cc
+++ b/chrome/browser/media/media_engagement_score_unittest.cc
@@ -268,7 +268,7 @@
   // Store some example data in content settings.
   GURL origin("https://www.google.com");
   std::unique_ptr<base::DictionaryValue> score_dict =
-      base::MakeUnique<base::DictionaryValue>();
+      std::make_unique<base::DictionaryValue>();
   score_dict->SetInteger(MediaEngagementScore::kVisitsKey, example_num_visits);
   score_dict->SetInteger(MediaEngagementScore::kMediaPlaybacksKey,
                          example_media_playbacks);
diff --git a/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc b/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc
index c868571..c6138935 100644
--- a/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc
+++ b/chrome/browser/media/router/discovery/dial/device_description_fetcher_unittest.cc
@@ -7,7 +7,6 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "chrome/browser/media/router/discovery/dial/device_description_fetcher.h"
 #include "chrome/browser/media/router/discovery/dial/dial_device_data.h"
@@ -44,7 +43,7 @@
   }
 
   net::TestURLFetcher* StartRequest() {
-    fetcher_ = base::MakeUnique<DeviceDescriptionFetcher>(
+    fetcher_ = std::make_unique<DeviceDescriptionFetcher>(
         url_, profile_.GetRequestContext(), std::move(success_cb_),
         std::move(error_cb_));
     fetcher_->Start();
diff --git a/chrome/browser/media/router/discovery/dial/dial_app_info_fetcher_unittest.cc b/chrome/browser/media/router/discovery/dial/dial_app_info_fetcher_unittest.cc
index 0993d49..5cff01d 100644
--- a/chrome/browser/media/router/discovery/dial/dial_app_info_fetcher_unittest.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_app_info_fetcher_unittest.cc
@@ -7,7 +7,6 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/media/router/discovery/dial/dial_app_info_fetcher.h"
 #include "chrome/test/base/testing_profile.h"
 #include "content/public/test/test_browser_thread_bundle.h"
@@ -40,7 +39,7 @@
   }
 
   net::TestURLFetcher* StartRequest() {
-    fetcher_ = base::MakeUnique<DialAppInfoFetcher>(
+    fetcher_ = std::make_unique<DialAppInfoFetcher>(
         url_, profile_.GetRequestContext(), std::move(success_cb_),
         std::move(error_cb_));
     fetcher_->Start();
diff --git a/chrome/browser/media/router/discovery/dial/dial_registry.cc b/chrome/browser/media/router/discovery/dial/dial_registry.cc
index 87d0650..3fb604ad 100644
--- a/chrome/browser/media/router/discovery/dial/dial_registry.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_registry.cc
@@ -7,7 +7,6 @@
 #include <memory>
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/stl_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/time/default_clock.h"
@@ -71,7 +70,7 @@
 }
 
 std::unique_ptr<DialService> DialRegistry::CreateDialService() {
-  return base::MakeUnique<DialServiceImpl>(net_log_);
+  return std::make_unique<DialServiceImpl>(net_log_);
 }
 
 void DialRegistry::ClearDialService() {
@@ -119,7 +118,7 @@
 
 void DialRegistry::AddDeviceForTest(const DialDeviceData& device_data) {
   std::unique_ptr<DialDeviceData> test_data =
-      base::MakeUnique<DialDeviceData>(device_data);
+      std::make_unique<DialDeviceData>(device_data);
   device_by_label_map_.insert(
       std::make_pair(device_data.label(), test_data.get()));
   device_by_id_map_.insert(
@@ -287,7 +286,7 @@
   // Adds |device| to our list of devices or updates an existing device, unless
   // |device| is a duplicate. Returns true if the list was modified and
   // increments the list generation.
-  auto device_data = base::MakeUnique<DialDeviceData>(device);
+  auto device_data = std::make_unique<DialDeviceData>(device);
   DCHECK(!device_data->device_id().empty());
   DCHECK(device_data->label().empty());
 
diff --git a/chrome/browser/media/router/discovery/dial/dial_service.cc b/chrome/browser/media/router/discovery/dial/dial_service.cc
index 89d5cb9..c8ede26 100644
--- a/chrome/browser/media/router/discovery/dial/dial_service.cc
+++ b/chrome/browser/media/router/discovery/dial/dial_service.cc
@@ -13,7 +13,6 @@
 #include "base/callback.h"
 #include "base/location.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/rand_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/stringprintf.h"
@@ -184,7 +183,7 @@
   DCHECK(bind_ip_address.IsIPv4());
 
   net::RandIntCallback rand_cb = base::Bind(&base::RandInt);
-  socket_ = base::MakeUnique<UDPSocket>(net::DatagramSocket::RANDOM_BIND,
+  socket_ = std::make_unique<UDPSocket>(net::DatagramSocket::RANDOM_BIND,
                                         rand_cb, net_log, net::NetLogSource());
 
   // 0 means bind a random port
@@ -530,7 +529,7 @@
 
 std::unique_ptr<DialServiceImpl::DialSocket>
 DialServiceImpl::CreateDialSocket() {
-  return base::MakeUnique<DialServiceImpl::DialSocket>(this);
+  return std::make_unique<DialServiceImpl::DialSocket>(this);
 }
 
 void DialServiceImpl::SendOneRequest() {
diff --git a/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.cc b/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.cc
index 729dbf9..ea53406d 100644
--- a/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.cc
+++ b/chrome/browser/media/router/discovery/dial/safe_dial_app_info_parser.cc
@@ -7,7 +7,6 @@
 #include <utility>
 
 #include "base/bind.h"
-#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/unguessable_token.h"
@@ -126,7 +125,7 @@
 
   // Read optional @dialVer.
   std::unique_ptr<ParsedDialAppInfo> app_info =
-      base::MakeUnique<ParsedDialAppInfo>();
+      std::make_unique<ParsedDialAppInfo>();
   app_info->dial_version =
       data_decoder::GetXmlElementAttribute(*service_element, "dialVer");
 
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor.cc b/chrome/browser/media/router/discovery/discovery_network_monitor.cc
index 4f1a69a..bc932265 100644
--- a/chrome/browser/media/router/discovery/discovery_network_monitor.cc
+++ b/chrome/browser/media/router/discovery/discovery_network_monitor.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/media/router/discovery/discovery_network_monitor.h"
 
+#include <memory>
 #include <unordered_set>
 
 #include "base/lazy_instance.h"
@@ -95,9 +96,9 @@
           base::ObserverListPolicy::EXISTING_ONLY)),
       task_runner_(base::CreateSequencedTaskRunnerWithTraits(base::MayBlock())),
       network_info_function_(strategy),
-      metric_observer_(base::MakeUnique<DiscoveryNetworkMonitorMetricObserver>(
+      metric_observer_(std::make_unique<DiscoveryNetworkMonitorMetricObserver>(
           base::DefaultTickClock::GetInstance(),
-          base::MakeUnique<DiscoveryNetworkMonitorMetrics>())) {
+          std::make_unique<DiscoveryNetworkMonitorMetrics>())) {
   DETACH_FROM_SEQUENCE(sequence_checker_);
   AddObserver(metric_observer_.get());
   net::NetworkChangeNotifier::AddNetworkChangeObserver(this);
diff --git a/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc b/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc
index e6f133f0..b48163d0 100644
--- a/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc
+++ b/chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer_unittest.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/media/router/discovery/discovery_network_monitor_metric_observer.h"
 
+#include <memory>
+
 #include "base/test/simple_test_tick_clock.h"
 #include "base/test/test_mock_time_task_runner.h"
 #include "base/threading/thread_task_runner_handle.h"
@@ -75,12 +77,12 @@
  public:
   DiscoveryNetworkMonitorMetricObserverTest()
       : mock_network_change_notifier_(
-            base::MakeUnique<MockNetworkChangeNotifier>()),
+            std::make_unique<MockNetworkChangeNotifier>()),
         task_runner_(new base::TestMockTimeTaskRunner()),
         task_runner_handle_(task_runner_),
         mock_clock_(task_runner_->GetMockTickClock()),
         start_ticks_(mock_clock_->NowTicks()),
-        metrics_(base::MakeUnique<MockMetrics>()),
+        metrics_(std::make_unique<MockMetrics>()),
         mock_metrics_(metrics_.get()),
         clock_(task_runner_->GetMockTickClock()),
         metric_observer_(clock_.get(), std::move(metrics_)) {}
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc
index d1567ef..679ac7d 100644
--- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc
+++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl.h"
 
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial_params.h"
 #include "base/rand_util.h"
 #include "base/strings/string_number_conversions.h"
@@ -491,7 +490,7 @@
   failure_count_map_[ip_endpoint] = std::min(failure_count, kMaxFailureCount);
 
   if (!backoff_entry)
-    backoff_entry = base::MakeUnique<net::BackoffEntry>(&backoff_policy_);
+    backoff_entry = std::make_unique<net::BackoffEntry>(&backoff_policy_);
 
   if (backoff_entry->failure_count() >= retry_params_.max_retry_attempts) {
     DVLOG(1) << "Fail to open channel after all retry attempts: "
diff --git a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc
index c3d4b91..f2f73a0 100644
--- a/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc
+++ b/chrome/browser/media/router/discovery/mdns/cast_media_sink_service_impl_unittest.cc
@@ -84,7 +84,7 @@
   }
 
   void SetUp() override {
-    auto mock_timer = base::MakeUnique<base::MockTimer>(
+    auto mock_timer = std::make_unique<base::MockTimer>(
         true /*retain_user_task*/, false /*is_repeating*/);
     mock_timer_ = mock_timer.get();
     media_sink_service_impl_.SetTimerForTest(std::move(mock_timer));
diff --git a/chrome/browser/media/router/discovery/mdns/dns_sd_registry.cc b/chrome/browser/media/router/discovery/mdns/dns_sd_registry.cc
index e9bda239..34353d1 100644
--- a/chrome/browser/media/router/discovery/mdns/dns_sd_registry.cc
+++ b/chrome/browser/media/router/discovery/mdns/dns_sd_registry.cc
@@ -6,7 +6,6 @@
 
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/stl_util.h"
 #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
 #include "chrome/browser/media/router/discovery/mdns/dns_sd_device_lister.h"
@@ -173,7 +172,7 @@
                               service_discovery_client_.get()));
   dns_sd_device_lister->Discover();
   service_data_map_[service_type] =
-      base::MakeUnique<ServiceTypeData>(std::move(dns_sd_device_lister));
+      std::make_unique<ServiceTypeData>(std::move(dns_sd_device_lister));
   DispatchApiEvent(service_type);
 }
 
diff --git a/chrome/browser/media/router/event_page_request_manager_unittest.cc b/chrome/browser/media/router/event_page_request_manager_unittest.cc
index 9e13bed..eb2fb2e 100644
--- a/chrome/browser/media/router/event_page_request_manager_unittest.cc
+++ b/chrome/browser/media/router/event_page_request_manager_unittest.cc
@@ -46,7 +46,7 @@
 
   static std::unique_ptr<KeyedService> Create(
       content::BrowserContext* context) {
-    return base::MakeUnique<TestProcessManager>(context);
+    return std::make_unique<TestProcessManager>(context);
   }
 
   MOCK_METHOD1(IsEventPageSuspended, bool(const std::string& ext_id));
@@ -67,7 +67,7 @@
 
  protected:
   void SetUp() override {
-    profile_ = base::MakeUnique<TestingProfile>();
+    profile_ = std::make_unique<TestingProfile>();
     // Set up a mock ProcessManager instance.
     extensions::ProcessManagerFactory::GetInstance()->SetTestingFactory(
         profile_.get(), &TestProcessManager::Create);
diff --git a/chrome/browser/media/router/media_router_base.cc b/chrome/browser/media/router/media_router_base.cc
index 23ca708..aac45fd 100644
--- a/chrome/browser/media/router/media_router_base.cc
+++ b/chrome/browser/media/router/media_router_base.cc
@@ -4,9 +4,10 @@
 
 #include "chrome/browser/media/router/media_router_base.h"
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/guid.h"
-#include "base/memory/ptr_util.h"
 #include "base/stl_util.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/profiles/profile.h"
@@ -61,7 +62,7 @@
 
   auto& callbacks = presentation_connection_state_callbacks_[route_id];
   if (!callbacks) {
-    callbacks = base::MakeUnique<PresentationConnectionStateChangedCallbacks>();
+    callbacks = std::make_unique<PresentationConnectionStateChangedCallbacks>();
     callbacks->set_removal_callback(base::Bind(
         &MediaRouterBase::OnPresentationConnectionStateCallbackRemoved,
         base::Unretained(this), route_id));
diff --git a/chrome/browser/media/router/media_router_dialog_controller.cc b/chrome/browser/media/router/media_router_dialog_controller.cc
index 8d7527c..490a19b 100644
--- a/chrome/browser/media/router/media_router_dialog_controller.cc
+++ b/chrome/browser/media/router/media_router_dialog_controller.cc
@@ -140,7 +140,7 @@
     return false;
   }
 
-  start_presentation_context_ = base::MakeUnique<StartPresentationContext>(
+  start_presentation_context_ = std::make_unique<StartPresentationContext>(
       presentation_request, std::move(success_cb), std::move(error_cb));
   MediaRouterMetrics::RecordMediaRouterDialogOrigin(
       MediaRouterDialogOpenOrigin::PAGE);
diff --git a/chrome/browser/media/router/media_router_dialog_controller_unittest.cc b/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
index e2470e43..ee23cbb 100644
--- a/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
+++ b/chrome/browser/media/router/media_router_dialog_controller_unittest.cc
@@ -127,7 +127,7 @@
 }
 
 TEST_F(MediaRouterDialogControllerTest, StartPresentationContext) {
-  auto context = base::MakeUnique<StartPresentationContext>(
+  auto context = std::make_unique<StartPresentationContext>(
       content::PresentationRequest(
           {1, 2}, {GURL("http://example.com"), GURL("http://example2.com")},
           url::Origin::Create(GURL("http://google.com"))),
diff --git a/chrome/browser/media/router/media_router_feature.cc b/chrome/browser/media/router/media_router_feature.cc
index dc9533f..8688d38 100644
--- a/chrome/browser/media/router/media_router_feature.cc
+++ b/chrome/browser/media/router/media_router_feature.cc
@@ -21,7 +21,7 @@
 #if !defined(OS_ANDROID)
 // Controls if browser side Cast device discovery is enabled.
 const base::Feature kEnableCastDiscovery{"EnableCastDiscovery",
-                                         base::FEATURE_DISABLED_BY_DEFAULT};
+                                         base::FEATURE_ENABLED_BY_DEFAULT};
 
 // Controls if local media casting is enabled.
 const base::Feature kEnableCastLocalMedia{"EnableCastLocalMedia",
diff --git a/chrome/browser/media/router/mojo/media_route_controller_unittest.cc b/chrome/browser/media/router/mojo/media_route_controller_unittest.cc
index d709e6ac..994b845 100644
--- a/chrome/browser/media/router/mojo/media_route_controller_unittest.cc
+++ b/chrome/browser/media/router/mojo/media_route_controller_unittest.cc
@@ -42,7 +42,7 @@
     auto result = controller->InitMojoInterfaces();
     mock_media_controller_.Bind(std::move(result.first));
     mojo_media_status_observer_ = std::move(result.second);
-    observer_ = base::MakeUnique<MockMediaRouteControllerObserver>(
+    observer_ = std::make_unique<MockMediaRouteControllerObserver>(
         std::move(controller));
   }
 
@@ -61,7 +61,7 @@
   // This must be called only after |observer_| is set.
   std::unique_ptr<StrictMock<MockMediaRouteControllerObserver>> CreateObserver()
       const {
-    return base::MakeUnique<StrictMock<MockMediaRouteControllerObserver>>(
+    return std::make_unique<StrictMock<MockMediaRouteControllerObserver>>(
         GetController());
   }
 
diff --git a/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc b/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc
index 02a46d3..1621cb2 100644
--- a/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc
+++ b/chrome/browser/media/router/mojo/media_router_desktop_unittest.cc
@@ -72,6 +72,8 @@
       cast_media_sink_service = std::make_unique<MockCastMediaSinkService>(
           profile()->GetRequestContext());
       cast_media_sink_service_ = cast_media_sink_service.get();
+    } else {
+      feature_list_.InitWithFeatures({}, {kEnableCastDiscovery});
     }
 
     media_sink_service_ = std::unique_ptr<DualMediaSinkService>(
@@ -153,18 +155,18 @@
       mojom::MediaRouter::SinkAvailability::PER_SOURCE);
   EXPECT_CALL(mock_extension_provider_,
               StartObservingMediaSinks(media_source.id()));
-  sinks_observer = base::MakeUnique<MockMediaSinksObserver>(
+  sinks_observer = std::make_unique<MockMediaSinksObserver>(
       router(), media_source, url::Origin::Create(GURL(kOrigin)));
   EXPECT_TRUE(sinks_observer->Init());
 
   EXPECT_CALL(mock_extension_provider_,
               StartObservingMediaRoutes(media_source.id()));
   routes_observer =
-      base::MakeUnique<MockMediaRoutesObserver>(router(), media_source.id());
+      std::make_unique<MockMediaRoutesObserver>(router(), media_source.id());
 
   EXPECT_CALL(mock_extension_provider_,
               StartListeningForRouteMessages(kRouteId));
-  messages_observer = base::MakeUnique<NullMessageObserver>(router(), kRouteId);
+  messages_observer = std::make_unique<NullMessageObserver>(router(), kRouteId);
   base::RunLoop().RunUntilIdle();
   EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_extension_provider_));
 }
diff --git a/chrome/browser/media/router/presentation/browser_presentation_connection_proxy.cc b/chrome/browser/media/router/presentation/browser_presentation_connection_proxy.cc
index 43f7cd95..f08d5448 100644
--- a/chrome/browser/media/router/presentation/browser_presentation_connection_proxy.cc
+++ b/chrome/browser/media/router/presentation/browser_presentation_connection_proxy.cc
@@ -4,9 +4,9 @@
 
 #include "chrome/browser/media/router/presentation/browser_presentation_connection_proxy.h"
 
+#include <memory>
 #include <vector>
 
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/media/router/media_router.h"
 
 namespace media_router {
@@ -47,7 +47,7 @@
   if (message.is_binary()) {
     router_->SendRouteBinaryMessage(
         route_id_,
-        base::MakeUnique<std::vector<uint8_t>>(std::move(message.data.value())),
+        std::make_unique<std::vector<uint8_t>>(std::move(message.data.value())),
         std::move(on_message_callback));
   } else {
     router_->SendRouteMessage(route_id_, message.message.value(),
diff --git a/chrome/browser/media/router/presentation/browser_presentation_connection_proxy_unittest.cc b/chrome/browser/media/router/presentation/browser_presentation_connection_proxy_unittest.cc
index 4a318b39..5e10705 100644
--- a/chrome/browser/media/router/presentation/browser_presentation_connection_proxy_unittest.cc
+++ b/chrome/browser/media/router/presentation/browser_presentation_connection_proxy_unittest.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/media/router/presentation/browser_presentation_connection_proxy.h"
 
+#include <memory>
+
 #include "base/run_loop.h"
 #include "base/test/mock_callback.h"
 #include "chrome/browser/media/router/test/mock_media_router.h"
@@ -41,7 +43,7 @@
 
   void SetUp() override {
     mock_controller_connection_proxy_ =
-        base::MakeUnique<MockPresentationConnectionProxy>();
+        std::make_unique<MockPresentationConnectionProxy>();
     blink::mojom::PresentationConnectionPtr controller_connection_ptr;
     binding_.reset(new mojo::Binding<blink::mojom::PresentationConnection>(
         mock_controller_connection_proxy_.get(),
@@ -55,7 +57,7 @@
 
     base::RunLoop run_loop;
     browser_connection_proxy_ =
-        base::MakeUnique<BrowserPresentationConnectionProxy>(
+        std::make_unique<BrowserPresentationConnectionProxy>(
             &mock_router_, "MockRouteId",
             mojo::MakeRequest(&receiver_connection_ptr),
             std::move(controller_connection_ptr));
diff --git a/chrome/browser/media/router/presentation/local_presentation_manager.cc b/chrome/browser/media/router/presentation/local_presentation_manager.cc
index 5bd0616..228baf49 100644
--- a/chrome/browser/media/router/presentation/local_presentation_manager.cc
+++ b/chrome/browser/media/router/presentation/local_presentation_manager.cc
@@ -6,7 +6,6 @@
 
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/web_contents.h"
@@ -27,7 +26,7 @@
     it = local_presentations_
              .insert(std::make_pair(
                  presentation_info.presentation_id,
-                 base::MakeUnique<LocalPresentation>(presentation_info)))
+                 std::make_unique<LocalPresentation>(presentation_info)))
              .first;
   }
   return it->second.get();
@@ -119,7 +118,7 @@
                            std::move(receiver_connection_request));
   } else {
     pending_controllers_.insert(std::make_pair(
-        render_frame_host_id, base::MakeUnique<ControllerConnection>(
+        render_frame_host_id, std::make_unique<ControllerConnection>(
                                   std::move(controller_connection_ptr),
                                   std::move(receiver_connection_request))));
   }
diff --git a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
index af9e62ac..995a268 100644
--- a/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
+++ b/chrome/browser/media/router/presentation/presentation_service_delegate_impl_unittest.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/media/router/presentation/presentation_service_delegate_impl.h"
 
-#include "base/memory/ptr_util.h"
 #include "base/test/mock_callback.h"
 #include "build/build_config.h"
 #include "chrome/browser/media/router/presentation/local_presentation_manager.h"
@@ -111,7 +110,7 @@
 
 std::unique_ptr<KeyedService> BuildMockLocalPresentationManager(
     content::BrowserContext* context) {
-  return base::MakeUnique<MockLocalPresentationManager>();
+  return std::make_unique<MockLocalPresentationManager>();
 }
 
 class PresentationServiceDelegateImplTest
@@ -137,7 +136,7 @@
     delegate_impl_ = PresentationServiceDelegateImpl::FromWebContents(wc);
     delegate_impl_->SetMediaRouterForTest(&router_);
     SetMainFrame();
-    presentation_request_ = base::MakeUnique<content::PresentationRequest>(
+    presentation_request_ = std::make_unique<content::PresentationRequest>(
         RenderFrameHostId(main_frame_process_id_, main_frame_routing_id_),
         presentation_urls_, frame_origin_);
     SetMockLocalPresentationManager();
@@ -641,7 +640,7 @@
   {
     ListPrefUpdate update(profile()->GetPrefs(),
                           prefs::kMediaRouterTabMirroringSources);
-    update->AppendIfNotPresent(base::MakeUnique<base::Value>(origin));
+    update->AppendIfNotPresent(std::make_unique<base::Value>(origin));
   }
 
   auto& mock_local_manager = GetMockLocalPresentationManager();
@@ -694,7 +693,7 @@
   {
     ListPrefUpdate update(profile()->GetOffTheRecordProfile()->GetPrefs(),
                           prefs::kMediaRouterTabMirroringSources);
-    update->AppendIfNotPresent(base::MakeUnique<base::Value>(origin));
+    update->AppendIfNotPresent(std::make_unique<base::Value>(origin));
   }
 
   auto& mock_local_manager = GetMockLocalPresentationManager();
diff --git a/chrome/browser/media/router/providers/extension/extension_media_route_provider_proxy_unittest.cc b/chrome/browser/media/router/providers/extension/extension_media_route_provider_proxy_unittest.cc
index 4ff6792..cebd90ad 100644
--- a/chrome/browser/media/router/providers/extension/extension_media_route_provider_proxy_unittest.cc
+++ b/chrome/browser/media/router/providers/extension/extension_media_route_provider_proxy_unittest.cc
@@ -4,8 +4,9 @@
 
 #include "chrome/browser/media/router/providers/extension/extension_media_route_provider_proxy.h"
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/test/mock_callback.h"
 #include "chrome/browser/media/router/event_page_request_manager.h"
@@ -63,7 +64,7 @@
           std::move(request).Run();
         }));
 
-    provider_proxy_ = base::MakeUnique<ExtensionMediaRouteProviderProxy>(
+    provider_proxy_ = std::make_unique<ExtensionMediaRouteProviderProxy>(
         &profile_, mojo::MakeRequest(&provider_proxy_ptr_));
     RegisterMockMediaRouteProvider();
   }
@@ -86,7 +87,7 @@
     mock_provider_.SetRouteToReturn(route_);
 
     mojom::MediaRouteProviderPtr mock_provider_ptr;
-    binding_ = base::MakeUnique<mojo::Binding<mojom::MediaRouteProvider>>(
+    binding_ = std::make_unique<mojo::Binding<mojom::MediaRouteProvider>>(
         &mock_provider_, mojo::MakeRequest(&mock_provider_ptr));
     provider_proxy_->RegisterMediaRouteProvider(std::move(mock_provider_ptr));
   }
diff --git a/chrome/browser/media/router/test/mock_media_router.cc b/chrome/browser/media/router/test/mock_media_router.cc
index 1f14ab10..7bd2c4ca 100644
--- a/chrome/browser/media/router/test/mock_media_router.cc
+++ b/chrome/browser/media/router/test/mock_media_router.cc
@@ -4,12 +4,14 @@
 
 #include "chrome/browser/media/router/test/mock_media_router.h"
 
+#include <memory>
+
 namespace media_router {
 
 // static
 std::unique_ptr<KeyedService> MockMediaRouter::Create(
     content::BrowserContext* context) {
-  return base::MakeUnique<MockMediaRouter>();
+  return std::make_unique<MockMediaRouter>();
 }
 
 MockMediaRouter::MockMediaRouter() {}
diff --git a/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc b/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc
index e393099..16a904d3 100644
--- a/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc
+++ b/chrome/browser/media/webrtc/media_capture_devices_dispatcher.cc
@@ -6,7 +6,6 @@
 
 #include "base/command_line.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
@@ -98,26 +97,26 @@
 #if BUILDFLAG(ENABLE_EXTENSIONS)
 #if defined(OS_CHROMEOS)
   media_access_handlers_.push_back(
-      base::MakeUnique<ChromeOSLoginMediaAccessHandler>());
+      std::make_unique<ChromeOSLoginMediaAccessHandler>());
   // Wrapper around ExtensionMediaAccessHandler used in Public Sessions.
   media_access_handlers_.push_back(
-      base::MakeUnique<PublicSessionMediaAccessHandler>());
+      std::make_unique<PublicSessionMediaAccessHandler>());
 #else
   media_access_handlers_.push_back(
-      base::MakeUnique<ExtensionMediaAccessHandler>());
+      std::make_unique<ExtensionMediaAccessHandler>());
 #endif
   media_access_handlers_.push_back(
-      base::MakeUnique<DesktopCaptureAccessHandler>());
+      std::make_unique<DesktopCaptureAccessHandler>());
 #if defined(OS_CHROMEOS)
   // Wrapper around TabCaptureAccessHandler used in Public Sessions.
   media_access_handlers_.push_back(
-      base::MakeUnique<PublicSessionTabCaptureAccessHandler>());
+      std::make_unique<PublicSessionTabCaptureAccessHandler>());
 #else
-  media_access_handlers_.push_back(base::MakeUnique<TabCaptureAccessHandler>());
+  media_access_handlers_.push_back(std::make_unique<TabCaptureAccessHandler>());
 #endif
 #endif
   media_access_handlers_.push_back(
-      base::MakeUnique<PermissionBubbleMediaAccessHandler>());
+      std::make_unique<PermissionBubbleMediaAccessHandler>());
 }
 
 MediaCaptureDevicesDispatcher::~MediaCaptureDevicesDispatcher() {}
diff --git a/chrome/browser/media/webrtc/media_stream_capture_indicator.cc b/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
index 15b57681..d2bb760 100644
--- a/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
+++ b/chrome/browser/media/webrtc/media_stream_capture_indicator.cc
@@ -12,7 +12,6 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "build/build_config.h"
 #include "chrome/app/chrome_command_ids.h"
 #include "chrome/browser/browser_process.h"
@@ -172,7 +171,7 @@
 std::unique_ptr<content::MediaStreamUI>
 MediaStreamCaptureIndicator::WebContentsDeviceUsage::RegisterMediaStream(
     const content::MediaStreamDevices& devices) {
-  return base::MakeUnique<UIDelegate>(weak_factory_.GetWeakPtr(), devices);
+  return std::make_unique<UIDelegate>(weak_factory_.GetWeakPtr(), devices);
 }
 
 void MediaStreamCaptureIndicator::WebContentsDeviceUsage::AddDevices(
@@ -248,7 +247,7 @@
     const content::MediaStreamDevices& devices) {
   auto& usage = usage_map_[web_contents];
   if (!usage)
-    usage = base::MakeUnique<WebContentsDeviceUsage>(this, web_contents);
+    usage = std::make_unique<WebContentsDeviceUsage>(this, web_contents);
 
   return usage->RegisterMediaStream(devices);
 }
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc b/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc
index 25c3fc7..8af41fb7 100644
--- a/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc
+++ b/chrome/browser/media/webrtc/native_desktop_media_list_unittest.cc
@@ -249,7 +249,7 @@
 
   void AddWindowsAndVerify(bool has_view_dialog) {
     window_capturer_ = new FakeWindowCapturer();
-    model_ = base::MakeUnique<NativeDesktopMediaList>(
+    model_ = std::make_unique<NativeDesktopMediaList>(
         DesktopMediaID::TYPE_WINDOW, base::WrapUnique(window_capturer_));
 
     // Set update period to reduce the time it takes to run tests.
@@ -337,8 +337,8 @@
 }
 
 TEST_F(NativeDesktopMediaListTest, ScreenOnly) {
-  model_ = base::MakeUnique<NativeDesktopMediaList>(
-      DesktopMediaID::TYPE_SCREEN, base::MakeUnique<FakeScreenCapturer>());
+  model_ = std::make_unique<NativeDesktopMediaList>(
+      DesktopMediaID::TYPE_SCREEN, std::make_unique<FakeScreenCapturer>());
 
   // Set update period to reduce the time it takes to run tests.
   model_->SetUpdatePeriod(base::TimeDelta::FromMilliseconds(20));
diff --git a/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc b/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc
index 993c080..647fda5 100644
--- a/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc
+++ b/chrome/browser/media/webrtc/webrtc_log_uploader_unittest.cc
@@ -14,7 +14,6 @@
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_split.h"
@@ -307,7 +306,7 @@
       FROM_HERE,
       base::BindOnce(&WebRtcLogUploader::LoggingStoppedDoUpload,
                      base::Unretained(webrtc_log_uploader.get()),
-                     std::move(log), base::MakeUnique<MetaDataMap>(),
+                     std::move(log), std::make_unique<MetaDataMap>(),
                      upload_done_data),
       run_loop.QuitClosure());
   run_loop.Run();
diff --git a/chrome/browser/net/errorpage_browsertest.cc b/chrome/browser/net/errorpage_browsertest.cc
index d532a47..50a360749 100644
--- a/chrome/browser/net/errorpage_browsertest.cc
+++ b/chrome/browser/net/errorpage_browsertest.cc
@@ -56,8 +56,6 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/common/content_features.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/test_navigation_observer.h"
 #include "content/public/test/url_loader_interceptor.h"
diff --git a/chrome/browser/net/network_context_configuration_browsertest.cc b/chrome/browser/net/network_context_configuration_browsertest.cc
index 6978c3e..62fece6 100644
--- a/chrome/browser/net/network_context_configuration_browsertest.cc
+++ b/chrome/browser/net/network_context_configuration_browsertest.cc
@@ -32,8 +32,6 @@
 #include "content/public/common/network_service.mojom.h"
 #include "content/public/common/simple_url_loader.h"
 #include "content/public/common/url_constants.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/simple_url_loader_test_helper.h"
 #include "content/public/test/test_url_loader_client.h"
@@ -49,6 +47,8 @@
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/cpp/resource_response_info.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
@@ -114,7 +114,7 @@
             .c_str());
   }
 
-  content::mojom::URLLoaderFactory* loader_factory() const {
+  network::mojom::URLLoaderFactory* loader_factory() const {
     switch (GetParam().network_context_type) {
       case NetworkContextType::kSystem:
         return g_browser_process->system_network_context_manager()
diff --git a/chrome/browser/net/profile_network_context_service_browsertest.cc b/chrome/browser/net/profile_network_context_service_browsertest.cc
index b1d63d1..42b6493 100644
--- a/chrome/browser/net/profile_network_context_service_browsertest.cc
+++ b/chrome/browser/net/profile_network_context_service_browsertest.cc
@@ -27,12 +27,12 @@
 #include "components/prefs/pref_service.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/content_features.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/simple_url_loader_test_helper.h"
 #include "content/public/test/test_url_loader_client.h"
 #include "mojo/common/data_pipe_utils.h"
 #include "net/base/load_flags.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace {
@@ -64,13 +64,13 @@
                           ->GetURLLoaderFactoryForBrowserProcess();
   }
 
-  content::mojom::URLLoaderFactory* loader_factory() const {
+  network::mojom::URLLoaderFactory* loader_factory() const {
     return loader_factory_;
   }
 
  private:
   base::test::ScopedFeatureList feature_list_;
-  content::mojom::URLLoaderFactory* loader_factory_ = nullptr;
+  network::mojom::URLLoaderFactory* loader_factory_ = nullptr;
 };
 
 IN_PROC_BROWSER_TEST_P(ProfileNetworkContextServiceBrowsertest,
diff --git a/chrome/browser/net/system_network_context_manager.cc b/chrome/browser/net/system_network_context_manager.cc
index 831719b..c4f1535 100644
--- a/chrome/browser/net/system_network_context_manager.cc
+++ b/chrome/browser/net/system_network_context_manager.cc
@@ -71,7 +71,7 @@
   return network_service_network_context_.get();
 }
 
-content::mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 SystemNetworkContextManager::GetURLLoaderFactory() {
   if (!url_loader_factory_ || url_loader_factory_.encountered_error()) {
     GetContext()->CreateURLLoaderFactory(
diff --git a/chrome/browser/net/system_network_context_manager.h b/chrome/browser/net/system_network_context_manager.h
index 2a6aebf..98fb00e 100644
--- a/chrome/browser/net/system_network_context_manager.h
+++ b/chrome/browser/net/system_network_context_manager.h
@@ -57,7 +57,7 @@
   // backed by the SystemNetworkContext. Allows sharing of the URLLoaderFactory.
   // Prefer this to creating a new one.  Call Clone() on the value returned by
   // this method to get a URLLoaderFactory that can be used on other threads.
-  content::mojom::URLLoaderFactory* GetURLLoaderFactory();
+  network::mojom::URLLoaderFactory* GetURLLoaderFactory();
 
   // Permanently disables QUIC, both for NetworkContexts using the IOThread's
   // NetworkService, and for those using the network service (if enabled).
@@ -87,7 +87,7 @@
 
   // URLLoaderFactory backed by the NetworkContext returned by GetContext(), so
   // consumers don't all need to create their own factory.
-  content::mojom::URLLoaderFactoryPtr url_loader_factory_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_;
 
   bool is_quic_allowed_ = true;
 
diff --git a/chrome/browser/notifications/displayed_notifications_dispatch_callback.h b/chrome/browser/notifications/displayed_notifications_dispatch_callback.h
index 1186aac..5ff9a47 100644
--- a/chrome/browser/notifications/displayed_notifications_dispatch_callback.h
+++ b/chrome/browser/notifications/displayed_notifications_dispatch_callback.h
@@ -11,8 +11,15 @@
 
 // Callback used by the bridge and all the downstream classes that propagate
 // the callback to get displayed notifications.
+//
+// |supports_synchronization| will be true if the platform supports getting the
+// currently displayed notifications.
+//
+// If |supports_synchronization| is true, then |notification_ids| will contain
+// the ids of the currently displayed notifications, otherwise the value of
+// |notification_ids| should be ignored.
 using GetDisplayedNotificationsCallback =
-    base::Callback<void(std::unique_ptr<std::set<std::string>>,
-                        bool /* supports_synchronization */)>;
+    base::Callback<void(std::unique_ptr<std::set<std::string>> notification_ids,
+                        bool supports_synchronization)>;
 
 #endif  // CHROME_BROWSER_NOTIFICATIONS_DISPLAYED_NOTIFICATIONS_DISPATCH_CALLBACK_H_
diff --git a/chrome/browser/notifications/notification_platform_bridge_android.cc b/chrome/browser/notifications/notification_platform_bridge_android.cc
index d306e8f..981bebd 100644
--- a/chrome/browser/notifications/notification_platform_bridge_android.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_android.cc
@@ -4,10 +4,13 @@
 
 #include "chrome/browser/notifications/notification_platform_bridge_android.h"
 
+#include <algorithm>
 #include <memory>
+#include <set>
 #include <utility>
 #include <vector>
 
+#include "base/android/build_info.h"
 #include "base/android/jni_array.h"
 #include "base/android/jni_string.h"
 #include "base/command_line.h"
@@ -15,6 +18,7 @@
 #include "base/logging.h"
 #include "base/strings/nullable_string16.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/notifications/notification_common.h"
 #include "chrome/browser/notifications/notification_display_service_impl.h"
@@ -40,6 +44,7 @@
 using base::android::ConvertUTF8ToJavaString;
 using base::android::JavaParamRef;
 using base::android::ScopedJavaLocalRef;
+using base::android::AppendJavaStringArrayToStringVector;
 
 namespace {
 
@@ -356,11 +361,36 @@
     const std::string& profile_id,
     bool incognito,
     const GetDisplayedNotificationsCallback& callback) const {
-  auto displayed_notifications = std::make_unique<std::set<std::string>>();
+  // Decide whether we want to synchronize Chrome's NotificationDatabase with
+  // data from Android OS. While this data has been available through
+  // NotificationManager since Android M, versions before Android O suffered
+  // from a race condition shortly after showing or closing a notification.
+  // During this period, this data would be incorrect. Hence, restrict
+  // synchronization to O onwards.
+  bool supports_synchronization =
+      (base::android::BuildInfo::GetInstance()->sdk_int() >=
+       base::android::SDK_VERSION_OREO);
+
+  auto displayed_notifications_set = std::make_unique<std::set<std::string>>();
+
+  if (supports_synchronization) {
+    JNIEnv* env = AttachCurrentThread();
+    ScopedJavaLocalRef<jobjectArray> jstringArray_displayed_notifications =
+        Java_NotificationPlatformBridge_getActiveNotificationsIds(env,
+                                                                  java_object_);
+    std::vector<std::string> displayed_notifications;
+    base::android::AppendJavaStringArrayToStringVector(
+        env, jstringArray_displayed_notifications.obj(),
+        &displayed_notifications);
+    std::copy(displayed_notifications.begin(), displayed_notifications.end(),
+              std::inserter(*displayed_notifications_set,
+                            displayed_notifications_set->end()));
+  }
+
   content::BrowserThread::PostTask(
       content::BrowserThread::UI, FROM_HERE,
-      base::Bind(callback, base::Passed(&displayed_notifications),
-                 false /* supports_synchronization */));
+      base::Bind(callback, base::Passed(&displayed_notifications_set),
+                 supports_synchronization));
 }
 
 void NotificationPlatformBridgeAndroid::SetReadyCallback(
diff --git a/chrome/browser/notifications/notification_system_observer.cc b/chrome/browser/notifications/notification_system_observer.cc
index c6c8d889..48cf5ca9 100644
--- a/chrome/browser/notifications/notification_system_observer.cc
+++ b/chrome/browser/notifications/notification_system_observer.cc
@@ -46,8 +46,11 @@
       Profile* profile = content::Source<Profile>(source).ptr();
       DCHECK(!profile->IsOffTheRecord());
       auto* registry = extensions::ExtensionRegistry::Get(profile);
-      DCHECK(!extension_registry_observer_.IsObserving(registry));
-      extension_registry_observer_.Add(registry);
+      // If |this| was created after the profile was created but before the
+      // ADDED notification was sent, we may be already observing it. |this| is
+      // created lazily so it's not easy to predict construction order.
+      if (!extension_registry_observer_.IsObserving(registry))
+        extension_registry_observer_.Add(registry);
       break;
     }
     case chrome::NOTIFICATION_PROFILE_DESTROYED:
diff --git a/chrome/browser/notifications/notification_system_observer.h b/chrome/browser/notifications/notification_system_observer.h
index e0d69a1f..f206c37 100644
--- a/chrome/browser/notifications/notification_system_observer.h
+++ b/chrome/browser/notifications/notification_system_observer.h
@@ -22,7 +22,8 @@
 class NotificationUIManager;
 
 // The content::NotificationObserver observes system status change and sends
-// events to NotificationUIManager.
+// events to NotificationUIManager. NOTE: NotificationUIManager is deprecated,
+// to be replaced by NotificationDisplayService, so this class should go away.
 class NotificationSystemObserver : public content::NotificationObserver,
                                    extensions::ExtensionRegistryObserver {
  public:
diff --git a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
index 4002ea6..3fee001 100644
--- a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
+++ b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
@@ -25,6 +25,7 @@
 #include "chrome/browser/ntp_snippets/dependent_features.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/search/suggestions/image_decoder_impl.h"
+#include "chrome/browser/signin/identity_manager_factory.h"
 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
 #include "chrome/browser/signin/signin_manager_factory.h"
 #include "chrome/browser/sync/profile_sync_service_factory.h"
@@ -338,8 +339,8 @@
   }
 
   PrefService* pref_service = profile->GetPrefs();
-  OAuth2TokenService* token_service =
-      ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
+  identity::IdentityManager* identity_manager =
+      IdentityManagerFactory::GetForProfile(profile);
   UrlLanguageHistogram* language_histogram =
       UrlLanguageHistogramFactory::GetForBrowserContext(profile);
 
@@ -375,8 +376,7 @@
   }
 #endif  // BUILDFLAG(ENABLE_OFFLINE_PAGES)
   auto suggestions_fetcher = base::MakeUnique<RemoteSuggestionsFetcherImpl>(
-      signin_manager, token_service, request_context, pref_service,
-      language_histogram,
+      identity_manager, request_context, pref_service, language_histogram,
       base::Bind(
           &data_decoder::SafeJsonParser::Parse,
           content::ServiceManagerConnection::GetForProcess()->GetConnector()),
@@ -454,6 +454,7 @@
           BrowserContextDependencyManager::GetInstance()) {
   DependsOn(BookmarkModelFactory::GetInstance());
   DependsOn(HistoryServiceFactory::GetInstance());
+  DependsOn(IdentityManagerFactory::GetInstance());
   DependsOn(LargeIconServiceFactory::GetInstance());
 #if BUILDFLAG(ENABLE_OFFLINE_PAGES)
   DependsOn(OfflinePageModelFactory::GetInstance());
diff --git a/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc b/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
index 2d6cc4a..613356c 100644
--- a/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
+++ b/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.cc
@@ -4,7 +4,6 @@
 
 #include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.h"
 
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial_params.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/rand_util.h"
@@ -92,7 +91,7 @@
   if (navigation_delay.is_zero())
     return nullptr;
 
-  return base::MakeUnique<DelayNavigationThrottle>(
+  return std::make_unique<DelayNavigationThrottle>(
       handle, base::ThreadTaskRunnerHandle::Get(), navigation_delay);
 }
 
diff --git a/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle_unittest.cc b/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle_unittest.cc
index 0911c566..3b0fcf57 100644
--- a/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle_unittest.cc
+++ b/chrome/browser/page_load_metrics/experiments/delay_navigation_throttle_unittest.cc
@@ -11,7 +11,6 @@
 #include <utility>
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/run_loop.h"
 #include "base/strings/string_number_conversions.h"
@@ -39,7 +38,7 @@
       content::NavigationHandle::CreateNavigationHandleForTesting(url,
                                                                   main_rfh());
   test_handle->RegisterThrottleForTesting(
-      base::MakeUnique<DelayNavigationThrottle>(
+      std::make_unique<DelayNavigationThrottle>(
           test_handle.get(), mock_time_task_runner, navigation_delay));
 
   EXPECT_FALSE(mock_time_task_runner->HasPendingTask());
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
index f375189be..ad4300c 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -200,7 +200,7 @@
   // committed_load_ or navigation_handle beyond the scope of the constructor.
   auto insertion_result = provisional_loads_.insert(std::make_pair(
       navigation_handle,
-      base::MakeUnique<PageLoadTracker>(
+      std::make_unique<PageLoadTracker>(
           in_foreground_, embedder_interface_.get(), currently_committed_url,
           navigation_handle, user_initiated_info, chain_size,
           chain_size_same_url)));
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc
index 35ecbce3..4dcd2f47 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc
@@ -8,7 +8,6 @@
 #include <vector>
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/process/kill.h"
 #include "base/test/histogram_tester.h"
@@ -139,14 +138,14 @@
   bool IsNewTabPageUrl(const GURL& url) override { return is_ntp_; }
   void set_is_ntp(bool is_ntp) { is_ntp_ = is_ntp; }
   void RegisterObservers(PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<TestPageLoadMetricsObserver>(
+    tracker->AddObserver(std::make_unique<TestPageLoadMetricsObserver>(
         &updated_timings_, &updated_subframe_timings_, &complete_timings_,
         &loaded_resources_, &observed_committed_urls_));
-    tracker->AddObserver(base::MakeUnique<FilteringPageLoadMetricsObserver>(
+    tracker->AddObserver(std::make_unique<FilteringPageLoadMetricsObserver>(
         &completed_filtered_urls_));
   }
   std::unique_ptr<base::Timer> CreateTimer() override {
-    auto timer = base::MakeUnique<test::WeakMockTimer>();
+    auto timer = std::make_unique<test::WeakMockTimer>();
     SetMockTimer(timer->AsWeakPtr());
     return std::move(timer);
   }
@@ -240,7 +239,7 @@
 
   void AttachObserver() {
     auto embedder_interface =
-        base::MakeUnique<TestPageLoadMetricsEmbedderInterface>();
+        std::make_unique<TestPageLoadMetricsEmbedderInterface>();
     embedder_interface_ = embedder_interface.get();
     MetricsWebContentsObserver* observer =
         MetricsWebContentsObserver::CreateForWebContents(
diff --git a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc
index 58378e9..a2df6f6 100644
--- a/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
 #include "chrome/common/page_load_metrics/test/page_load_metrics_test_util.h"
@@ -14,7 +15,7 @@
     : public page_load_metrics::PageLoadMetricsObserverTestHarness {
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<AbortsPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<AbortsPageLoadMetricsObserver>());
   }
 
   void SimulateTimingWithoutPaint() {
diff --git a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc
index 9074ae8a..199785f1 100644
--- a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.cc
@@ -9,7 +9,6 @@
 
 #include "base/feature_list.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/strings/string_util.h"
 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
 #include "chrome/common/chrome_features.h"
@@ -89,7 +88,7 @@
 AdsPageLoadMetricsObserver::CreateIfNeeded() {
   if (!base::FeatureList::IsEnabled(features::kAdsFeature))
     return nullptr;
-  return base::MakeUnique<AdsPageLoadMetricsObserver>();
+  return std::make_unique<AdsPageLoadMetricsObserver>();
 }
 
 AdsPageLoadMetricsObserver::AdsPageLoadMetricsObserver()
@@ -259,7 +258,7 @@
               extra_request_info.original_network_content_length, nullptr,
               extra_request_info.resource_type, extra_request_info.net_error,
               extra_request_info.load_timing_info
-                  ? base::MakeUnique<net::LoadTimingInfo>(
+                  ? std::make_unique<net::LoadTimingInfo>(
                         *extra_request_info.load_timing_info)
                   : nullptr));
     } else {
diff --git a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc
index 8c4dea4..7ecd206 100644
--- a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc
@@ -12,7 +12,6 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/sequenced_task_runner.h"
 #include "base/strings/stringprintf.h"
 #include "base/test/histogram_tester.h"
@@ -71,7 +70,7 @@
  public:
   static std::unique_ptr<content::NavigationThrottle> Create(
       content::NavigationHandle* handle) {
-    return base::MakeUnique<ResourceLoadingCancellingThrottle>(handle);
+    return std::make_unique<ResourceLoadingCancellingThrottle>(handle);
   }
 
   explicit ResourceLoadingCancellingThrottle(
@@ -227,7 +226,7 @@
   void SetUp() override {
     SubresourceFilterTestHarness::SetUp();
     tester_ =
-        base::MakeUnique<page_load_metrics::PageLoadMetricsObserverTester>(
+        std::make_unique<page_load_metrics::PageLoadMetricsObserverTester>(
             web_contents(),
             base::BindRepeating(
                 &AdsPageLoadMetricsObserverTest::RegisterObservers,
@@ -302,7 +301,7 @@
 
  private:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) {
-    tracker->AddObserver(base::MakeUnique<AdsPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<AdsPageLoadMetricsObserver>());
   }
 
   base::HistogramTester histogram_tester_;
diff --git a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
index 75af2958..c8bf3f93 100644
--- a/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
@@ -30,7 +31,7 @@
     : public page_load_metrics::PageLoadMetricsObserverTestHarness {
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<CorePageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<CorePageLoadMetricsObserver>());
   }
 
   void SetUp() override {
diff --git a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc
index e14af21..ee97975 100644
--- a/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/data_reduction_proxy_metrics_observer_unittest.cc
@@ -395,7 +395,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<TestDataReductionProxyMetricsObserver>(
+        std::make_unique<TestDataReductionProxyMetricsObserver>(
             web_contents(), pingback_client_.get(), data_reduction_proxy_used_,
             is_using_lofi_));
   }
@@ -482,7 +482,7 @@
 
   ResetTest();
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_request_url(GURL(kDefaultTestUrl));
   data->set_lofi_received(true);
@@ -528,7 +528,7 @@
   RunTest(true, false, false);
 
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_request_url(GURL(kDefaultTestUrl));
 
@@ -611,7 +611,7 @@
   RunTest(true, false, false);
 
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_request_url(GURL(kDefaultTestUrl));
 
@@ -692,7 +692,7 @@
   ResetTest();
   RunTest(true, false, false);
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_request_url(GURL(kDefaultTestUrl));
   SimulateRendererCrash();
@@ -702,7 +702,7 @@
 
   ResetTest();
   RunTest(true, false, false);
-  data = base::MakeUnique<DataReductionProxyData>();
+  data = std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_request_url(GURL(kDefaultTestUrl));
   NavigateToUntrackedUrl();
diff --git a/chrome/browser/page_load_metrics/observers/delay_navigation_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/delay_navigation_page_load_metrics_observer_unittest.cc
index e7c07ecb..2a27662 100644
--- a/chrome/browser/page_load_metrics/observers/delay_navigation_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/delay_navigation_page_load_metrics_observer_unittest.cc
@@ -9,7 +9,6 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/run_loop.h"
 #include "base/test/test_mock_time_task_runner.h"
@@ -42,7 +41,7 @@
 
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<DelayNavigationPageLoadMetricsObserver>());
+        std::make_unique<DelayNavigationPageLoadMetricsObserver>());
   }
 
   void SetUp() override {
@@ -52,7 +51,7 @@
     // Instantiates a DelayNavigationThrottle for each main frame navigation in
     // the web_contents().
     throttle_inserter_ =
-        base::MakeUnique<content::TestNavigationThrottleInserter>(
+        std::make_unique<content::TestNavigationThrottleInserter>(
             web_contents(),
             base::BindRepeating(
                 &DelayNavigationPageLoadMetricsObserverTest::CreateThrottle,
@@ -63,7 +62,7 @@
       content::NavigationHandle* handle) {
     if (!handle->IsInMainFrame())
       return nullptr;
-    return base::MakeUnique<DelayNavigationThrottle>(
+    return std::make_unique<DelayNavigationThrottle>(
         handle, mock_time_task_runner_,
         base::TimeDelta::FromMilliseconds(kDelayMillis));
   }
diff --git a/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc
index e355954..547db61 100644
--- a/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/document_write_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
 #include "chrome/common/page_load_metrics/test/page_load_metrics_test_util.h"
@@ -16,7 +17,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<DocumentWritePageLoadMetricsObserver>());
+        std::make_unique<DocumentWritePageLoadMetricsObserver>());
   }
 
   void AssertNoBlockHistogramsLogged() {
diff --git a/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer.cc
index 99b31b8b..0db174b 100644
--- a/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer.cc
@@ -6,7 +6,6 @@
 
 #include <memory>
 
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
 #include "chrome/browser/predictors/loading_predictor.h"
 #include "chrome/browser/predictors/loading_predictor_factory.h"
@@ -39,7 +38,7 @@
       Profile::FromBrowserContext(web_contents->GetBrowserContext()));
   if (!loading_predictor)
     return nullptr;
-  return base::MakeUnique<LoadingPredictorPageLoadMetricsObserver>(
+  return std::make_unique<LoadingPredictorPageLoadMetricsObserver>(
       loading_predictor->resource_prefetch_predictor(),
       loading_predictor->loading_data_collector(), web_contents);
 }
diff --git a/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer_unittest.cc
index 363a34b..5bd9307 100644
--- a/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/loading_predictor_page_load_metrics_observer_unittest.cc
@@ -6,7 +6,6 @@
 
 #include <memory>
 
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
 #include "chrome/browser/predictors/loading_data_collector.h"
@@ -42,14 +41,14 @@
     predictors::LoadingPredictorConfig config;
     config.mode = predictors::LoadingPredictorConfig::LEARNING;
     predictor_ =
-        base::MakeUnique<testing::StrictMock<MockResourcePrefetchPredictor>>(
+        std::make_unique<testing::StrictMock<MockResourcePrefetchPredictor>>(
             config, profile());
     // The base class of MockResourcePrefetchPredictor constructs the
     // PredictorDatabase for the profile. The PredictorDatabase is initialized
     // asynchronously and we have to wait for the initialization completion.
     content::RunAllTasksUntilIdle();
     page_load_metrics::InitPageLoadTimingForTest(&timing_);
-    collector_ = base::MakeUnique<LoadingDataCollector>(predictor_.get(),
+    collector_ = std::make_unique<LoadingDataCollector>(predictor_.get(),
                                                         nullptr, config);
     timing_.navigation_start = base::Time::FromDoubleT(1);
     timing_.paint_timing->first_paint = base::TimeDelta::FromSeconds(2);
@@ -62,7 +61,7 @@
 
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<LoadingPredictorPageLoadMetricsObserver>(
+        std::make_unique<LoadingPredictorPageLoadMetricsObserver>(
             predictor_.get(), collector_.get(), web_contents()));
   }
 
diff --git a/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer.cc
index 4c700cf..48cfdae8 100644
--- a/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer.cc
@@ -5,7 +5,6 @@
 #include "chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer.h"
 
 #include "base/lazy_instance.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/page_load_metrics/page_load_metrics_util.h"
@@ -520,7 +519,7 @@
   }
 
   requested_resource_types_ =
-      base::MakeUnique<std::map<net::IPAddress, internal::ResourceType>>();
+      std::make_unique<std::map<net::IPAddress, internal::ResourceType>>();
   for (const auto& entry : resource_request_counts_) {
     requested_resource_types_->insert(
         {entry.first, DetermineResourceType(entry.first)});
diff --git a/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer_unittest.cc
index 0a7928c..fe41bbc 100644
--- a/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/local_network_requests_page_load_metrics_observer_unittest.cc
@@ -6,7 +6,6 @@
 
 #include <vector>
 
-#include "base/memory/ptr_util.h"
 #include "base/test/histogram_tester.h"
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h"
@@ -80,7 +79,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<LocalNetworkRequestsPageLoadMetricsObserver>());
+        std::make_unique<LocalNetworkRequestsPageLoadMetricsObserver>());
   }
 
   void SetUp() override {
diff --git a/chrome/browser/page_load_metrics/observers/lofi_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/lofi_page_load_metrics_observer_unittest.cc
index 9b5add1..205506b 100644
--- a/chrome/browser/page_load_metrics/observers/lofi_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/lofi_page_load_metrics_observer_unittest.cc
@@ -6,6 +6,8 @@
 
 #include <stdint.h>
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/optional.h"
 #include "base/time/time.h"
@@ -114,7 +116,7 @@
 
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<LoFiPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<LoFiPageLoadMetricsObserver>());
   }
 
   page_load_metrics::mojom::PageLoadTiming timing_;
@@ -128,7 +130,7 @@
   RunTest();
 
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
 
   // Prepare 4 resources of varying size and configurations, none of which have
@@ -192,7 +194,7 @@
   RunTest();
 
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_client_lofi_requested(true);
 
   // Prepare 4 resources of varying size and configurations, 2 of which have
@@ -256,7 +258,7 @@
   RunTest();
 
   std::unique_ptr<DataReductionProxyData> data =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_lofi_received(true);
 
@@ -321,12 +323,12 @@
   RunTest();
 
   std::unique_ptr<DataReductionProxyData> data1 =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data1->set_used_data_reduction_proxy(true);
   data1->set_lofi_received(true);
 
   std::unique_ptr<DataReductionProxyData> data2 =
-      base::MakeUnique<DataReductionProxyData>();
+      std::make_unique<DataReductionProxyData>();
   data2->set_used_data_reduction_proxy(true);
   data2->set_client_lofi_requested(true);
 
diff --git a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc
index 7fa9ede..4982ed8 100644
--- a/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/media_page_load_metrics_observer_unittest.cc
@@ -7,7 +7,6 @@
 #include <memory>
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/test/histogram_tester.h"
 #include "base/time/time.h"
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
@@ -107,7 +106,7 @@
 
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<MediaPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<MediaPageLoadMetricsObserver>());
   }
 
   // Simulated byte usage since the last time the test was reset.
diff --git a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
index 0e1707ed..4c6cea2 100644
--- a/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/multi_tab_loading_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "base/optional.h"
 #include "chrome/browser/page_load_metrics/observers/histogram_suffixes.h"
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
@@ -75,7 +76,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<TestMultiTabLoadingPageLoadMetricsObserver>(
+        std::make_unique<TestMultiTabLoadingPageLoadMetricsObserver>(
             number_of_tabs_with_inflight_load_.value()));
   }
 
diff --git a/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.cc
index 57e2799c..140c6f1b 100644
--- a/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/no_state_prefetch_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/prerender/prerender_manager.h"
 #include "chrome/browser/prerender/prerender_manager_factory.h"
 #include "content/public/browser/navigation_handle.h"
@@ -20,7 +21,7 @@
           web_contents->GetBrowserContext());
   if (!manager)
     return nullptr;
-  return base::MakeUnique<NoStatePrefetchPageLoadMetricsObserver>(manager);
+  return std::make_unique<NoStatePrefetchPageLoadMetricsObserver>(manager);
 }
 
 NoStatePrefetchPageLoadMetricsObserver::NoStatePrefetchPageLoadMetricsObserver(
diff --git a/chrome/browser/page_load_metrics/observers/noscript_preview_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/noscript_preview_page_load_metrics_observer_unittest.cc
index 9de2842..2b04cc50 100644
--- a/chrome/browser/page_load_metrics/observers/noscript_preview_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/noscript_preview_page_load_metrics_observer_unittest.cc
@@ -127,7 +127,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<NoScriptPreviewPageLoadMetricsObserver>());
+        std::make_unique<NoScriptPreviewPageLoadMetricsObserver>());
   }
 
   page_load_metrics::mojom::PageLoadTiming timing_;
diff --git a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
index 8b31ced3..37a0f11 100644
--- a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
+++ b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.cc
@@ -8,7 +8,6 @@
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
-#include "base/memory/ptr_util.h"
 #include "chrome/test/base/testing_browser_process.h"
 #include "components/ukm/content/source_url_recorder.h"
 #include "content/public/browser/global_request_id.h"
@@ -34,7 +33,7 @@
   // Page load metrics depends on UKM source URLs being recorded, so make sure
   // the SourceUrlRecorderWebContentsObserver is instantiated.
   ukm::InitializeSourceUrlRecorderForWebContents(web_contents());
-  tester_ = base::MakeUnique<PageLoadMetricsObserverTester>(
+  tester_ = std::make_unique<PageLoadMetricsObserverTester>(
       web_contents(),
       base::BindRepeating(
           &PageLoadMetricsObserverTestHarness::RegisterObservers,
diff --git a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_tester.cc b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_tester.cc
index a983f23..fdbe55a2 100644
--- a/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_tester.cc
+++ b/chrome/browser/page_load_metrics/observers/page_load_metrics_observer_tester.cc
@@ -8,7 +8,6 @@
 #include <string>
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
@@ -42,7 +41,7 @@
   }
 
   std::unique_ptr<base::Timer> CreateTimer() override {
-    auto timer = base::MakeUnique<test::WeakMockTimer>();
+    auto timer = std::make_unique<test::WeakMockTimer>();
     test_->SetMockTimer(timer->AsWeakPtr());
     return std::move(timer);
   }
@@ -62,7 +61,7 @@
       web_contents_(web_contents),
       observer_(MetricsWebContentsObserver::CreateForWebContents(
           web_contents,
-          base::MakeUnique<TestPageLoadMetricsEmbedderInterface>(this))) {}
+          std::make_unique<TestPageLoadMetricsEmbedderInterface>(this))) {}
 
 PageLoadMetricsObserverTester::~PageLoadMetricsObserverTester() {}
 
diff --git a/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.cc
index 24ae87e..cccf701 100644
--- a/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.cc
@@ -4,8 +4,9 @@
 
 #include "chrome/browser/page_load_metrics/observers/prerender_page_load_metrics_observer.h"
 
+#include <memory>
+
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/prerender/prerender_manager.h"
 #include "chrome/browser/prerender/prerender_manager_factory.h"
 #include "content/public/browser/web_contents.h"
@@ -24,7 +25,7 @@
   if (manager->PageLoadMetricsObserverDisabledForTesting())
     return nullptr;
 
-  return base::MakeUnique<PrerenderPageLoadMetricsObserver>(manager,
+  return std::make_unique<PrerenderPageLoadMetricsObserver>(manager,
                                                             web_contents);
 }
 
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
index 86fc1c5..5e792971 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/previews_ukm_observer.h"
 
+#include <memory>
+
 #include "base/macros.h"
 #include "base/metrics/metrics_hashes.h"
 #include "base/optional.h"
@@ -132,7 +134,7 @@
 
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<TestPreviewsUKMObserver>(
+    tracker->AddObserver(std::make_unique<TestPreviewsUKMObserver>(
         web_contents(), data_reduction_proxy_used_, lite_page_received_,
         noscript_on_));
     // Data is only added to the first navigation after RunTest().
@@ -225,7 +227,7 @@
           false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data->set_client_lofi_requested(true);
 
   // Prepare 3 resources of varying size and configurations, 2 of which have
@@ -260,7 +262,7 @@
           false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data->set_client_lofi_requested(true);
 
   // Prepare 3 resources of varying size and configurations, 2 of which have
@@ -296,7 +298,7 @@
           false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_lofi_received(true);
 
@@ -331,7 +333,7 @@
           false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data->set_used_data_reduction_proxy(true);
   data->set_lofi_received(true);
 
@@ -368,12 +370,12 @@
           false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data1 =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data1->set_used_data_reduction_proxy(true);
   data1->set_lofi_received(true);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data2 =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data2->set_used_data_reduction_proxy(true);
   data2->set_client_lofi_requested(true);
 
@@ -408,12 +410,12 @@
           false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data1 =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data1->set_used_data_reduction_proxy(true);
   data1->set_lofi_received(true);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data2 =
-      base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
+      std::make_unique<data_reduction_proxy::DataReductionProxyData>();
   data2->set_used_data_reduction_proxy(true);
   data2->set_client_lofi_requested(true);
 
diff --git a/chrome/browser/page_load_metrics/observers/protocol_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/protocol_page_load_metrics_observer_unittest.cc
index a025733..6e2790c9 100644
--- a/chrome/browser/page_load_metrics/observers/protocol_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/protocol_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/protocol_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
 #include "chrome/common/page_load_metrics/test/page_load_metrics_test_util.h"
@@ -14,7 +15,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     std::unique_ptr<ProtocolPageLoadMetricsObserver> observer =
-        base::MakeUnique<ProtocolPageLoadMetricsObserver>();
+        std::make_unique<ProtocolPageLoadMetricsObserver>();
     observer_ = observer.get();
     tracker->AddObserver(std::move(observer));
   }
diff --git a/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
index 50b5a0d..f5d3d82 100644
--- a/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/service_worker_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
 #include "chrome/common/page_load_metrics/test/page_load_metrics_test_util.h"
@@ -23,7 +24,7 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<ServiceWorkerPageLoadMetricsObserver>());
+        std::make_unique<ServiceWorkerPageLoadMetricsObserver>());
   }
 
   void SimulateTimingWithoutPaint() {
diff --git a/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc
index 8012407..ad082ae 100644
--- a/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/session_restore_page_load_metrics_observer_unittest.cc
@@ -44,7 +44,7 @@
  public:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(
-        base::MakeUnique<SessionRestorePageLoadMetricsObserver>());
+        std::make_unique<SessionRestorePageLoadMetricsObserver>());
   }
 
  protected:
@@ -88,7 +88,7 @@
     tabs_.emplace_back(CreateTestWebContents());
     WebContents* contents = tabs_.back().get();
     auto tester =
-        base::MakeUnique<page_load_metrics::PageLoadMetricsObserverTester>(
+        std::make_unique<page_load_metrics::PageLoadMetricsObserverTester>(
             contents,
             base::BindRepeating(
                 &SessionRestorePageLoadMetricsObserverTest::RegisterObservers,
diff --git a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc
index 0191f0b..ab724f1 100644
--- a/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/subresource_filter_metrics_observer_unittest.cc
@@ -6,7 +6,6 @@
 
 #include <memory>
 
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
 #include "chrome/common/page_load_metrics/test/page_load_metrics_test_util.h"
@@ -41,7 +40,7 @@
   }
 
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<SubresourceFilterMetricsObserver>());
+    tracker->AddObserver(std::make_unique<SubresourceFilterMetricsObserver>());
   }
 
   size_t TotalMetricsRecorded() {
diff --git a/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.cc
index 035d32d..113c6df7 100644
--- a/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.h"
 
+#include <memory>
+
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h"
 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.h"
@@ -63,7 +65,7 @@
   if (!ukm::UkmRecorder::Get()) {
     return nullptr;
   }
-  return base::MakeUnique<UkmPageLoadMetricsObserver>(
+  return std::make_unique<UkmPageLoadMetricsObserver>(
       GetNQEService(web_contents));
 }
 
diff --git a/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer_unittest.cc
index 2600958f..6b56a70f 100644
--- a/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/page_load_metrics/observers/ukm_page_load_metrics_observer.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "base/metrics/metrics_hashes.h"
 #include "base/optional.h"
 #include "base/time/time.h"
@@ -43,7 +44,7 @@
     : public page_load_metrics::PageLoadMetricsObserverTestHarness {
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<UkmPageLoadMetricsObserver>(
+    tracker->AddObserver(std::make_unique<UkmPageLoadMetricsObserver>(
         &mock_network_quality_provider_));
   }
 
diff --git a/chrome/browser/page_load_metrics/observers/use_counter_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/use_counter_page_load_metrics_observer_unittest.cc
index d20e198..262fabc 100644
--- a/chrome/browser/page_load_metrics/observers/use_counter_page_load_metrics_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/use_counter_page_load_metrics_observer_unittest.cc
@@ -4,9 +4,9 @@
 
 #include "chrome/browser/page_load_metrics/observers/use_counter_page_load_metrics_observer.h"
 
+#include <memory>
 #include <vector>
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_base.h"
 #include "base/test/histogram_tester.h"
 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
@@ -56,7 +56,7 @@
 
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
-    tracker->AddObserver(base::MakeUnique<UseCounterPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<UseCounterPageLoadMetricsObserver>());
   }
 
  private:
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
index 7a3c03a..997286a 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -13,7 +13,6 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/weak_ptr.h"
 #include "base/path_service.h"
 #include "base/run_loop.h"
@@ -87,7 +86,7 @@
       getter->GetURLRequestContext()->http_transaction_factory()->GetCache());
   DCHECK(cache);
   std::unique_ptr<net::FailingHttpTransactionFactory> factory =
-      base::MakeUnique<net::FailingHttpTransactionFactory>(cache->GetSession(),
+      std::make_unique<net::FailingHttpTransactionFactory>(cache->GetSession(),
                                                            net::ERR_FAILED);
   // Throw away old version; since this is a browser test, there is no
   // need to restore the old state.
@@ -149,7 +148,7 @@
     if (expectations_satisfied())
       return;
 
-    run_loop_ = base::MakeUnique<base::RunLoop>();
+    run_loop_ = std::make_unique<base::RunLoop>();
     run_loop_->Run();
     run_loop_ = nullptr;
 
@@ -304,7 +303,7 @@
     // load.
     ASSERT_FALSE(did_add_observer_);
     tracker->AddObserver(
-        base::MakeUnique<WaiterMetricsObserver>(weak_factory_.GetWeakPtr()));
+        std::make_unique<WaiterMetricsObserver>(weak_factory_.GetWeakPtr()));
     did_add_observer_ = true;
   }
 
@@ -315,7 +314,7 @@
     // load.
     ASSERT_FALSE(did_add_observer_);
     tracker->AddObserver(
-        base::MakeUnique<WaiterMetricsObserver>(weak_factory_.GetWeakPtr()));
+        std::make_unique<WaiterMetricsObserver>(weak_factory_.GetWeakPtr()));
     did_add_observer_ = true;
   }
 
@@ -354,7 +353,7 @@
   void PreRunTestOnMainThread() override {
     InProcessBrowserTest::PreRunTestOnMainThread();
 
-    test_ukm_recorder_ = base::MakeUnique<ukm::TestAutoSetUkmRecorder>();
+    test_ukm_recorder_ = std::make_unique<ukm::TestAutoSetUkmRecorder>();
   }
 
   // Force navigation to a new page, so the currently tracked page load runs its
@@ -390,7 +389,7 @@
   std::unique_ptr<PageLoadMetricsWaiter> CreatePageLoadMetricsWaiter() {
     content::WebContents* web_contents =
         browser()->tab_strip_model()->GetActiveWebContents();
-    return base::MakeUnique<PageLoadMetricsWaiter>(web_contents);
+    return std::make_unique<PageLoadMetricsWaiter>(web_contents);
   }
 
   base::test::ScopedFeatureList scoped_feature_list_;
@@ -463,7 +462,7 @@
   params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB;
 
   Navigate(&params);
-  auto waiter = base::MakeUnique<PageLoadMetricsWaiter>(params.target_contents);
+  auto waiter = std::make_unique<PageLoadMetricsWaiter>(params.target_contents);
   waiter->AddPageExpectation(TimingField::LOAD_EVENT);
   waiter->Wait();
 
@@ -1427,7 +1426,7 @@
   // SessionRestoreObserver implementation:
   void OnWillRestoreTab(content::WebContents* contents) override {
     chrome::InitializePageLoadMetricsForWebContents(contents);
-    auto waiter = base::MakeUnique<PageLoadMetricsWaiter>(contents);
+    auto waiter = std::make_unique<PageLoadMetricsWaiter>(contents);
     waiter->AddPageExpectation(TimingField::FIRST_PAINT);
     waiter->AddPageExpectation(TimingField::FIRST_CONTENTFUL_PAINT);
     waiter->AddPageExpectation(TimingField::FIRST_MEANINGFUL_PAINT);
@@ -1539,7 +1538,7 @@
   NavigateToUntrackedUrl();
   Browser* new_browser = QuitBrowserAndRestore(browser());
 
-  auto waiter = base::MakeUnique<PageLoadMetricsWaiter>(
+  auto waiter = std::make_unique<PageLoadMetricsWaiter>(
       new_browser->tab_strip_model()->GetActiveWebContents());
   waiter->AddPageExpectation(TimingField::FIRST_MEANINGFUL_PAINT);
   ui_test_utils::NavigateToURL(new_browser, GetTestURL());
@@ -1564,7 +1563,7 @@
   }
 
   // Load a new page after session restore.
-  auto waiter = base::MakeUnique<PageLoadMetricsWaiter>(
+  auto waiter = std::make_unique<PageLoadMetricsWaiter>(
       new_browser->tab_strip_model()->GetActiveWebContents());
   waiter->AddPageExpectation(TimingField::FIRST_MEANINGFUL_PAINT);
   ui_test_utils::NavigateToURL(new_browser, GetTestURL());
@@ -1688,7 +1687,7 @@
   // Set up the restore data: one window with two tabs.
   std::vector<const sessions::SessionWindow*> session;
   sessions::SessionWindow window;
-  auto tab1 = base::MakeUnique<sessions::SessionTab>();
+  auto tab1 = std::make_unique<sessions::SessionTab>();
   {
     sync_pb::SessionTab sync_data;
     sync_data.set_tab_visual_index(0);
@@ -1699,7 +1698,7 @@
   }
   window.tabs.push_back(std::move(tab1));
 
-  auto tab2 = base::MakeUnique<sessions::SessionTab>();
+  auto tab2 = std::make_unique<sessions::SessionTab>();
   {
     sync_pb::SessionTab sync_data;
     sync_data.set_tab_visual_index(1);
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc b/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc
index 6472f34..07bab44 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_initialize.cc
@@ -8,7 +8,6 @@
 #include <utility>
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/timer/timer.h"
 #include "build/build_config.h"
 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
@@ -87,38 +86,38 @@
 void PageLoadMetricsEmbedder::RegisterObservers(
     page_load_metrics::PageLoadTracker* tracker) {
   if (!IsPrerendering()) {
-    tracker->AddObserver(base::MakeUnique<AbortsPageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<AMPPageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<CorePageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<AbortsPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<AMPPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<CorePageLoadMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<
+        std::make_unique<
             data_reduction_proxy::DataReductionProxyMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<data_reduction_proxy::LoFiPageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<FromGWSPageLoadMetricsObserver>());
+        std::make_unique<data_reduction_proxy::LoFiPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<FromGWSPageLoadMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<google_captcha_observer::GoogleCaptchaObserver>());
+        std::make_unique<google_captcha_observer::GoogleCaptchaObserver>());
     tracker->AddObserver(
-        base::MakeUnique<DocumentWritePageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<MediaPageLoadMetricsObserver>());
+        std::make_unique<DocumentWritePageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<MediaPageLoadMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<MultiTabLoadingPageLoadMetricsObserver>());
+        std::make_unique<MultiTabLoadingPageLoadMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<previews::NoScriptPreviewPageLoadMetricsObserver>());
+        std::make_unique<previews::NoScriptPreviewPageLoadMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<
+        std::make_unique<
             previews::OfflinePagePreviewsPageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<previews::PreviewsUKMObserver>());
+    tracker->AddObserver(std::make_unique<previews::PreviewsUKMObserver>());
     tracker->AddObserver(
-        base::MakeUnique<ServiceWorkerPageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<SubresourceFilterMetricsObserver>());
+        std::make_unique<ServiceWorkerPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<SubresourceFilterMetricsObserver>());
     tracker->AddObserver(
-        base::MakeUnique<HttpsEngagementPageLoadMetricsObserver>(
+        std::make_unique<HttpsEngagementPageLoadMetricsObserver>(
             web_contents_->GetBrowserContext()));
-    tracker->AddObserver(base::MakeUnique<CssScanningMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<ProtocolPageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<TabRestorePageLoadMetricsObserver>());
-    tracker->AddObserver(base::MakeUnique<UseCounterPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<CssScanningMetricsObserver>());
+    tracker->AddObserver(std::make_unique<ProtocolPageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<TabRestorePageLoadMetricsObserver>());
+    tracker->AddObserver(std::make_unique<UseCounterPageLoadMetricsObserver>());
     std::unique_ptr<AdsPageLoadMetricsObserver> ads_observer =
         AdsPageLoadMetricsObserver::CreateIfNeeded();
     if (ads_observer)
@@ -137,7 +136,7 @@
       tracker->AddObserver(std::move(no_state_prefetch_observer));
 #if defined(OS_ANDROID)
     tracker->AddObserver(
-        base::MakeUnique<AndroidPageLoadMetricsObserver>(web_contents_));
+        std::make_unique<AndroidPageLoadMetricsObserver>(web_contents_));
 #endif  // OS_ANDROID
     std::unique_ptr<page_load_metrics::PageLoadMetricsObserver>
         loading_predictor_observer =
@@ -147,10 +146,10 @@
       tracker->AddObserver(std::move(loading_predictor_observer));
 #if !defined(OS_ANDROID)
     tracker->AddObserver(
-        base::MakeUnique<SessionRestorePageLoadMetricsObserver>());
+        std::make_unique<SessionRestorePageLoadMetricsObserver>());
 #endif
     tracker->AddObserver(
-        base::MakeUnique<LocalNetworkRequestsPageLoadMetricsObserver>());
+        std::make_unique<LocalNetworkRequestsPageLoadMetricsObserver>());
   } else {
     std::unique_ptr<page_load_metrics::PageLoadMetricsObserver>
         prerender_observer =
@@ -159,9 +158,9 @@
       tracker->AddObserver(std::move(prerender_observer));
   }
   tracker->AddObserver(
-      base::MakeUnique<OmniboxSuggestionUsedMetricsObserver>(IsPrerendering()));
+      std::make_unique<OmniboxSuggestionUsedMetricsObserver>(IsPrerendering()));
   tracker->AddObserver(
-      base::MakeUnique<DelayNavigationPageLoadMetricsObserver>());
+      std::make_unique<DelayNavigationPageLoadMetricsObserver>());
 }
 
 bool PageLoadMetricsEmbedder::IsPrerendering() const {
@@ -170,7 +169,7 @@
 }
 
 std::unique_ptr<base::Timer> PageLoadMetricsEmbedder::CreateTimer() {
-  return base::MakeUnique<base::OneShotTimer>();
+  return std::make_unique<base::OneShotTimer>();
 }
 
 bool PageLoadMetricsEmbedder::IsNewTabPageUrl(const GURL& url) {
@@ -186,7 +185,7 @@
 void InitializePageLoadMetricsForWebContents(
     content::WebContents* web_contents) {
   page_load_metrics::MetricsWebContentsObserver::CreateForWebContents(
-      web_contents, base::MakeUnique<PageLoadMetricsEmbedder>(web_contents));
+      web_contents, std::make_unique<PageLoadMetricsEmbedder>(web_contents));
 }
 
 }  // namespace chrome
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_observer.cc b/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
index c1fe146..69f7ffe 100644
--- a/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
+++ b/chrome/browser/page_load_metrics/page_load_metrics_observer.cc
@@ -97,7 +97,7 @@
       net_error(other.net_error),
       load_timing_info(other.load_timing_info == nullptr
                            ? nullptr
-                           : base::MakeUnique<net::LoadTimingInfo>(
+                           : std::make_unique<net::LoadTimingInfo>(
                                  *other.load_timing_info)) {}
 
 ExtraRequestCompleteInfo::~ExtraRequestCompleteInfo() {}
diff --git a/chrome/browser/password_manager/account_chooser_dialog_android.cc b/chrome/browser/password_manager/account_chooser_dialog_android.cc
index 12d67b4..8c04ec61 100644
--- a/chrome/browser/password_manager/account_chooser_dialog_android.cc
+++ b/chrome/browser/password_manager/account_chooser_dialog_android.cc
@@ -92,7 +92,7 @@
 void FetchAvatar(const base::android::ScopedJavaGlobalRef<jobject>& java_dialog,
                  const autofill::PasswordForm* password_form,
                  int index,
-                 content::mojom::URLLoaderFactory* loader_factory) {
+                 network::mojom::URLLoaderFactory* loader_factory) {
   if (!password_form->icon_url.is_valid())
     return;
   // Fetcher deletes itself once fetching is finished.
@@ -149,7 +149,7 @@
       title_link_range.start(), title_link_range.end(),
       base::android::ConvertUTF8ToJavaString(env, origin),
       base::android::ConvertUTF16ToJavaString(env, signin_button)));
-  content::mojom::URLLoaderFactory* loader_factory =
+  network::mojom::URLLoaderFactory* loader_factory =
       content::BrowserContext::GetDefaultStoragePartition(
           Profile::FromBrowserContext(web_contents_->GetBrowserContext()))
           ->GetURLLoaderFactoryForBrowserProcess();
diff --git a/chrome/browser/password_manager/credential_manager_browsertest.cc b/chrome/browser/password_manager/credential_manager_browsertest.cc
index b1b3026b..28f3179a 100644
--- a/chrome/browser/password_manager/credential_manager_browsertest.cc
+++ b/chrome/browser/password_manager/credential_manager_browsertest.cc
@@ -87,7 +87,7 @@
     std::string script =
         "navigator.credentials.create({ publicKey: {"
         "  challenge: new TextEncoder().encode('climb a mountain'),"
-        "  rp: { id: '1098237235409872', name: 'Acme' },"
+        "  rp: { id: 'example.com', name: 'Acme' },"
         "  user: { "
         "    id: new TextEncoder().encode('1098237235409872'),"
         "    name: 'avery.a.jones@example.com',"
@@ -104,6 +104,53 @@
         result);
   }
 
+  // Attempt to create a publicKeyCredential.
+  void CreatePublicKeyCredentialWithUnsupportedAlgorithmAndExpectNotAllowed(
+      content::WebContents* web_contents) {
+    std::string result;
+    std::string script =
+        "navigator.credentials.create({ publicKey: {"
+        "  challenge: new TextEncoder().encode('climb a mountain'),"
+        "  rp: { id: 'a.example.com', name: 'Acme' },"
+        "  user: { "
+        "    id: new TextEncoder().encode('1098237235409872'),"
+        "    name: 'avery.a.jones@example.com',"
+        "    displayName: 'Avery A. Jones', "
+        "    icon: 'https://pics.acme.com/00/p/aBjjjpqPb.png'},"
+        "  pubKeyCredParams: [{ type: 'public-key', alg: '-7'}],"
+        "  timeout: 60000,"
+        "  excludeList: [] }"
+        "}).catch(c => window.domAutomationController.send(c.toString()));";
+    ASSERT_TRUE(
+        content::ExecuteScriptAndExtractString(web_contents, script, &result));
+    ASSERT_EQ("NotAllowedError: The operation is not allowed.", result);
+  }
+
+  // Attempt to create a publicKeyCredential with an invalid relying party.
+  void CreatePublicKeyCredentialWithUnsupportedAlgorithmAndExpectInvalidRpId(
+      content::WebContents* web_contents) {
+    std::string result;
+    std::string script =
+        "navigator.credentials.create({ publicKey: {"
+        "  challenge: new TextEncoder().encode('climb a mountain'),"
+        "  rp: { id: 'localhost', name: 'Acme' },"
+        "  user: { "
+        "    id: new TextEncoder().encode('1098237235409872'),"
+        "    name: 'avery.a.jones@example.com',"
+        "    displayName: 'Avery A. Jones', "
+        "    icon: 'https://pics.acme.com/00/p/aBjjjpqPb.png'},"
+        "  pubKeyCredParams: [{ type: 'public-key', alg: '-7'}],"
+        "  timeout: 60000,"
+        "  excludeList: [] }"
+        "}).catch(c => window.domAutomationController.send(c.toString()));";
+    ASSERT_TRUE(
+        content::ExecuteScriptAndExtractString(web_contents, script, &result));
+    ASSERT_EQ(
+        "SecurityError: The relying party ID 'localhost' is not a registrable "
+        "domain suffix of, nor equal to 'https://www.example.com",
+        result.substr(0, 124));
+  }
+
   // Schedules a call to be made to navigator.credentials.store() in the
   // `unload` handler to save a credential with |username| and |password|.
   void ScheduleNavigatorStoreCredentialAtUnload(
@@ -1014,8 +1061,8 @@
 // algorithm, we get a NotSupportedError.
 IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest,
                        CreatePublicKeyCredentialAlgorithmNotSupported) {
-  const GURL a_url1 = https_test_server().GetURL("a.com", "/title1.html");
-
+  const GURL a_url1 =
+      https_test_server().GetURL("www.example.com", "/title1.html");
   // Navigate to a mostly empty page.
   ui_test_utils::NavigateToURL(browser(), a_url1);
 
@@ -1024,4 +1071,16 @@
           WebContents()));
 }
 
+// Tests that when navigator.credentials.create() is called with an invalid
+// relying party id, we get a SecurityError
+IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest,
+                       CreatePublicKeyCredentialInvalidRp) {
+  const GURL a_url1 =
+      https_test_server().GetURL("www.example.com", "/title1.html");
+  ui_test_utils::NavigateToURL(browser(), a_url1);
+  ASSERT_NO_FATAL_FAILURE(
+      CreatePublicKeyCredentialWithUnsupportedAlgorithmAndExpectInvalidRpId(
+          WebContents()));
+}
+
 }  // namespace
diff --git a/chrome/browser/password_manager/native_backend_libsecret.cc b/chrome/browser/password_manager/native_backend_libsecret.cc
index 15be5000..7b16f97 100644
--- a/chrome/browser/password_manager/native_backend_libsecret.cc
+++ b/chrome/browser/password_manager/native_backend_libsecret.cc
@@ -321,23 +321,14 @@
   attrs.Append("signon_realm", lookup_form.signon_realm);
   attrs.Append("application", app_string_);
 
-  GError* error = nullptr;
-  GList* found = LibsecretLoader::secret_service_search_sync(
-      nullptr,  // default secret service
-      &kLibsecretSchema, attrs.Get(),
-      static_cast<SecretSearchFlags>(SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK),
-      nullptr,  // no cancellable ojbect
-      &error);
-  if (error) {
-    LOG(ERROR) << "Unable to get logins " << error->message;
-    g_error_free(error);
-    if (found)
-      g_list_free(found);
+  LibsecretLoader::SearchHelper helper;
+  helper.Search(&kLibsecretSchema, attrs.Get(),
+                SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK);
+  if (!helper.success())
     return false;
-  }
 
   PasswordStore::FormDigest form(lookup_form);
-  *forms = ConvertFormList(found, &form);
+  *forms = ConvertFormList(helper.results(), &form);
   return true;
 }
 
@@ -435,22 +426,13 @@
       lookup_form->scheme != PasswordForm::SCHEME_HTML)
     attrs.Append("signon_realm", lookup_form->signon_realm);
 
-  GError* error = nullptr;
-  GList* found = LibsecretLoader::secret_service_search_sync(
-      nullptr,  // default secret service
-      &kLibsecretSchema, attrs.Get(),
-      static_cast<SecretSearchFlags>(SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK),
-      nullptr,  // no cancellable ojbect
-      &error);
-  if (error) {
-    LOG(ERROR) << "Unable to get logins " << error->message;
-    g_error_free(error);
-    if (found)
-      g_list_free(found);
+  LibsecretLoader::SearchHelper helper;
+  helper.Search(&kLibsecretSchema, attrs.Get(),
+                SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK);
+  if (!helper.success())
     return false;
-  }
 
-  *forms = ConvertFormList(found, lookup_form);
+  *forms = ConvertFormList(helper.results(), lookup_form);
   if (lookup_form)
     return true;
 
@@ -582,6 +564,5 @@
                                   : password_manager::PSL_DOMAIN_MATCH_NOT_USED,
                               password_manager::PSL_DOMAIN_MATCH_COUNT);
   }
-  g_list_free(found);
   return forms;
 }
diff --git a/chrome/browser/password_manager/native_backend_libsecret_unittest.cc b/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
index dd04f67..7d0f7bc 100644
--- a/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
+++ b/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
@@ -87,8 +87,19 @@
 
 // The list of all libsecret items we have stored.
 std::vector<std::unique_ptr<MockSecretItem>>* global_mock_libsecret_items;
+std::unordered_map<GObject*, MockSecretItem*>* global_map_object_to_secret_item;
 bool global_mock_libsecret_reject_local_ids = false;
 
+GObject* MakeNewObject(MockSecretItem* item) {
+  // Create an object with a ref-count of 2. The caller is expected to release
+  // one reference, and the second reference is released during test tear down
+  // along with checks that the ref count is correct.
+  GObject* o = static_cast<GObject*>(g_object_new(G_TYPE_OBJECT, nullptr));
+  g_object_ref(o);
+  (*global_map_object_to_secret_item)[o] = item;
+  return o;
+}
+
 gboolean mock_secret_password_store_sync(const SecretSchema* schema,
                                          const gchar* collection,
                                          const gchar* label,
@@ -133,8 +144,9 @@
   EXPECT_TRUE(flags & SECRET_SEARCH_UNLOCK);
   GList* result = nullptr;
   for (std::unique_ptr<MockSecretItem>& item : *global_mock_libsecret_items) {
-    if (Matches(item.get(), attributes))
-      result = g_list_append(result, item.get());
+    if (Matches(item.get(), attributes)) {
+      result = g_list_append(result, MakeNewObject(item.get()));
+    }
   }
   return result;
 }
@@ -178,8 +190,9 @@
 }
 
 SecretValue* mock_secret_item_get_secret(SecretItem* self) {
+  GObject* o = reinterpret_cast<GObject*>(self);
   MockSecretValue* mock_value =
-      reinterpret_cast<MockSecretItem*>(self)->value.get();
+      (*global_map_object_to_secret_item)[o]->value.get();
   return reinterpret_cast<SecretValue*>(mock_value);
 }
 
@@ -190,7 +203,8 @@
 GHashTable* mock_secret_item_get_attributes(SecretItem* self) {
   // Libsecret backend will make unreference of received attributes, so in
   // order to save them we need to increase their reference number.
-  MockSecretItem* mock_ptr = reinterpret_cast<MockSecretItem*>(self);
+  GObject* o = reinterpret_cast<GObject*>(self);
+  MockSecretItem* mock_ptr = (*global_map_object_to_secret_item)[o];
   g_hash_table_ref(mock_ptr->attributes);
   return mock_ptr->attributes;
 }
@@ -219,6 +233,7 @@
     libsecret_loaded_ = true;
     // Reset the state of the mock library.
     global_mock_libsecret_items->clear();
+    global_map_object_to_secret_item->clear();
     global_mock_libsecret_reject_local_ids = false;
     return true;
   }
@@ -278,7 +293,9 @@
 
   void SetUp() override {
     ASSERT_FALSE(global_mock_libsecret_items);
+    ASSERT_FALSE(global_map_object_to_secret_item);
     global_mock_libsecret_items = &mock_libsecret_items_;
+    global_map_object_to_secret_item = &mock_map_object_to_secret_item_;
 
     ASSERT_TRUE(MockLibsecretLoader::LoadMockLibsecret());
 
@@ -341,6 +358,12 @@
     scoped_task_environment_.RunUntilIdle();
     ASSERT_TRUE(global_mock_libsecret_items);
     global_mock_libsecret_items = nullptr;
+    for (auto& pair : *global_map_object_to_secret_item) {
+      ASSERT_EQ(pair.first->ref_count, 1u);
+      g_object_unref(pair.first);
+    }
+    global_map_object_to_secret_item->clear();
+    global_map_object_to_secret_item = nullptr;
   }
 
   void CheckUint32Attribute(const MockSecretItem* item,
@@ -604,6 +627,7 @@
   PasswordForm other_auth_;
 
   std::vector<std::unique_ptr<MockSecretItem>> mock_libsecret_items_;
+  std::unordered_map<GObject*, MockSecretItem*> mock_map_object_to_secret_item_;
 };
 
 TEST_F(NativeBackendLibsecretTest, BasicAddLogin) {
diff --git a/chrome/browser/payments/chrome_payment_request_delegate.cc b/chrome/browser/payments/chrome_payment_request_delegate.cc
index 1d831503..2b3262a 100644
--- a/chrome/browser/payments/chrome_payment_request_delegate.cc
+++ b/chrome/browser/payments/chrome_payment_request_delegate.cc
@@ -174,7 +174,7 @@
   if (dialog_)
     dialog_->ShowPaymentHandlerScreen(url, std::move(callback));
   else
-    std::move(callback).Run(false);
+    std::move(callback).Run(false, 0, 0);
 }
 
 }  // namespace payments
diff --git a/chrome/browser/policy/chrome_browser_policy_connector.cc b/chrome/browser/policy/chrome_browser_policy_connector.cc
index f7368b7..089eb4a 100644
--- a/chrome/browser/policy/chrome_browser_policy_connector.cc
+++ b/chrome/browser/policy/chrome_browser_policy_connector.cc
@@ -63,10 +63,6 @@
 
 ChromeBrowserPolicyConnector::ChromeBrowserPolicyConnector()
     : BrowserPolicyConnector(base::Bind(&BuildHandlerList)) {
-  std::unique_ptr<ConfigurationPolicyProvider> platform_provider =
-      CreatePlatformProvider();
-  if (platform_provider)
-    SetPlatformPolicyProvider(std::move(platform_provider));
 }
 
 ChromeBrowserPolicyConnector::~ChromeBrowserPolicyConnector() {}
@@ -83,6 +79,23 @@
       kServiceInitializationStartupDelay);
 
   InitInternal(local_state, std::move(device_management_service));
+
+  std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers;
+  std::unique_ptr<ConfigurationPolicyProvider> platform_provider =
+      CreatePlatformProvider();
+  if (platform_provider) {
+    platform_provider_ = platform_provider.get();
+    providers.push_back(std::move(platform_provider));
+  }
+  BuildPolicyProviders(&providers);
+  SetPolicyProviders(std::move(providers));
+}
+
+ConfigurationPolicyProvider*
+ChromeBrowserPolicyConnector::GetPlatformProvider() {
+  ConfigurationPolicyProvider* provider =
+      BrowserPolicyConnectorBase::GetPolicyProviderForTesting();
+  return provider ? provider : platform_provider_;
 }
 
 std::unique_ptr<ConfigurationPolicyProvider>
@@ -121,4 +134,7 @@
 #endif
 }
 
+void ChromeBrowserPolicyConnector::BuildPolicyProviders(
+    std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers) {}
+
 }  // namespace policy
diff --git a/chrome/browser/policy/chrome_browser_policy_connector.h b/chrome/browser/policy/chrome_browser_policy_connector.h
index 5cc776f..19da2a9 100644
--- a/chrome/browser/policy/chrome_browser_policy_connector.h
+++ b/chrome/browser/policy/chrome_browser_policy_connector.h
@@ -8,6 +8,7 @@
 #include <stdint.h>
 
 #include <memory>
+#include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
@@ -41,9 +42,22 @@
       PrefService* local_state,
       scoped_refptr<net::URLRequestContextGetter> request_context) override;
 
+  ConfigurationPolicyProvider* GetPlatformProvider();
+
+ protected:
+  // Called from Init() to build the list of ConfigurationPolicyProviders that
+  // is supplied to SetPolicyProviders(). This implementation does nothing
+  // and is provided for subclasses. NOTE: |providers| may already contain
+  // some providers, generally subclasses should append.
+  virtual void BuildPolicyProviders(
+      std::vector<std::unique_ptr<ConfigurationPolicyProvider>>* providers);
+
  private:
   std::unique_ptr<ConfigurationPolicyProvider> CreatePlatformProvider();
 
+  // Owned by base class.
+  ConfigurationPolicyProvider* platform_provider_ = nullptr;
+
   DISALLOW_COPY_AND_ASSIGN(ChromeBrowserPolicyConnector);
 };
 
diff --git a/chrome/browser/policy/profile_policy_connector.cc b/chrome/browser/policy/profile_policy_connector.cc
index 613ce8d..1ca34ba 100644
--- a/chrome/browser/policy/profile_policy_connector.cc
+++ b/chrome/browser/policy/profile_policy_connector.cc
@@ -12,6 +12,7 @@
 #include "build/build_config.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+#include "components/policy/core/browser/browser_policy_connector.h"
 #include "components/policy/core/common/cloud/cloud_policy_core.h"
 #include "components/policy/core/common/cloud/cloud_policy_manager.h"
 #include "components/policy/core/common/cloud/cloud_policy_store.h"
@@ -103,7 +104,10 @@
   }
 #endif
 
-  policy_service_.reset(new PolicyServiceImpl(policy_providers_));
+  std::unique_ptr<PolicyServiceImpl> policy_service =
+      std::make_unique<PolicyServiceImpl>();
+  policy_service->SetProviders(policy_providers_);
+  policy_service_ = std::move(policy_service);
 
 #if defined(OS_CHROMEOS)
   if (is_primary_user_) {
diff --git a/chrome/browser/policy/profile_policy_connector_factory.cc b/chrome/browser/policy/profile_policy_connector_factory.cc
index 2cb5bef..e96938c 100644
--- a/chrome/browser/policy/profile_policy_connector_factory.cc
+++ b/chrome/browser/policy/profile_policy_connector_factory.cc
@@ -153,7 +153,9 @@
     PolicyServiceImpl::Providers providers;
     providers.push_back(test_providers_.front());
     test_providers_.pop_front();
-    std::unique_ptr<PolicyService> service(new PolicyServiceImpl(providers));
+    std::unique_ptr<PolicyServiceImpl> service =
+        std::make_unique<PolicyServiceImpl>();
+    service->SetProviders(providers);
     connector->InitForTesting(std::move(service));
   }
 
diff --git a/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc
index 9e1d560..161fd08 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor_table_unittest.cc
@@ -77,7 +77,7 @@
 }
 
 void AutocompleteActionPredictorTableTest::SetUp() {
-  db_ = base::MakeUnique<PredictorDatabase>(
+  db_ = std::make_unique<PredictorDatabase>(
       &profile_, base::SequencedTaskRunnerHandle::Get());
   content::RunAllTasksUntilIdle();
 
diff --git a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
index ddde5ed3..da90cff 100644
--- a/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor_unittest.cc
@@ -92,9 +92,9 @@
 class AutocompleteActionPredictorTest : public testing::Test {
  public:
   AutocompleteActionPredictorTest()
-      : profile_(base::MakeUnique<TestingProfile>()), predictor_(nullptr) {
+      : profile_(std::make_unique<TestingProfile>()), predictor_(nullptr) {
     CHECK(profile_->CreateHistoryService(true, false));
-    predictor_ = base::MakeUnique<AutocompleteActionPredictor>(profile_.get());
+    predictor_ = std::make_unique<AutocompleteActionPredictor>(profile_.get());
     predictor_->CreateLocalCachesFromDatabase();
     profile_->BlockUntilHistoryProcessesPendingRequests();
     content::RunAllTasksUntilIdle();
diff --git a/chrome/browser/predictors/glowplug_key_value_data.h b/chrome/browser/predictors/glowplug_key_value_data.h
index 6abd994f2..17e2bde 100644
--- a/chrome/browser/predictors/glowplug_key_value_data.h
+++ b/chrome/browser/predictors/glowplug_key_value_data.h
@@ -13,7 +13,6 @@
 #include <vector>
 
 #include "base/location.h"
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "chrome/browser/predictors/glowplug_key_value_table.h"
 #include "chrome/browser/predictors/resource_prefetch_predictor_tables.h"
@@ -91,7 +90,7 @@
 template <typename T, typename Compare>
 void GlowplugKeyValueData<T, Compare>::InitializeOnDBSequence() {
   DCHECK(tables_->GetTaskRunner()->RunsTasksInCurrentSequence());
-  auto data_map = base::MakeUnique<std::map<std::string, T>>();
+  auto data_map = std::make_unique<std::map<std::string, T>>();
   tables_->ExecuteDBTaskOnDBSequence(
       base::BindOnce(&GlowplugKeyValueTable<T>::GetAllData,
                      base::Unretained(backend_table_), data_map.get()));
diff --git a/chrome/browser/predictors/loading_data_collector.cc b/chrome/browser/predictors/loading_data_collector.cc
index b3753a7..cc62b26 100644
--- a/chrome/browser/predictors/loading_data_collector.cc
+++ b/chrome/browser/predictors/loading_data_collector.cc
@@ -325,7 +325,7 @@
   const GURL& main_frame_url = request.navigation_id.main_frame_url;
   inflight_navigations_.emplace(
       request.navigation_id,
-      base::MakeUnique<PageRequestSummary>(main_frame_url));
+      std::make_unique<PageRequestSummary>(main_frame_url));
 }
 
 void LoadingDataCollector::RecordURLResponse(
@@ -422,7 +422,7 @@
 
   // If we lost the information about the first hop for some reason.
   if (!summary) {
-    summary = base::MakeUnique<PageRequestSummary>(main_frame_url);
+    summary = std::make_unique<PageRequestSummary>(main_frame_url);
   }
 
   // A redirect will not lead to another OnMainFrameRequest call, so record the
diff --git a/chrome/browser/predictors/loading_data_collector_unittest.cc b/chrome/browser/predictors/loading_data_collector_unittest.cc
index b70b842..3fd7773 100644
--- a/chrome/browser/predictors/loading_data_collector_unittest.cc
+++ b/chrome/browser/predictors/loading_data_collector_unittest.cc
@@ -27,13 +27,13 @@
 
 class LoadingDataCollectorTest : public testing::Test {
  public:
-  LoadingDataCollectorTest() : profile_(base::MakeUnique<TestingProfile>()) {
+  LoadingDataCollectorTest() : profile_(std::make_unique<TestingProfile>()) {
     LoadingPredictorConfig config;
     PopulateTestConfig(&config);
     mock_predictor_ =
-        base::MakeUnique<StrictMock<MockResourcePrefetchPredictor>>(
+        std::make_unique<StrictMock<MockResourcePrefetchPredictor>>(
             config, profile_.get()),
-    collector_ = base::MakeUnique<LoadingDataCollector>(mock_predictor_.get(),
+    collector_ = std::make_unique<LoadingDataCollector>(mock_predictor_.get(),
                                                         nullptr, config);
   }
 
diff --git a/chrome/browser/predictors/loading_predictor.cc b/chrome/browser/predictors/loading_predictor.cc
index 48b8c97..8cf2e52 100644
--- a/chrome/browser/predictors/loading_predictor.cc
+++ b/chrome/browser/predictors/loading_predictor.cc
@@ -7,7 +7,6 @@
 #include <algorithm>
 #include <vector>
 
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "chrome/browser/predictors/loading_data_collector.h"
 #include "chrome/browser/predictors/loading_stats_collector.h"
@@ -53,11 +52,11 @@
     : config_(config),
       profile_(profile),
       resource_prefetch_predictor_(
-          base::MakeUnique<ResourcePrefetchPredictor>(config, profile)),
-      stats_collector_(base::MakeUnique<LoadingStatsCollector>(
+          std::make_unique<ResourcePrefetchPredictor>(config, profile)),
+      stats_collector_(std::make_unique<LoadingStatsCollector>(
           resource_prefetch_predictor_.get(),
           config)),
-      loading_data_collector_(base::MakeUnique<LoadingDataCollector>(
+      loading_data_collector_(std::make_unique<LoadingDataCollector>(
           resource_prefetch_predictor_.get(),
           stats_collector_.get(),
           config)),
@@ -148,7 +147,7 @@
 
   if (!preconnect_manager_ &&
       config_.IsPreconnectEnabledForSomeOrigin(profile_)) {
-    preconnect_manager_ = base::MakeUnique<PreconnectManager>(
+    preconnect_manager_ = std::make_unique<PreconnectManager>(
         GetWeakPtr(), profile_->GetRequestContext());
   }
 
@@ -272,7 +271,7 @@
   if (prefetches_.find(host) != prefetches_.end())
     return;
 
-  auto prefetcher = base::MakeUnique<ResourcePrefetcher>(
+  auto prefetcher = std::make_unique<ResourcePrefetcher>(
       GetWeakPtr(), profile_->GetRequestContext(),
       config_.max_prefetches_inflight_per_navigation,
       config_.max_prefetches_inflight_per_host_per_navigation, url, urls);
diff --git a/chrome/browser/predictors/loading_predictor_unittest.cc b/chrome/browser/predictors/loading_predictor_unittest.cc
index e46ceeb..d106867f 100644
--- a/chrome/browser/predictors/loading_predictor_unittest.cc
+++ b/chrome/browser/predictors/loading_predictor_unittest.cc
@@ -81,15 +81,15 @@
 };
 
 LoadingPredictorTest::LoadingPredictorTest()
-    : profile_(base::MakeUnique<TestingProfile>()) {}
+    : profile_(std::make_unique<TestingProfile>()) {}
 
 LoadingPredictorTest::~LoadingPredictorTest() = default;
 
 void LoadingPredictorTest::SetUp() {
   auto config = CreateConfig();
-  predictor_ = base::MakeUnique<LoadingPredictor>(config, profile_.get());
+  predictor_ = std::make_unique<LoadingPredictor>(config, profile_.get());
 
-  auto mock = base::MakeUnique<StrictMock<MockResourcePrefetchPredictor>>(
+  auto mock = std::make_unique<StrictMock<MockResourcePrefetchPredictor>>(
       config, profile_.get());
   EXPECT_CALL(*mock, GetPrefetchData(GURL(kUrl), _))
       .WillRepeatedly(Return(true));
@@ -133,7 +133,7 @@
 void LoadingPredictorPreconnectTest::SetUp() {
   LoadingPredictorTest::SetUp();
   auto mock_preconnect_manager =
-      base::MakeUnique<StrictMock<MockPreconnectManager>>(
+      std::make_unique<StrictMock<MockPreconnectManager>>(
           predictor_->GetWeakPtr(), profile_->GetRequestContext());
   mock_preconnect_manager_ = mock_preconnect_manager.get();
   predictor_->set_mock_preconnect_manager(std::move(mock_preconnect_manager));
diff --git a/chrome/browser/predictors/loading_stats_collector_unittest.cc b/chrome/browser/predictors/loading_stats_collector_unittest.cc
index 3251c70482..d306b98 100644
--- a/chrome/browser/predictors/loading_stats_collector_unittest.cc
+++ b/chrome/browser/predictors/loading_stats_collector_unittest.cc
@@ -6,7 +6,6 @@
 
 #include <vector>
 
-#include "base/memory/ptr_util.h"
 #include "base/test/histogram_tester.h"
 #include "chrome/browser/predictors/loading_test_util.h"
 #include "chrome/browser/predictors/preconnect_manager.h"
@@ -54,19 +53,19 @@
 };
 
 LoadingStatsCollectorTest::LoadingStatsCollectorTest()
-    : profile_(base::MakeUnique<TestingProfile>()) {}
+    : profile_(std::make_unique<TestingProfile>()) {}
 
 LoadingStatsCollectorTest::~LoadingStatsCollectorTest() = default;
 
 void LoadingStatsCollectorTest::SetUp() {
   LoadingPredictorConfig config;
   PopulateTestConfig(&config);
-  profile_ = base::MakeUnique<TestingProfile>();
-  mock_predictor_ = base::MakeUnique<StrictMock<MockResourcePrefetchPredictor>>(
+  profile_ = std::make_unique<TestingProfile>();
+  mock_predictor_ = std::make_unique<StrictMock<MockResourcePrefetchPredictor>>(
       config, profile_.get());
   stats_collector_ =
-      base::MakeUnique<LoadingStatsCollector>(mock_predictor_.get(), config);
-  histogram_tester_ = base::MakeUnique<base::HistogramTester>();
+      std::make_unique<LoadingStatsCollector>(mock_predictor_.get(), config);
+  histogram_tester_ = std::make_unique<base::HistogramTester>();
   content::RunAllTasksUntilIdle();
 }
 
@@ -223,7 +222,7 @@
     PrefetchedRequestStats script2(GURL(script_url + "2"), true, 8 * 1024);
     PrefetchedRequestStats script3(GURL(script_url + "3"), false, 2 * 1024);
     PrefetchedRequestStats script4(GURL(script_url + "4"), true, 3 * 1024);
-    auto stats = base::MakeUnique<PrefetcherStats>(GURL(main_frame_url));
+    auto stats = std::make_unique<PrefetcherStats>(GURL(main_frame_url));
     stats->requests_stats = {script1, script2, script3, script4};
 
     stats_collector_->RecordPrefetcherStats(std::move(stats));
@@ -278,7 +277,7 @@
     PreconnectedRequestStats origin3(GURL(gen(3)).GetOrigin(), false, false);
     PreconnectedRequestStats origin4(GURL(gen(4)).GetOrigin(), true, true);
 
-    auto stats = base::MakeUnique<PreconnectStats>(GURL(main_frame_url));
+    auto stats = std::make_unique<PreconnectStats>(GURL(main_frame_url));
     stats->requests_stats = {origin1, origin2, origin3, origin4};
 
     stats_collector_->RecordPreconnectStats(std::move(stats));
@@ -312,7 +311,7 @@
 // empty.
 TEST_F(LoadingStatsCollectorTest, TestPreconnectHistogramsEmpty) {
   const std::string main_frame_url = "http://google.com";
-  auto stats = base::MakeUnique<PreconnectStats>(GURL(main_frame_url));
+  auto stats = std::make_unique<PreconnectStats>(GURL(main_frame_url));
   stats_collector_->RecordPreconnectStats(std::move(stats));
 
   EXPECT_CALL(*mock_predictor_, GetPrefetchData(GURL(main_frame_url), _))
@@ -362,7 +361,7 @@
     PreconnectedRequestStats origin3(GURL(gen(3)).GetOrigin(), false, false);
     PreconnectedRequestStats origin4(GURL(gen(4)).GetOrigin(), true, false);
 
-    auto stats = base::MakeUnique<PreconnectStats>(GURL(main_frame_url));
+    auto stats = std::make_unique<PreconnectStats>(GURL(main_frame_url));
     stats->requests_stats = {origin1, origin2, origin3, origin4};
 
     stats_collector_->RecordPreconnectStats(std::move(stats));
diff --git a/chrome/browser/predictors/preconnect_manager.cc b/chrome/browser/predictors/preconnect_manager.cc
index 3499339..298d0f0 100644
--- a/chrome/browser/predictors/preconnect_manager.cc
+++ b/chrome/browser/predictors/preconnect_manager.cc
@@ -6,7 +6,6 @@
 
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/resource_hints.h"
@@ -79,7 +78,7 @@
     return;
 
   auto iterator_and_whether_inserted = preresolve_info_.emplace(
-      host, base::MakeUnique<PreresolveInfo>(url, requests.size()));
+      host, std::make_unique<PreresolveInfo>(url, requests.size()));
   PreresolveInfo* info = iterator_and_whether_inserted.first->second.get();
 
   for (const auto& request : requests) {
diff --git a/chrome/browser/predictors/preconnect_manager_unittest.cc b/chrome/browser/predictors/preconnect_manager_unittest.cc
index d4a58f8..d25f720 100644
--- a/chrome/browser/predictors/preconnect_manager_unittest.cc
+++ b/chrome/browser/predictors/preconnect_manager_unittest.cc
@@ -77,10 +77,10 @@
 
 PreconnectManagerTest::PreconnectManagerTest()
     : mock_delegate_(
-          base::MakeUnique<StrictMock<MockPreconnectManagerDelegate>>()),
+          std::make_unique<StrictMock<MockPreconnectManagerDelegate>>()),
       context_getter_(base::MakeRefCounted<net::TestURLRequestContextGetter>(
           base::ThreadTaskRunnerHandle::Get())),
-      preconnect_manager_(base::MakeUnique<StrictMock<MockPreconnectManager>>(
+      preconnect_manager_(std::make_unique<StrictMock<MockPreconnectManager>>(
           mock_delegate_->AsWeakPtr(),
           context_getter_)) {}
 
diff --git a/chrome/browser/predictors/predictor_database.cc b/chrome/browser/predictors/predictor_database.cc
index 11149a0..4a6a1f4 100644
--- a/chrome/browser/predictors/predictor_database.cc
+++ b/chrome/browser/predictors/predictor_database.cc
@@ -73,7 +73,7 @@
     Profile* profile,
     scoped_refptr<base::SequencedTaskRunner> db_task_runner)
     : db_path_(profile->GetPath().Append(kPredictorDatabaseName)),
-      db_(base::MakeUnique<sql::Connection>()),
+      db_(std::make_unique<sql::Connection>()),
       db_task_runner_(db_task_runner),
       autocomplete_table_(
           new AutocompleteActionPredictorTable(db_task_runner_)),
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index 81eba1e..ea9aa195 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -9,7 +9,6 @@
 #include <utility>
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/rand_util.h"
 #include "base/time/time.h"
@@ -217,15 +216,15 @@
   initialization_state_ = INITIALIZING;
 
   // Create local caches using the database as loaded.
-  auto url_resource_data = base::MakeUnique<PrefetchDataMap>(
+  auto url_resource_data = std::make_unique<PrefetchDataMap>(
       tables_, tables_->url_resource_table(), config_.max_urls_to_track);
-  auto host_resource_data = base::MakeUnique<PrefetchDataMap>(
+  auto host_resource_data = std::make_unique<PrefetchDataMap>(
       tables_, tables_->host_resource_table(), config_.max_hosts_to_track);
-  auto url_redirect_data = base::MakeUnique<RedirectDataMap>(
+  auto url_redirect_data = std::make_unique<RedirectDataMap>(
       tables_, tables_->url_redirect_table(), config_.max_urls_to_track);
-  auto host_redirect_data = base::MakeUnique<RedirectDataMap>(
+  auto host_redirect_data = std::make_unique<RedirectDataMap>(
       tables_, tables_->host_redirect_table(), config_.max_hosts_to_track);
-  auto origin_data = base::MakeUnique<OriginDataMap>(
+  auto origin_data = std::make_unique<OriginDataMap>(
       tables_, tables_->origin_table(), config_.max_hosts_to_track);
 
   // Get raw pointers to pass to the first task. Ownership of the unique_ptrs
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc b/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc
index 4fe7477..5c909ee9 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc
@@ -4,9 +4,9 @@
 
 #include <algorithm>
 #include <cstddef>
+#include <memory>
 #include <set>
 
-#include "base/memory/ptr_util.h"
 #include "base/run_loop.h"
 #include "base/strings/string_util.h"
 #include "base/test/histogram_tester.h"
@@ -340,7 +340,7 @@
     // cross domains navigations (matching url_visit_count_, etc).
     host_resolver()->AddRule("*", "127.0.0.1");
 
-    https_server_ = base::MakeUnique<net::EmbeddedTestServer>(
+    https_server_ = std::make_unique<net::EmbeddedTestServer>(
         net::EmbeddedTestServer::TYPE_HTTPS);
 
     for (auto* server : {embedded_test_server(), https_server()}) {
@@ -666,7 +666,7 @@
       return nullptr;
 
     auto http_response =
-        base::MakeUnique<net::test_server::BasicHttpResponse>();
+        std::make_unique<net::test_server::BasicHttpResponse>();
 
     if (request.headers.find("If-None-Match") != request.headers.end() &&
         request.headers.at("If-None-Match") ==
@@ -711,7 +711,7 @@
       return nullptr;
 
     auto http_response =
-        base::MakeUnique<net::test_server::BasicHttpResponse>();
+        std::make_unique<net::test_server::BasicHttpResponse>();
     http_response->set_code(redirect_it->second.code);
     http_response->AddCustomHeader("Location", redirect_it->second.url.spec());
     return std::move(http_response);
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables.cc
index f6b7dc2a..5d75662 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_tables.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_tables.cc
@@ -7,7 +7,6 @@
 #include <algorithm>
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/stringprintf.h"
 #include "base/trace_event/trace_event.h"
@@ -126,16 +125,16 @@
 ResourcePrefetchPredictorTables::ResourcePrefetchPredictorTables(
     scoped_refptr<base::SequencedTaskRunner> db_task_runner)
     : PredictorTableBase(db_task_runner) {
-  url_resource_table_ = base::MakeUnique<GlowplugKeyValueTable<PrefetchData>>(
+  url_resource_table_ = std::make_unique<GlowplugKeyValueTable<PrefetchData>>(
       kUrlResourceTableName);
-  url_redirect_table_ = base::MakeUnique<GlowplugKeyValueTable<RedirectData>>(
+  url_redirect_table_ = std::make_unique<GlowplugKeyValueTable<RedirectData>>(
       kUrlRedirectTableName);
-  host_resource_table_ = base::MakeUnique<GlowplugKeyValueTable<PrefetchData>>(
+  host_resource_table_ = std::make_unique<GlowplugKeyValueTable<PrefetchData>>(
       kHostResourceTableName);
-  host_redirect_table_ = base::MakeUnique<GlowplugKeyValueTable<RedirectData>>(
+  host_redirect_table_ = std::make_unique<GlowplugKeyValueTable<RedirectData>>(
       kHostRedirectTableName);
   origin_table_ =
-      base::MakeUnique<GlowplugKeyValueTable<OriginData>>(kOriginTableName);
+      std::make_unique<GlowplugKeyValueTable<OriginData>>(kOriginTableName);
 }
 
 ResourcePrefetchPredictorTables::~ResourcePrefetchPredictorTables() = default;
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
index 26b5488..dbc3f011 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
@@ -103,7 +103,7 @@
 
 ResourcePrefetchPredictorTablesTest::ResourcePrefetchPredictorTablesTest()
     : task_runner_(base::SequencedTaskRunnerHandle::Get()),
-      db_(base::MakeUnique<PredictorDatabase>(&profile_, task_runner_)),
+      db_(std::make_unique<PredictorDatabase>(&profile_, task_runner_)),
       tables_(db_->resource_prefetch_tables()) {
   content::RunAllTasksUntilIdle();
 }
@@ -684,7 +684,7 @@
 }
 
 void ResourcePrefetchPredictorTablesTest::ReopenDatabase() {
-  db_ = base::MakeUnique<PredictorDatabase>(&profile_, task_runner_);
+  db_ = std::make_unique<PredictorDatabase>(&profile_, task_runner_);
   content::RunAllTasksUntilIdle();
   tables_ = db_->resource_prefetch_tables();
 }
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
index e9aaded0..befa51d 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_unittest.cc
@@ -9,7 +9,6 @@
 #include <memory>
 #include <utility>
 
-#include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
 #include "base/test/histogram_tester.h"
 #include "base/test/test_simple_task_runner.h"
@@ -153,7 +152,7 @@
     LoadingPredictorConfig config;
     PopulateTestConfig(&config, small_db);
     loading_predictor_ =
-        base::MakeUnique<LoadingPredictor>(config, profile_.get());
+        std::make_unique<LoadingPredictor>(config, profile_.get());
     predictor_ = loading_predictor_->resource_prefetch_predictor();
     predictor_->set_mock_tables(mock_tables_);
   }
@@ -181,7 +180,7 @@
 };
 
 ResourcePrefetchPredictorTest::ResourcePrefetchPredictorTest()
-    : profile_(base::MakeUnique<TestingProfile>()),
+    : profile_(std::make_unique<TestingProfile>()),
       db_task_runner_(base::MakeRefCounted<base::TestSimpleTaskRunner>()),
       mock_tables_(
           base::MakeRefCounted<StrictMock<MockResourcePrefetchPredictorTables>>(
@@ -212,7 +211,7 @@
   url_request_job_factory_.Reset();
   url_request_context_.set_job_factory(&url_request_job_factory_);
 
-  histogram_tester_ = base::MakeUnique<base::HistogramTester>();
+  histogram_tester_ = std::make_unique<base::HistogramTester>();
 }
 
 void ResourcePrefetchPredictorTest::TearDown() {
@@ -426,7 +425,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   PrefetchData host_data = CreatePrefetchData("www.google.com");
@@ -516,7 +515,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   PrefetchData url_data = CreatePrefetchData("http://www.google.com/");
@@ -623,7 +622,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   PrefetchData url_data = CreatePrefetchData("http://www.google.com/");
@@ -723,7 +722,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   PrefetchData url_data = CreatePrefetchData("http://www.nike.com/");
@@ -801,7 +800,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   PrefetchData url_data = CreatePrefetchData("http://www.google.com/");
@@ -846,7 +845,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   RedirectData url_redirect_data = CreateRedirectData("http://fb.com/google");
@@ -884,7 +883,7 @@
   EXPECT_CALL(mock_observer, OnNavigationLearned(kVisitCount, page_summary));
 
   predictor_->RecordPageRequestSummary(
-      base::MakeUnique<PageRequestSummary>(page_summary));
+      std::make_unique<PageRequestSummary>(page_summary));
   profile_->BlockUntilHistoryProcessesPendingRequests();
 
   RedirectData url_redirect_data = CreateRedirectData("http://fb.com/google");
@@ -1184,7 +1183,7 @@
 
 TEST_F(ResourcePrefetchPredictorTest, TestPredictPreconnectOrigins) {
   const GURL main_frame_url("http://google.com/?query=cats");
-  auto prediction = base::MakeUnique<PreconnectPrediction>();
+  auto prediction = std::make_unique<PreconnectPrediction>();
   // No prefetch data.
   EXPECT_FALSE(predictor_->IsUrlPreconnectable(main_frame_url));
   EXPECT_FALSE(
@@ -1205,7 +1204,7 @@
                        true, true);  // Low confidence - ignore.
   predictor_->origin_data_->UpdateData(google.host(), google);
 
-  prediction = base::MakeUnique<PreconnectPrediction>();
+  prediction = std::make_unique<PreconnectPrediction>();
   EXPECT_TRUE(predictor_->IsUrlPreconnectable(main_frame_url));
   EXPECT_TRUE(
       predictor_->PredictPreconnectOrigins(main_frame_url, prediction.get()));
@@ -1221,7 +1220,7 @@
   predictor_->host_redirect_data_->UpdateData(redirect.primary_key(), redirect);
 
   // Prediction failed: no data associated with the redirect endpoint.
-  prediction = base::MakeUnique<PreconnectPrediction>();
+  prediction = std::make_unique<PreconnectPrediction>();
   EXPECT_FALSE(predictor_->IsUrlPreconnectable(main_frame_url));
   EXPECT_FALSE(
       predictor_->PredictPreconnectOrigins(main_frame_url, prediction.get()));
@@ -1233,7 +1232,7 @@
                        true);  // High confidence - preconnect.
   predictor_->origin_data_->UpdateData(www_google.host(), www_google);
 
-  prediction = base::MakeUnique<PreconnectPrediction>();
+  prediction = std::make_unique<PreconnectPrediction>();
   EXPECT_TRUE(predictor_->IsUrlPreconnectable(main_frame_url));
   EXPECT_TRUE(
       predictor_->PredictPreconnectOrigins(main_frame_url, prediction.get()));
diff --git a/chrome/browser/predictors/resource_prefetcher.cc b/chrome/browser/predictors/resource_prefetcher.cc
index 652e8ad6..8167fc6 100644
--- a/chrome/browser/predictors/resource_prefetcher.cc
+++ b/chrome/browser/predictors/resource_prefetcher.cc
@@ -65,7 +65,7 @@
       prefetched_count_(0),
       prefetched_bytes_(0),
       request_queue_(urls.begin(), urls.end()),
-      stats_(base::MakeUnique<PrefetcherStats>(main_frame_url)) {
+      stats_(std::make_unique<PrefetcherStats>(main_frame_url)) {
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 }
 
diff --git a/chrome/browser/predictors/resource_prefetcher_unittest.cc b/chrome/browser/predictors/resource_prefetcher_unittest.cc
index 7745f471..422cf50 100644
--- a/chrome/browser/predictors/resource_prefetcher_unittest.cc
+++ b/chrome/browser/predictors/resource_prefetcher_unittest.cc
@@ -179,7 +179,7 @@
                             GURL("http://yahoo.com/resource4.png"),
                             GURL("http://yahoo.com/resource5.png")};
 
-  prefetcher_ = base::MakeUnique<TestResourcePrefetcher>(
+  prefetcher_ = std::make_unique<TestResourcePrefetcher>(
       &prefetcher_delegate_, context_getter_, kMaxConcurrentRequests,
       kMaxConcurrentRequestsPerHost, main_frame_url, urls);
 
@@ -251,7 +251,7 @@
                             GURL("http://yahoo.com/resource3.png"),
                             GURL("http://m.google.com/resource1.jpg")};
 
-  prefetcher_ = base::MakeUnique<TestResourcePrefetcher>(
+  prefetcher_ = std::make_unique<TestResourcePrefetcher>(
       &prefetcher_delegate_, context_getter_, kMaxConcurrentRequests,
       kMaxConcurrentRequestsPerHost, main_frame_url, urls);
 
@@ -298,7 +298,7 @@
                             GURL("http://www.google.com/resource5.png"),
                             GURL("http://www.google.com/resource6.png")};
 
-  prefetcher_ = base::MakeUnique<TestResourcePrefetcher>(
+  prefetcher_ = std::make_unique<TestResourcePrefetcher>(
       &prefetcher_delegate_, context_getter_, kMaxConcurrentRequests,
       kMaxConcurrentRequestsPerHost, main_frame_url, urls);
 
@@ -348,7 +348,7 @@
 
   std::vector<GURL> urls = {GURL(https_resource), GURL(http_resource)};
 
-  prefetcher_ = base::MakeUnique<TestResourcePrefetcher>(
+  prefetcher_ = std::make_unique<TestResourcePrefetcher>(
       &prefetcher_delegate_, context_getter_, kMaxConcurrentRequests,
       kMaxConcurrentRequestsPerHost, GURL(url), urls);
 
diff --git a/chrome/browser/prefs/proxy_policy_unittest.cc b/chrome/browser/prefs/proxy_policy_unittest.cc
index 9790ab7..4ed5293d 100644
--- a/chrome/browser/prefs/proxy_policy_unittest.cc
+++ b/chrome/browser/prefs/proxy_policy_unittest.cc
@@ -98,7 +98,8 @@
 
     PolicyServiceImpl::Providers providers;
     providers.push_back(&provider_);
-    policy_service_.reset(new PolicyServiceImpl(providers));
+    policy_service_ = std::make_unique<PolicyServiceImpl>();
+    policy_service_->SetProviders(providers);
     provider_.Init();
   }
 
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index 69b169b3..92e7ff8 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -986,7 +986,7 @@
                     first = false;
                     // Need to leak the client pipe, or else the renderer will
                     // get a disconnect error and load the error page.
-                    auto* leak_client = new content::mojom::URLLoaderClientPtr;
+                    auto* leak_client = new network::mojom::URLLoaderClientPtr;
                     *leak_client = std::move(params->client);
                     closure.Run();
                     return true;
@@ -3278,9 +3278,9 @@
 
 namespace {
 
-class HangingURLLoader : public content::mojom::URLLoader {
+class HangingURLLoader : public network::mojom::URLLoader {
  public:
-  explicit HangingURLLoader(content::mojom::URLLoaderClientPtr client)
+  explicit HangingURLLoader(network::mojom::URLLoaderClientPtr client)
       : client_(std::move(client)) {}
   ~HangingURLLoader() override {}
   // mojom::URLLoader implementation:
@@ -3300,7 +3300,7 @@
   }
 
  private:
-  content::mojom::URLLoaderClientPtr client_;
+  network::mojom::URLLoaderClientPtr client_;
   SetPriorityCallback set_priority_callback_;
 };
 
diff --git a/chrome/browser/profiles/profile_avatar_downloader.cc b/chrome/browser/profiles/profile_avatar_downloader.cc
index c1980027..3693983 100644
--- a/chrome/browser/profiles/profile_avatar_downloader.cc
+++ b/chrome/browser/profiles/profile_avatar_downloader.cc
@@ -63,7 +63,7 @@
   // In unit tests, the browser process can return a NULL context manager
   if (!system_network_context_manager)
     return;
-  content::mojom::URLLoaderFactory* loader_factory =
+  network::mojom::URLLoaderFactory* loader_factory =
       system_network_context_manager->GetURLLoaderFactory();
   if (loader_factory) {
     fetcher_->Init(
diff --git a/chrome/browser/profiles/profile_list_desktop_unittest.cc b/chrome/browser/profiles/profile_list_desktop_unittest.cc
index fa0a126..d022e91 100644
--- a/chrome/browser/profiles/profile_list_desktop_unittest.cc
+++ b/chrome/browser/profiles/profile_list_desktop_unittest.cc
@@ -10,7 +10,6 @@
 
 #include "base/command_line.h"
 #include "base/macros.h"
-#include "base/metrics/field_trial.h"
 #include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
 #include "build/build_config.h"
@@ -265,22 +264,6 @@
   EXPECT_EQ(ASCIIToUTF16("Test 3"), item3.name);
 }
 
-TEST_F(ProfileListDesktopTest, ShowAvatarMenuInTrial) {
-  // If multiprofile mode is not enabled, the trial will not be enabled, so it
-  // isn't tested.
-  if (!profiles::IsMultipleProfilesEnabled())
-    return;
-
-  base::FieldTrialList field_trial_list_(NULL);
-  base::FieldTrialList::CreateFieldTrial("ShowProfileSwitcher", "AlwaysShow");
-
-#if defined(OS_CHROMEOS)
-  EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu());
-#else
-  EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu());
-#endif
-}
-
 TEST_F(ProfileListDesktopTest, ShowAvatarMenu) {
   // If multiprofile mode is not enabled then the menu is never shown.
   if (!profiles::IsMultipleProfilesEnabled())
diff --git a/chrome/browser/resources/md_bookmarks/command_manager.js b/chrome/browser/resources/md_bookmarks/command_manager.js
index 9cb3178..668a44975 100644
--- a/chrome/browser/resources/md_bookmarks/command_manager.js
+++ b/chrome/browser/resources/md_bookmarks/command_manager.js
@@ -747,6 +747,9 @@
       } else {
         this.openCommandMenuAtPosition(e.detail.x, e.detail.y, e.detail.source);
       }
+      bookmarks.util.recordEnumHistogram(
+          'BookmarkManager.CommandMenuOpened', e.detail.source,
+          MenuSource.NUM_VALUES);
     },
 
     /**
diff --git a/chrome/browser/resources/md_bookmarks/constants.js b/chrome/browser/resources/md_bookmarks/constants.js
index f18d27f..87f3d5e 100644
--- a/chrome/browser/resources/md_bookmarks/constants.js
+++ b/chrome/browser/resources/md_bookmarks/constants.js
@@ -18,7 +18,7 @@
 /**
  * Commands which can be handled by the CommandManager. This enum is also used
  * for metrics and should be kept in sync with BookmarkManagerCommand in
- * enums.xml.
+ * enums.xml. Values must never be renumbered or reused.
  * @enum {number}
  * @const
  */
@@ -51,6 +51,9 @@
 };
 
 /**
+ * Where the menu was opened from. This enum is also used for metrics and should
+ * be kept in sync with BookmarkManagerMenuSource in enums.xml. Values must
+ * never be renumbered or reused.
  * @enum {number}
  * @const
  */
@@ -60,6 +63,9 @@
   TREE: 2,
   TOOLBAR: 3,
   LIST: 4,
+
+  // Append new values to the end of the enum.
+  NUM_VALUES: 5,
 };
 
 /**
diff --git a/chrome/browser/resources/print_preview/new/app.html b/chrome/browser/resources/print_preview/new/app.html
index 75d80b3..fd29781 100644
--- a/chrome/browser/resources/print_preview/new/app.html
+++ b/chrome/browser/resources/print_preview/new/app.html
@@ -11,6 +11,7 @@
 <link rel="import" href="settings_behavior.html">
 <link rel="import" href="model.html">
 <link rel="import" href="header.html">
+<link rel="import" href="preview_area.html">
 <link rel="import" href="destination_settings.html">
 <link rel="import" href="pages_settings.html">
 <link rel="import" href="copies_settings.html">
@@ -47,13 +48,11 @@
         overflow: auto;
       }
 
-      #previewArea {
+      #preview-area {
         -webkit-border-start: 1px solid #dcdcdc;
         align-items: center;
         background-color: #e6e6e6;
-        display: flex;
         flex: 1;
-        justify-content: center;
       }
     </style>
     <print-preview-model id="model" settings="{{settings}}"
@@ -103,7 +102,12 @@
         </print-preview-advanced-options-settings>
       </div>
     </div>
-    <div id="previewArea">preview area</div>
+    <div id="preview-area">
+      <print-preview-preview-area settings="{{settings}}"
+          destination="[[destination_]]" document-info="{{documentInfo_}}"
+          state="{{state_}}">
+      </print-preview-preview-area>
+    </div>
   </template>
   <script src="app.js"></script>
 </dom-module>
diff --git a/chrome/browser/resources/print_preview/new/app.js b/chrome/browser/resources/print_preview/new/app.js
index 7eb9af1..c45886a 100644
--- a/chrome/browser/resources/print_preview/new/app.js
+++ b/chrome/browser/resources/print_preview/new/app.js
@@ -45,6 +45,7 @@
         cloudPrintError: '',
         privetExtensionError: '',
         invalidSettings: false,
+        initialized: false,
         cancelled: false,
       },
     },
@@ -104,12 +105,7 @@
     this.documentInfo_.init(
         settings.previewModifiable, settings.documentTitle,
         settings.documentHasSelection);
-    // Temporary setting, will be replaced when page count is known from
-    // the page-count-ready webUI event.
-    this.documentInfo_.updatePageCount(5);
     this.notifyPath('documentInfo_.isModifiable');
-    // Before triggering the final notification for settings availability,
-    // set initialized = true.
     this.notifyPath('documentInfo_.hasSelection');
     this.notifyPath('documentInfo_.title');
     this.notifyPath('documentInfo_.pageCount');
@@ -134,6 +130,8 @@
     this.set(
         'destination_.capabilities',
         this.destinationStore_.selectedDestination.capabilities);
+    if (!this.state_.initialized)
+      this.set('state_.initialized', true);
   },
 
   /** @private */
diff --git a/chrome/browser/resources/print_preview/new/compiled_resources2.gyp b/chrome/browser/resources/print_preview/new/compiled_resources2.gyp
index 99938247..0441a3c1 100644
--- a/chrome/browser/resources/print_preview/new/compiled_resources2.gyp
+++ b/chrome/browser/resources/print_preview/new/compiled_resources2.gyp
@@ -18,6 +18,7 @@
         'scaling_settings',
         'other_options_settings',
         'advanced_options_settings',
+        'preview_area',
         'model',
         'state',
         '../compiled_resources2.gyp:native_layer',
@@ -152,11 +153,31 @@
       'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
     },
     {
+      'target_name': 'preview_area',
+      'dependencies': [
+        '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
+        '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:web_ui_listener_behavior',
+        '../../pdf/compiled_resources2.gyp:pdf_scripting_api',
+        '../compiled_resources2.gyp:native_layer',
+        '../compiled_resources2.gyp:print_preview_utils',
+        '../data/compiled_resources2.gyp:destination',
+        '../data/compiled_resources2.gyp:document_info',
+        '../data/compiled_resources2.gyp:coordinate2d',
+        '../data/compiled_resources2.gyp:size',
+        '../data/compiled_resources2.gyp:margins',
+        '../data/compiled_resources2.gyp:printable_area',
+        'settings_behavior',
+        'state',
+      ],
+      'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
+    },
+    {
       'target_name': 'model',
       'dependencies': [
         'settings_behavior',
         '../data/compiled_resources2.gyp:destination',
         '../data/compiled_resources2.gyp:document_info',
+        '../data/compiled_resources2.gyp:margins',
         '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:cr',
       ],
       'includes': ['../../../../../third_party/closure_compiler/compile_js2.gypi'],
diff --git a/chrome/browser/resources/print_preview/new/header.js b/chrome/browser/resources/print_preview/new/header.js
index 13b3aac..00ebc16 100644
--- a/chrome/browser/resources/print_preview/new/header.js
+++ b/chrome/browser/resources/print_preview/new/header.js
@@ -64,9 +64,11 @@
    * @private
    */
   isPdfOrDrive_: function() {
-    return this.destination.id ==
-        print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
-        this.destination.id == print_preview.Destination.GooglePromotedId.DOCS;
+    return this.destination &&
+        (this.destination.id ==
+             print_preview.Destination.GooglePromotedId.SAVE_AS_PDF ||
+         this.destination.id ==
+             print_preview.Destination.GooglePromotedId.DOCS);
   },
 
   /**
diff --git a/chrome/browser/resources/print_preview/new/model.html b/chrome/browser/resources/print_preview/new/model.html
index 79d45f5..3092411 100644
--- a/chrome/browser/resources/print_preview/new/model.html
+++ b/chrome/browser/resources/print_preview/new/model.html
@@ -3,5 +3,6 @@
 <link rel="import" href="chrome://resources/html/cr.html">
 <link rel="import" href="../data/destination.html">
 <link rel="import" href="../data/document_info.html">
+<link rel="import" href="../data/margins.html">
 
 <script src="model.js"></script>
diff --git a/chrome/browser/resources/print_preview/new/model.js b/chrome/browser/resources/print_preview/new/model.js
index 700dee7c..bf4fe07 100644
--- a/chrome/browser/resources/print_preview/new/model.js
+++ b/chrome/browser/resources/print_preview/new/model.js
@@ -64,30 +64,35 @@
       value: {
         pages: {
           value: [1],
+          unavailableValue: [],
           valid: true,
           available: true,
           key: '',
         },
         copies: {
           value: '1',
+          unavailableValue: '1',
           valid: true,
           available: true,
           key: '',
         },
         collate: {
           value: true,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isCollateEnabled',
         },
         layout: {
           value: false, /* portrait */
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isLandscapeEnabled',
         },
         color: {
           value: true, /* color */
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isColorEnabled',
@@ -97,66 +102,77 @@
             width_microns: 215900,
             height_microns: 279400,
           },
+          unavailableValue: {},
           valid: true,
           available: true,
           key: 'mediaSize',
         },
         margins: {
-          value: 0,
+          value: print_preview.ticket_items.MarginsTypeValue.DEFAULT,
+          unavailableValue: print_preview.ticket_items.MarginsTypeValue.DEFAULT,
           valid: true,
           available: true,
           key: 'marginsType',
         },
         dpi: {
           value: {},
+          unavailableValue: {},
           valid: true,
           available: true,
           key: 'dpi',
         },
         fitToPage: {
           value: false,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isFitToPageEnabled',
         },
         scaling: {
           value: '100',
+          unavailableValue: '100',
           valid: true,
           available: true,
           key: 'scaling',
         },
         duplex: {
           value: true,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isDuplexEnabled',
         },
         cssBackground: {
           value: false,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isCssBackgroundEnabled',
         },
         selectionOnly: {
           value: false,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: '',
         },
         headerFooter: {
           value: true,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: 'isHeaderFooterEnabled',
         },
         rasterize: {
           value: false,
+          unavailableValue: false,
           valid: true,
           available: true,
           key: '',
         },
         vendorItems: {
           value: {},
+          unavailableValue: {},
           valid: true,
           available: true,
           key: '',
@@ -165,6 +181,15 @@
         // expose the availability of the other options settings section.
         otherOptions: {
           value: null,
+          unavailableValue: null,
+          valid: true,
+          available: true,
+        },
+        // This does not represent a real settings value, but is used to
+        // propagate the correctly formatted ranges for print tickets.
+        ranges: {
+          value: [],
+          unavailableValue: [],
           valid: true,
           available: true,
           key: '',
diff --git a/chrome/browser/resources/print_preview/new/pages_settings.js b/chrome/browser/resources/print_preview/new/pages_settings.js
index 239dc5c..e230e2c3 100644
--- a/chrome/browser/resources/print_preview/new/pages_settings.js
+++ b/chrome/browser/resources/print_preview/new/pages_settings.js
@@ -188,7 +188,8 @@
     }
     this.$$('.user-value').classList.remove('invalid');
     this.setSettingValid('pages', true);
-    this.setSetting('pages', this.rangesToPrint_);
+    this.setSetting('pages', this.pagesToPrint_);
+    this.setSetting('ranges', this.rangesToPrint_);
   },
 
   /** @private */
diff --git a/chrome/browser/resources/print_preview/new/preview_area.html b/chrome/browser/resources/print_preview/new/preview_area.html
new file mode 100644
index 0000000..716d3b5
--- /dev/null
+++ b/chrome/browser/resources/print_preview/new/preview_area.html
@@ -0,0 +1,163 @@
+<link rel="import" href="chrome://resources/html/polymer.html">
+
+<link rel="import" href="chrome://resources/html/cr.html">
+<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html">
+<link rel="import" href="../native_layer.html">
+<link rel="import" href="../print_preview_utils.html">
+<link rel="import" href="../data/coordinate2d.html">
+<link rel="import" href="../data/destination.html">
+<link rel="import" href="../data/document_info.html">
+<link rel="import" href="../data/margins.html">
+<link rel="import" href="../data/printable_area.html">
+<link rel="import" href="../data/size.html">
+<link rel="import" href="settings_behavior.html">
+
+<dom-module id="print-preview-preview-area">
+  <template>
+    <style>
+      @keyframes dancing-dots-jump {
+        0% { top: 0; }
+        55% { top: 0; }
+        60% { top: -10px; }
+        80% { top: 3px; }
+        90% { top: -2px; }
+        95% { top: 1px; }
+        100% { top: 0; }
+      }
+
+      :host span.jumping-dots > span {
+        animation: dancing-dots-jump 1800ms infinite;
+        padding: 1px;
+        position: relative;
+      }
+
+      :host span.jumping-dots > span:nth-child(2) {
+        animation-delay: 100ms;
+      }
+
+      :host span.jumping-dots > span:nth-child(3) {
+        animation-delay: 300ms;
+      }
+
+      :host {
+        display: block;
+        height: 100%;
+        overflow: hidden;
+        position: relative;
+        user-select: none;
+      }
+
+      .preview-area-plugin-wrapper {
+        height: 100%;
+      }
+
+      :host .preview-area-plugin {
+        border: none;
+        cursor: inherit;
+        height: 100%;
+        opacity: 1;
+        /* pluginFadeInTransitionDuration = 200ms */
+        transition: opacity 200ms linear;
+        /* pluginFadeInTransitionDelay =
+           overlayFadeOutTransitionDuration = 100ms */
+        transition-delay: 100ms;
+        width: 100%;
+      }
+
+      :host .preview-area-overlay-layer {
+        background: #e6e6e6;
+        height: 100%;
+        margin: 0;
+        opacity: 1;
+        position: absolute;
+        transition: opacity 200ms linear;
+        /* overlayFadeInTransitionDelay = pluginFadeOutTransitionDelay +
+         *     pluginFadeOutTransitionDuration = 350ms */
+        transition-delay: 350ms;
+        user-select: none;
+        width: 100%;
+        z-index: 1;
+      }
+
+      :host .preview-area-overlay-layer.invisible {
+        opacity: 0;
+        pointer-events: none;
+        /* overlayFadeOutTransitionDuration = 100ms */
+        transition: opacity 100ms linear;
+      }
+
+      :host .preview-area-messages {
+        height: 100%;
+      }
+
+      :host .preview-area-message {
+        color: #404040;
+        font-size: 1.1em;
+        position: relative;
+        text-align: center;
+        text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
+        top: 50%;
+      }
+
+      :host .preview-area-no-plugin-action-area {
+        margin-top: 12px;
+      }
+
+      :host .preview-area-open-system-dialog-button-throbber {
+        vertical-align: middle;
+      }
+
+    </style>
+    <div class="preview-area-overlay-layer">
+      <div class="preview-area-messages">
+
+        <div class="preview-area-loading-message preview-area-message"
+          hidden$="[[!state.previewLoading]]">
+          <span>$i18n{loading}</span>
+          <span class="preview-area-loading-message-jumping-dots jumping-dots"
+              ><span>.</span><span>.</span><span>.</span></span>
+        </div>
+
+        <div class="preview-area-custom-message preview-area-message" hidden>
+          <div class="preview-area-custom-message-text"></div>
+          <div class="preview-area-custom-action-area">
+            <button class="preview-area-open-system-dialog-button">
+              $i18n{launchNativeDialog}
+            </button>
+            <div
+                class="preview-area-open-system-dialog-button-throbber throbber"
+                hidden></div>
+          </div>
+        </div>
+
+        <div class="preview-area-preview-failed-message preview-area-message"
+          hidden$="[[!state.previewFailed]]">
+          $i18n{previewFailed}
+        </div>
+
+        <div class="preview-area-print-failed preview-area-message"
+          hidden$="[[!state.invalidSettings]]">
+          <div>$i18n{invalidPrinterSettings}</div>
+          <div class="preview-area-print-failed-action-area">
+            <button class="preview-area-open-system-dialog-button">
+              $i18n{launchNativeDialog}
+            </button>
+            <div
+                class="preview-area-open-system-dialog-button-throbber throbber"
+                hidden></div>
+          </div>
+        </div>
+
+      </div>
+    </div>
+    <div class="preview-area-plugin-wrapper">
+      <object class="preview-area-compatibility-object-out-of-process"
+          type="application/x-google-chrome-pdf"
+          data="chrome://print/dummy.pdf"></object>
+    </div>
+  </template>
+  <script src="preview_area.js"></script>
+  <script
+    src="chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/pdf_scripting_api.js">
+  </script>
+</dom-module>
diff --git a/chrome/browser/resources/print_preview/new/preview_area.js b/chrome/browser/resources/print_preview/new/preview_area.js
new file mode 100644
index 0000000..6a1b53b
--- /dev/null
+++ b/chrome/browser/resources/print_preview/new/preview_area.js
@@ -0,0 +1,374 @@
+// 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.
+
+cr.exportPath('print_preview_new');
+/**
+ * @typedef {{accessibility: Function,
+ *            documentLoadComplete: Function,
+ *            getHeight: Function,
+ *            getHorizontalScrollbarThickness: Function,
+ *            getPageLocationNormalized: Function,
+ *            getVerticalScrollbarThickness: Function,
+ *            getWidth: Function,
+ *            getZoomLevel: Function,
+ *            goToPage: Function,
+ *            grayscale: Function,
+ *            loadPreviewPage: Function,
+ *            onload: Function,
+ *            onPluginSizeChanged: Function,
+ *            onScroll: Function,
+ *            pageXOffset: Function,
+ *            pageYOffset: Function,
+ *            reload: Function,
+ *            resetPrintPreviewMode: Function,
+ *            sendKeyEvent: Function,
+ *            setPageNumbers: Function,
+ *            setPageXOffset: Function,
+ *            setPageYOffset: Function,
+ *            setZoomLevel: Function,
+ *            fitToHeight: Function,
+ *            fitToWidth: Function,
+ *            zoomIn: Function,
+ *            zoomOut: Function}}
+ */
+print_preview_new.PDFPlugin;
+
+/**
+ * Constant values matching printing::DuplexMode enum.
+ * @enum {number}
+ */
+print_preview_new.DuplexMode = {
+  SIMPLEX: 0,
+  LONG_EDGE: 1,
+  UNKNOWN_DUPLEX_MODE: -1
+};
+
+Polymer({
+  is: 'print-preview-preview-area',
+
+  behaviors: [WebUIListenerBehavior, SettingsBehavior],
+  properties: {
+    /** @type {print_preview.DocumentInfo} */
+    documentInfo: Object,
+
+    /** @type {print_preview.Destination} */
+    destination: Object,
+
+    /** @type {print_preview_new.State} */
+    state: {
+      type: Object,
+      notify: true,
+    },
+  },
+
+  observers: [
+    'onSettingsChanged_(settings.color.value, settings.cssBackground.value, ' +
+        'settings.fitToPage.value, settings.headerFooter.value, ' +
+        'settings.layout.value, settings.margins.value, ' +
+        'settings.mediaSize.value, settings.ranges.value,' +
+        'settings.selectionOnly.value, settings.scaling.value, ' +
+        'destination.id, destination.capabilities, state.initialized)',
+    'onPreviewStateChanged_(state.previewLoading, state.invalidSettings, ' +
+        'state.previewFailed)',
+  ],
+
+  /** @private {print_preview.NativeLayer} */
+  nativeLayer_: null,
+
+  /** @private {number} */
+  inFlightRequestId_: -1,
+
+  /** @private {HTMLEmbedElement|print_preview_new.PDFPlugin} */
+  plugin_: null,
+
+  /** @private {boolean} */
+  pluginLoaded_: false,
+
+  /** @private {boolean} */
+  documentReady_: false,
+
+  /** @override */
+  attached: function() {
+    this.nativeLayer_ = print_preview.NativeLayer.getInstance();
+    this.addWebUIListener(
+        'page-count-ready', this.onPageCountReady_.bind(this));
+    this.addWebUIListener(
+        'page-layout-ready', this.onPageLayoutReady_.bind(this));
+    this.addWebUIListener(
+        'page-preview-ready', this.onPagePreviewReady_.bind(this));
+
+    const oopCompatObj =
+        this.$$('.preview-area-compatibility-object-out-of-process');
+    const isOOPCompatible = oopCompatObj.postMessage;
+    oopCompatObj.parentElement.removeChild(oopCompatObj);
+    if (!isOOPCompatible)
+      this.set('state.previewFailed', true);
+    else
+      this.set('state.previewLoading', true);
+  },
+
+  /** @private */
+  onSettingsChanged_: function() {
+    if (!this.state.initialized || !this.getSetting('scaling').valid ||
+        !this.getSetting('pages').valid || !this.getSetting('copies').valid ||
+        !this.destination || !this.destination.capabilities) {
+      return;
+    }
+    this.documentReady_ = false;
+    this.set('state.previewLoading', true);
+    this.getPreview_().then(
+        previewUid => {
+          if (!this.documentInfo.isModifiable)
+            this.onPreviewStart_(previewUid, -1);
+          this.documentReady_ = true;
+          if (this.pluginLoaded_)
+            this.set('state.previewLoading', false);
+        },
+        type => {
+          if (/** @type{string} */ (type) == 'SETTINGS_INVALID')
+            this.set('state.invalidSettings', true);
+          else if (/** @type{string} */ (type) != 'CANCELLED')
+            this.set('state.previewFailed', true);
+          this.set('state.previewLoading', false);
+        });
+  },
+
+  /**
+   * Set the visibility of the message overlay.
+   * @param {boolean} visible Whether to make the overlay visible or not
+   * @private
+   */
+  setOverlayVisible_: function(visible) {
+    const overlayEl = this.$$('.preview-area-overlay-layer');
+    overlayEl.classList.toggle('invisible', !visible);
+    overlayEl.setAttribute('aria-hidden', !visible);
+  },
+
+  /** @private */
+  onPreviewStateChanged_: function() {
+    // update the appearance here.
+    const visible = this.state.previewLoading || this.state.previewFailed ||
+        this.state.invalidSettings;
+    this.setOverlayVisible_(visible);
+
+    // Disable jumping animation to conserve cycles.
+    const jumpingDotsEl = this.$$('.preview-area-loading-message-jumping-dots');
+    jumpingDotsEl.classList.toggle('jumping-dots', this.state.previewLoading);
+  },
+
+  /**
+   * @param {number} previewUid The unique identifier of the preview.
+   * @param {number} index The index of the page to preview.
+   * @private
+   */
+  onPreviewStart_: function(previewUid, index) {
+    if (!this.plugin_)
+      this.createPlugin_(previewUid, index);
+    this.pluginLoaded_ = false;
+    this.plugin_.resetPrintPreviewMode(
+        this.getPreviewUrl_(previewUid, index), !this.getSettingValue('color'),
+        this.getSetting('pages').value, this.documentInfo.isModifiable);
+  },
+
+  /**
+   * Called when the page layout of the document is ready. Always occurs
+   * as a result of a preview request.
+   * @param {{marginTop: number,
+   *          marginLeft: number,
+   *          marginBottom: number,
+   *          marginRight: number,
+   *          contentWidth: number,
+   *          contentHeight: number,
+   *          printableAreaX: number,
+   *          printableAreaY: number,
+   *          printableAreaWidth: number,
+   *          printableAreaHeight: number,
+   *        }} pageLayout Layout information about the document.
+   * @param {boolean} hasCustomPageSizeStyle Whether this document has a
+   *     custom page size or style to use.
+   * @private
+   */
+  onPageLayoutReady_: function(pageLayout, hasCustomPageSizeStyle) {
+    const origin = new print_preview.Coordinate2d(
+        pageLayout.printableAreaX, pageLayout.printableAreaY);
+    const size = new print_preview.Size(
+        pageLayout.printableAreaWidth, pageLayout.printableAreaHeight);
+
+    const margins = new print_preview.Margins(
+        Math.round(pageLayout.marginTop), Math.round(pageLayout.marginRight),
+        Math.round(pageLayout.marginBottom), Math.round(pageLayout.marginLeft));
+
+    const o = print_preview.ticket_items.CustomMarginsOrientation;
+    const pageSize = new print_preview.Size(
+        pageLayout.contentWidth + margins.get(o.LEFT) + margins.get(o.RIGHT),
+        pageLayout.contentHeight + margins.get(o.TOP) + margins.get(o.BOTTOM));
+
+    this.documentInfo.updatePageInfo(
+        new print_preview.PrintableArea(origin, size), pageSize,
+        hasCustomPageSizeStyle, margins);
+    this.notifyPath('documentInfo.printableArea');
+    this.notifyPath('documentInfo.pageSize');
+    this.notifyPath('documentInfo.margins');
+    this.notifyPath('documentInfo.hasCssMediaStyles');
+  },
+
+  /**
+   * Called when the document page count is received from the native layer.
+   * Always occurs as a result of a preview request.
+   * @param {number} pageCount The document's page count.
+   * @param {number} previewResponseId The request ID that corresponds to this
+   *     page count.
+   * @param {number} fitToPageScaling The scaling required to fit the document
+   *     to page (unused).
+   * @private
+   */
+  onPageCountReady_: function(pageCount, previewResponseId, fitToPageScaling) {
+    if (this.inFlightRequestId_ != previewResponseId)
+      return;
+    this.documentInfo.updatePageCount(pageCount);
+    this.documentInfo.fitToPageScaling_ = fitToPageScaling;
+    this.notifyPath('documentInfo.pageCount');
+    this.notifyPath('documentInfo.fitToPageScaling');
+  },
+
+  /**
+   * Called when the plugin loads. This is a consequence of calling
+   * plugin.reload(). Certain plugin state can only be set after the plugin
+   * has loaded.
+   * @private
+   */
+  onPluginLoad_: function() {
+    this.pluginLoaded_ = true;
+    if (this.documentReady_)
+      this.set('state.previewLoading', false);
+  },
+
+  /**
+   * Get the URL for the plugin.
+   * @param {number} previewUid Unique identifier of preview.
+   * @param {number} index Page index for plugin.
+   * @return {string} The URL
+   * @private
+   */
+  getPreviewUrl_: function(previewUid, index) {
+    return `chrome://print/${previewUid}/${index}/print.pdf`;
+  },
+
+  /**
+   * Called when a page's preview has been generated.
+   * @param {number} pageIndex The index of the page whose preview is ready.
+   * @param {number} previewUid The unique ID of the print preview UI.
+   * @param {number} previewResponseId The preview request ID that this page
+   *     preview is a response to.
+   * @private
+   */
+  onPagePreviewReady_: function(pageIndex, previewUid, previewResponseId) {
+    if (this.inFlightRequestId_ != previewResponseId)
+      return;
+    const pageNumber = pageIndex + 1;
+    const index = this.getSettingValue('pages').indexOf(pageNumber);
+    if (index == 0)
+      this.onPreviewStart_(previewUid, pageIndex);
+    if (index != -1) {
+      this.plugin_.loadPreviewPage(
+          this.getPreviewUrl_(previewUid, pageIndex), index);
+    }
+  },
+
+  /**
+   * Creates a preview plugin and adds it to the DOM.
+   * @param {number} previewUid The unique ID of the preview. Used to determine
+   *     the URL for the plugin.
+   * @param {number} index The index of the page to load. Used to determine the
+   *     URL for the plugin.
+   * @private
+   */
+  createPlugin_: function(previewUid, index) {
+    assert(!this.plugin_);
+    const srcUrl = this.getPreviewUrl_(previewUid, index);
+    this.plugin_ = /** @type {print_preview_new.PDFPlugin} */ (
+        PDFCreateOutOfProcessPlugin(srcUrl));
+    this.plugin_.classList.add('preview-area-plugin');
+    this.plugin_.setAttribute('aria-live', 'polite');
+    this.plugin_.setAttribute('aria-atomic', 'true');
+    // NOTE: The plugin's 'id' field must be set to 'pdf-viewer' since
+    // chrome/renderer/printing/print_render_frame_helper.cc actually
+    // references it.
+    this.plugin_.setAttribute('id', 'pdf-viewer');
+    this.$$('.preview-area-plugin-wrapper')
+        .appendChild(/** @type {Node} */ (this.plugin_));
+
+    this.plugin_.setLoadCallback(this.onPluginLoad_.bind(this));
+  },
+
+  /**
+   * Requests a preview from the native layer.
+   * @return {!Promise} Promise that resolves when the preview has been
+   *     generated.
+   */
+  getPreview_: function() {
+    this.inFlightRequestId_++;
+    const dpi = /** @type {{horizontal_dpi: (number | undefined),
+                            vertical_dpi: (number | undefined),
+                            vendor_id: (number | undefined)}} */ (
+        this.getSettingValue('dpi'));
+    const ticket = {
+      pageRange: this.getSettingValue('ranges'),
+      mediaSize: this.getSettingValue('mediaSize'),
+      landscape: this.getSettingValue('layout'),
+      color: this.destination.getNativeColorModel(
+          /** @type {boolean} */ (this.getSettingValue('color'))),
+      headerFooterEnabled: this.getSettingValue('headerFooter'),
+      marginsType: this.getSettingValue('margins'),
+      isFirstRequest: this.inFlightRequestId_ == 0,
+      requestID: this.inFlightRequestId_,
+      previewModifiable: this.documentInfo.isModifiable,
+      generateDraftData: this.documentInfo.isModifiable,
+      fitToPageEnabled: this.getSettingValue('fitToPage'),
+      scaleFactor: parseInt(this.getSettingValue('scaling'), 10),
+      shouldPrintBackgrounds: this.getSettingValue('cssBackground'),
+      shouldPrintSelectionOnly: this.getSettingValue('selectionOnly'),
+      // NOTE: Even though the remaining fields don't directly relate to the
+      // preview, they still need to be included.
+      // e.g. printing::PrintSettingsFromJobSettings() still checks for them.
+      collate: true,
+      copies: 1,
+      deviceName: this.destination.id,
+      dpiHorizontal: (dpi && 'horizontal_dpi' in dpi) ? dpi.horizontal_dpi : 0,
+      dpiVertical: (dpi && 'vertical_dpi' in dpi) ? dpi.vertical_dpi : 0,
+      duplex: this.getSettingValue('duplex') ?
+          print_preview_new.DuplexMode.LONG_EDGE :
+          print_preview_new.DuplexMode.SIMPLEX,
+      printToPDF: this.destination.id ==
+          print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
+      printWithCloudPrint: !this.destination.isLocal,
+      printWithPrivet: this.destination.isPrivet,
+      printWithExtension: this.destination.isExtension,
+      rasterizePDF: false,
+    };
+
+    // Set 'cloudPrintID' only if the this.destination is not local.
+    if (this.destination && !this.destination.isLocal) {
+      ticket.cloudPrintID = this.destination.id;
+    }
+
+    if (this.getSettingValue('margins') ==
+        print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
+      // TODO (rbpotter): Replace this with real values when custom margins are
+      // implemented.
+      ticket.marginsCustom = {
+        marginTop: 70,
+        marginRight: 70,
+        marginBottom: 70,
+        marginLeft: 70,
+      };
+    }
+    let pageCount = -1;
+    if (this.inFlightRequestId_ > 0) {
+      pageCount = this.documentInfo.isModifiable ?
+          this.documentInfo.pageCount : 0;
+    }
+    return this.nativeLayer_.getPreview(JSON.stringify(ticket), pageCount);
+  },
+});
diff --git a/chrome/browser/resources/print_preview/new/settings_behavior.js b/chrome/browser/resources/print_preview/new/settings_behavior.js
index 51fab6e..aa4c95d 100644
--- a/chrome/browser/resources/print_preview/new/settings_behavior.js
+++ b/chrome/browser/resources/print_preview/new/settings_behavior.js
@@ -9,6 +9,7 @@
  * serialized state.
  * @typedef {{
  *   value: *,
+ *   unavailableValue: *,
  *   valid: boolean,
  *   available: boolean,
  *   key: string,
@@ -35,6 +36,7 @@
  *   rasterize: !print_preview_new.Setting,
  *   vendorItems: !print_preview_new.Setting,
  *   otherOptions: !print_preview_new.Setting,
+ *   ranges: !print_preview_new.Setting,
  * }}
  */
 print_preview_new.Settings;
@@ -61,6 +63,15 @@
   },
 
   /**
+   * @param {string} settingName Name of the setting to get the value for.
+   * @return {*} The value of the setting, accounting for availability.
+   */
+  getSettingValue: function(settingName) {
+    const setting = this.getSetting(settingName);
+    return setting.available ? setting.value : setting.unavailableValue;
+  },
+
+  /**
    * @param {string} settingName Name of the setting to set
    * @param {boolean | string | number | Array | Object} value The value to set
    *     the setting to.
diff --git a/chrome/browser/resources/print_preview/new/state.js b/chrome/browser/resources/print_preview/new/state.js
index 6186352..99cb889 100644
--- a/chrome/browser/resources/print_preview/new/state.js
+++ b/chrome/browser/resources/print_preview/new/state.js
@@ -11,6 +11,7 @@
  *   cloudPrintError: string,
  *   privetExtensionError: string,
  *   invalidSettings: boolean,
+ *   initialized: boolean,
  *   cancelled: boolean,
  * }}
  */
diff --git a/chrome/browser/resources/print_preview/print_preview_resources.grd b/chrome/browser/resources/print_preview/print_preview_resources.grd
index 84dea25..943dce160 100644
--- a/chrome/browser/resources/print_preview/print_preview_resources.grd
+++ b/chrome/browser/resources/print_preview/print_preview_resources.grd
@@ -113,6 +113,15 @@
       <structure name="IDR_PRINT_PREVIEW_DATA_PRINTABLE_AREA_JS"
                  file="data/printable_area.js"
                  type="chrome_html" />
+      <structure name="IDR_PRINT_PREVIEW_NEW_PREVIEW_AREA_HTML"
+                 file="new/preview_area.html"
+                 type="chrome_html" />
+      <structure name="IDR_PRINT_PREVIEW_NEW_PREVIEW_AREA_JS"
+                 file="new/preview_area.js"
+                 type="chrome_html" />
+      <structure name="IDR_PDF_PDF_SCRIPTING_API_JS"
+                 file="../pdf/pdf_scripting_api.js"
+                 type="chrome_html" />
       <structure name="IDR_PRINT_PREVIEW_NEW_HEADER_HTML"
                  file="new/header.html"
                  type="chrome_html" />
diff --git a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_export_dialog.html b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_export_dialog.html
index 6da824f..9353ae7e 100644
--- a/chrome/browser/resources/settings/passwords_and_forms_page/passwords_export_dialog.html
+++ b/chrome/browser/resources/settings/passwords_and_forms_page/passwords_export_dialog.html
@@ -1,7 +1,6 @@
 <link rel="import" href="chrome://resources/html/polymer.html">
 
 <link rel="import" href="chrome://resources/cr_elements/cr_dialog/cr_dialog.html">
-<link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
 <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
 <link rel="import" href="../settings_shared_css.html">
@@ -9,15 +8,11 @@
 <dom-module id="passwords-export-dialog">
   <template>
     <style include="settings-shared iron-flex">
-      #info-icon {
-        padding-right: 15px;
-      }
     </style>
     <dialog is="cr-dialog" id="dialog" close-text="$i18n{close}">
       <div slot="title">$i18n{exportPasswordsTitle}</div>
       <div slot="body">
         <div class="layout horizontal center">
-          <iron-icon icon="settings:info-outline" id="info-icon"></iron-icon>
           <div>$i18n{exportPasswordsDescription}</div>
         </div>
       </div>
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index 49bb87f..2641c2c 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -957,7 +957,13 @@
             new_tab->GetMainFrame()->GetEnabledBindings());
 }
 
-IN_PROC_BROWSER_TEST_F(SessionRestoreTest, RestoreWebUISettings) {
+// http://crbug.com/803510 : Flaky on Win7 Tests (dbg)
+#if defined(OS_WIN) && !defined(NDEBUG)
+#define MAYBE_RestoreWebUISettings DISABLED_RestoreWebUISettings
+#else
+#define MAYBE_RestoreWebUISettings RestoreWebUISettings
+#endif
+IN_PROC_BROWSER_TEST_F(SessionRestoreTest, MAYBE_RestoreWebUISettings) {
   const GURL webui_url("chrome://settings");
   ui_test_utils::NavigateToURL(browser(), webui_url);
   content::WebContents* old_tab =
diff --git a/chrome/browser/signin/dice_browsertest.cc b/chrome/browser/signin/dice_browsertest.cc
index e6f4175..e3aaaa7d 100644
--- a/chrome/browser/signin/dice_browsertest.cc
+++ b/chrome/browser/signin/dice_browsertest.cc
@@ -32,6 +32,7 @@
 #include "chrome/browser/ui/profile_chooser_constants.h"
 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
+#include "chrome/browser/ui/webui/signin/login_ui_test_utils.h"
 #include "chrome/common/webui_url_constants.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/ui_test_utils.h"
@@ -954,9 +955,6 @@
   SendRefreshTokenResponse();
   EXPECT_TRUE(GetTokenService()->RefreshTokenIsAvailable(GetMainAccountID()));
 
-  // Receive ENABLE_SYNC.
-  SendEnableSyncResponse();
-
   // Check that the Dice request header was sent, with no signout confirmation.
   std::string client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id();
   EXPECT_EQ(
@@ -965,6 +963,9 @@
                          signin::kDiceProtocolVersion, client_id.c_str()),
       dice_request_header_);
 
+  // Receive ENABLE_SYNC.
+  SendEnableSyncResponse();
+
   WaitForSigninSucceeded();
   EXPECT_EQ(GetMainAccountID(),
             GetSigninManager()->GetAuthenticatedAccountId());
@@ -978,9 +979,9 @@
       GURL(chrome::kChromeUINewTabURL),
       content::NotificationService::AllSources());
 
-  // Dismiss the OneClickSigninSyncStarter.
-  LoginUIServiceFactory::GetForProfile(browser()->profile())
-      ->SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS);
+  // Dismiss the Sync confirmation UI.
+  EXPECT_TRUE(login_ui_test_utils::DismissSyncConfirmationDialog(
+      browser(), base::TimeDelta::FromSeconds(30)));
 }
 
 // Tests that Sync is enabled if the ENABLE_SYNC response is received before the
@@ -1001,11 +1002,6 @@
       https_server_.GetURL(kEnableSyncURL),
       content::NotificationService::AllSources());
 
-  // Receive token.
-  EXPECT_FALSE(GetTokenService()->RefreshTokenIsAvailable(GetMainAccountID()));
-  SendRefreshTokenResponse();
-  EXPECT_TRUE(GetTokenService()->RefreshTokenIsAvailable(GetMainAccountID()));
-
   // Check that the Dice request header was sent, with no signout confirmation.
   std::string client_id = GaiaUrls::GetInstance()->oauth2_chrome_client_id();
   EXPECT_EQ(
@@ -1014,6 +1010,11 @@
                          signin::kDiceProtocolVersion, client_id.c_str()),
       dice_request_header_);
 
+  // Receive token.
+  EXPECT_FALSE(GetTokenService()->RefreshTokenIsAvailable(GetMainAccountID()));
+  SendRefreshTokenResponse();
+  EXPECT_TRUE(GetTokenService()->RefreshTokenIsAvailable(GetMainAccountID()));
+
   WaitForSigninSucceeded();
   EXPECT_EQ(GetMainAccountID(),
             GetSigninManager()->GetAuthenticatedAccountId());
@@ -1027,7 +1028,7 @@
       GURL(chrome::kChromeUINewTabURL),
       content::NotificationService::AllSources());
 
-  // Dismiss the OneClickSigninSyncStarter.
-  LoginUIServiceFactory::GetForProfile(browser()->profile())
-      ->SyncConfirmationUIClosed(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS);
+  // Dismiss the Sync confirmation UI.
+  EXPECT_TRUE(login_ui_test_utils::DismissSyncConfirmationDialog(
+      browser(), base::TimeDelta::FromSeconds(30)));
 }
diff --git a/chrome/browser/ssl/bad_clock_blocking_page.cc b/chrome/browser/ssl/bad_clock_blocking_page.cc
index f0d5ba6d..c00ef64 100644
--- a/chrome/browser/ssl/bad_clock_blocking_page.cc
+++ b/chrome/browser/ssl/bad_clock_blocking_page.cc
@@ -7,7 +7,6 @@
 #include <utility>
 
 #include "base/callback_helpers.h"
-#include "base/memory/ptr_util.h"
 #include "base/strings/string_number_conversions.h"
 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
 #include "chrome/browser/profiles/profile.h"
@@ -44,7 +43,7 @@
   security_interstitials::MetricsHelper::ReportDetails reporting_info;
   reporting_info.metric_prefix = kMetricsName;
   std::unique_ptr<ChromeMetricsHelper> metrics_helper =
-      base::MakeUnique<ChromeMetricsHelper>(web_contents, request_url,
+      std::make_unique<ChromeMetricsHelper>(web_contents, request_url,
                                             reporting_info, kMetricsName);
   metrics_helper.get()->StartRecordingCaptivePortalMetrics(false);
   return metrics_helper;
@@ -77,7 +76,7 @@
           std::move(ssl_cert_reporter),
           false /* overridable */,
           time_triggered,
-          base::MakeUnique<SSLErrorControllerClient>(
+          std::make_unique<SSLErrorControllerClient>(
               web_contents,
               ssl_info,
               request_url,
diff --git a/chrome/browser/ssl/captive_portal_blocking_page.cc b/chrome/browser/ssl/captive_portal_blocking_page.cc
index afa5389..fbc321e 100644
--- a/chrome/browser/ssl/captive_portal_blocking_page.cc
+++ b/chrome/browser/ssl/captive_portal_blocking_page.cc
@@ -7,7 +7,6 @@
 #include <utility>
 
 #include "base/i18n/rtl.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_util.h"
@@ -55,7 +54,7 @@
   security_interstitials::MetricsHelper::ReportDetails reporting_info;
   reporting_info.metric_prefix = kMetricsName;
   std::unique_ptr<ChromeMetricsHelper> metrics_helper =
-      base::MakeUnique<ChromeMetricsHelper>(web_contents, request_url,
+      std::make_unique<ChromeMetricsHelper>(web_contents, request_url,
                                             reporting_info, kMetricsName);
   metrics_helper.get()->StartRecordingCaptivePortalMetrics(false);
   return metrics_helper;
@@ -82,7 +81,7 @@
           std::move(ssl_cert_reporter),
           false /* overridable */,
           base::Time::Now(),
-          base::MakeUnique<SSLErrorControllerClient>(
+          std::make_unique<SSLErrorControllerClient>(
               web_contents,
               ssl_info,
               request_url,
diff --git a/chrome/browser/ssl/captive_portal_helper_android.cc b/chrome/browser/ssl/captive_portal_helper_android.cc
index 3339752d..6c75886 100644
--- a/chrome/browser/ssl/captive_portal_helper_android.cc
+++ b/chrome/browser/ssl/captive_portal_helper_android.cc
@@ -7,6 +7,8 @@
 
 #include <stddef.h>
 
+#include <memory>
+
 #include "base/android/jni_string.h"
 #include "base/logging.h"
 #include "base/threading/thread_task_runner_handle.h"
@@ -24,7 +26,7 @@
     const base::android::JavaParamRef<jstring>& jhash) {
   const std::string hash = ConvertJavaStringToUTF8(env, jhash);
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(INT_MAX);
   config_proto->add_captive_portal_cert()->set_sha256_hash(hash);
 
diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter.cc b/chrome/browser/ssl/chrome_expect_ct_reporter.cc
index b7806f4..e03ecc7 100644
--- a/chrome/browser/ssl/chrome_expect_ct_reporter.cc
+++ b/chrome/browser/ssl/chrome_expect_ct_reporter.cc
@@ -11,7 +11,6 @@
 #include "base/command_line.h"
 #include "base/feature_list.h"
 #include "base/json/json_writer.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_functions.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
@@ -60,13 +59,13 @@
 std::unique_ptr<base::ListValue> GetPEMEncodedChainAsList(
     const net::X509Certificate* cert_chain) {
   if (!cert_chain)
-    return base::MakeUnique<base::ListValue>();
+    return std::make_unique<base::ListValue>();
 
   std::unique_ptr<base::ListValue> result(new base::ListValue());
   std::vector<std::string> pem_encoded_chain;
   cert_chain->GetPEMEncodedChain(&pem_encoded_chain);
   for (const std::string& cert : pem_encoded_chain)
-    result->Append(base::MakeUnique<base::Value>(cert));
+    result->Append(std::make_unique<base::Value>(cert));
 
   return result;
 }
@@ -171,7 +170,7 @@
 
   base::DictionaryValue outer_report;
   base::DictionaryValue* report = outer_report.SetDictionary(
-      "expect-ct-report", base::MakeUnique<base::DictionaryValue>());
+      "expect-ct-report", std::make_unique<base::DictionaryValue>());
   report->SetString("hostname", host_port_pair.host());
   report->SetInteger("port", host_port_pair.port());
   report->SetString("date-time", TimeToISO8601(base::Time::Now()));
@@ -277,7 +276,7 @@
   url_request->SetExtraRequestHeaders(extra_headers);
 
   net::URLRequest* raw_request = url_request.get();
-  inflight_preflights_[raw_request] = base::MakeUnique<PreflightInProgress>(
+  inflight_preflights_[raw_request] = std::make_unique<PreflightInProgress>(
       std::move(url_request), serialized_report, report_uri);
   raw_request->Start();
 }
diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc b/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc
index f6e84d8c..50b09bb2 100644
--- a/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc
+++ b/chrome/browser/ssl/chrome_expect_ct_reporter_browsertest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/run_loop.h"
@@ -29,7 +31,7 @@
   ExpectCTBrowserTest() : CertVerifierBrowserTest() {}
 
   void SetUpOnMainThread() override {
-    run_loop_ = base::MakeUnique<base::RunLoop>();
+    run_loop_ = std::make_unique<base::RunLoop>();
   }
 
   void TearDown() override { run_loop_.reset(nullptr); }
diff --git a/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc b/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc
index d5ef9e9..627c321 100644
--- a/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc
+++ b/chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc
@@ -364,7 +364,7 @@
     if (handled_preflight_) {
       return;
     }
-    preflight_run_loop_ = base::MakeUnique<base::RunLoop>();
+    preflight_run_loop_ = std::make_unique<base::RunLoop>();
     preflight_run_loop_->Run();
   }
 
diff --git a/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc b/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc
index 4253684b..67de6fa 100644
--- a/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc
+++ b/chrome/browser/ssl/chrome_ssl_host_state_delegate.cc
@@ -16,7 +16,6 @@
 #include "base/command_line.h"
 #include "base/guid.h"
 #include "base/logging.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/time/clock.h"
@@ -264,7 +263,7 @@
 
     cert_error_dict =
         dict->SetDictionary(kSSLCertDecisionCertErrorMapKey,
-                            base::MakeUnique<base::DictionaryValue>());
+                            std::make_unique<base::DictionaryValue>());
   }
 
   return cert_error_dict;
diff --git a/chrome/browser/ssl/insecure_sensitive_input_driver_factory.cc b/chrome/browser/ssl/insecure_sensitive_input_driver_factory.cc
index 025cf26..fb8be49 100644
--- a/chrome/browser/ssl/insecure_sensitive_input_driver_factory.cc
+++ b/chrome/browser/ssl/insecure_sensitive_input_driver_factory.cc
@@ -30,7 +30,7 @@
       static_cast<security_state::SSLStatusInputEventData*>(
           ssl.user_data.get());
   if (!input_events) {
-    ssl.user_data = base::MakeUnique<security_state::SSLStatusInputEventData>();
+    ssl.user_data = std::make_unique<security_state::SSLStatusInputEventData>();
     input_events = static_cast<security_state::SSLStatusInputEventData*>(
         ssl.user_data.get());
   }
@@ -82,7 +82,7 @@
       frame_driver_map_.insert(std::make_pair(render_frame_host, nullptr));
   if (insertion_result.second) {
     insertion_result.first->second =
-        base::MakeUnique<InsecureSensitiveInputDriver>(render_frame_host);
+        std::make_unique<InsecureSensitiveInputDriver>(render_frame_host);
   }
   return insertion_result.first->second.get();
 }
diff --git a/chrome/browser/ssl/insecure_sensitive_input_driver_unittest.cc b/chrome/browser/ssl/insecure_sensitive_input_driver_unittest.cc
index 334d14d..8335064 100644
--- a/chrome/browser/ssl/insecure_sensitive_input_driver_unittest.cc
+++ b/chrome/browser/ssl/insecure_sensitive_input_driver_unittest.cc
@@ -83,7 +83,7 @@
   subframe = content::NavigationSimulator::NavigateAndCommitFromDocument(
       GURL("http://example2.test"), subframe);
   auto subframe_driver =
-      base::MakeUnique<InsecureSensitiveInputDriver>(subframe);
+      std::make_unique<InsecureSensitiveInputDriver>(subframe);
   subframe_driver->PasswordFieldVisibleInInsecureContext();
 
   content::NavigationEntry* entry =
@@ -121,7 +121,7 @@
   subframe = content::NavigationSimulator::NavigateAndCommitFromDocument(
       GURL("http://example2.test"), subframe);
   auto subframe_driver =
-      base::MakeUnique<InsecureSensitiveInputDriver>(subframe);
+      std::make_unique<InsecureSensitiveInputDriver>(subframe);
   subframe_driver->PasswordFieldVisibleInInsecureContext();
 
   entry = web_contents()->GetController().GetVisibleEntry();
@@ -151,7 +151,7 @@
   subframe = content::NavigationSimulator::NavigateAndCommitFromDocument(
       GURL("http://example2.test"), subframe);
   auto subframe_driver =
-      base::MakeUnique<InsecureSensitiveInputDriver>(subframe);
+      std::make_unique<InsecureSensitiveInputDriver>(subframe);
   content::RenderFrameHostTester* subframe_tester =
       content::RenderFrameHostTester::For(subframe);
   subframe_driver->PasswordFieldVisibleInInsecureContext();
@@ -196,7 +196,7 @@
                           GURL("http://example2.test"),
                           ui::PAGE_TRANSITION_TYPED);
 
-  auto driver = base::MakeUnique<InsecureSensitiveInputDriver>(main_rfh());
+  auto driver = std::make_unique<InsecureSensitiveInputDriver>(main_rfh());
   driver->PasswordFieldVisibleInInsecureContext();
   content::NavigationEntry* entry =
       web_contents()->GetController().GetVisibleEntry();
@@ -251,7 +251,7 @@
   subframe = content::NavigationSimulator::NavigateAndCommitFromDocument(
       GURL("http://example2.test"), subframe);
   auto subframe_driver =
-      base::MakeUnique<InsecureSensitiveInputDriver>(subframe);
+      std::make_unique<InsecureSensitiveInputDriver>(subframe);
   subframe_driver->DidEditFieldInInsecureContext();
 
   EXPECT_EQ(url, entry->GetURL());
diff --git a/chrome/browser/ssl/mitm_software_blocking_page.cc b/chrome/browser/ssl/mitm_software_blocking_page.cc
index d63bdbd..2b12a5fc 100644
--- a/chrome/browser/ssl/mitm_software_blocking_page.cc
+++ b/chrome/browser/ssl/mitm_software_blocking_page.cc
@@ -7,7 +7,6 @@
 #include <utility>
 
 #include "base/callback_helpers.h"
-#include "base/memory/ptr_util.h"
 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/renderer_preferences_util.h"
@@ -43,7 +42,7 @@
   security_interstitials::MetricsHelper::ReportDetails reporting_info;
   reporting_info.metric_prefix = kMetricsName;
   std::unique_ptr<ChromeMetricsHelper> metrics_helper =
-      base::MakeUnique<ChromeMetricsHelper>(web_contents, request_url,
+      std::make_unique<ChromeMetricsHelper>(web_contents, request_url,
                                             reporting_info, kMetricsName);
   metrics_helper.get()->StartRecordingCaptivePortalMetrics(false);
   return metrics_helper;
@@ -77,7 +76,7 @@
           std::move(ssl_cert_reporter),
           false /* overridable */,
           base::Time::Now(),
-          base::MakeUnique<SSLErrorControllerClient>(
+          std::make_unique<SSLErrorControllerClient>(
               web_contents,
               ssl_info,
               request_url,
diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
index f2f57a9..e48ad7a28 100644
--- a/chrome/browser/ssl/security_state_tab_helper.cc
+++ b/chrome/browser/ssl/security_state_tab_helper.cc
@@ -20,6 +20,7 @@
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/ssl_status.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/origin_util.h"
 #include "net/base/net_errors.h"
@@ -109,6 +110,15 @@
     return;
   }
 
+  content::NavigationEntry* entry =
+      web_contents()->GetController().GetLastCommittedEntry();
+  if (entry) {
+    UMA_HISTOGRAM_ENUMERATION(
+        "Security.CertificateTransparency.MainFrameNavigationCompliance",
+        entry->GetSSL().ct_policy_compliance,
+        net::ct::CTPolicyCompliance::CT_POLICY_MAX);
+  }
+
   logged_http_warning_on_current_navigation_ = false;
 
   security_state::SecurityInfo security_info;
diff --git a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
index 795b5ea..5b202111 100644
--- a/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
+++ b/chrome/browser/ssl/security_state_tab_helper_browsertest.cc
@@ -49,10 +49,8 @@
 #include "net/base/net_errors.h"
 #include "net/cert/cert_status_flags.h"
 #include "net/cert/cert_verify_result.h"
+#include "net/cert/ct_policy_status.h"
 #include "net/cert/mock_cert_verifier.h"
-#include "net/cert/sct_status_flags.h"
-#include "net/cert/signed_certificate_timestamp.h"
-#include "net/cert/signed_certificate_timestamp_and_status.h"
 #include "net/cert/x509_certificate.h"
 #include "net/dns/mock_host_resolver.h"
 #include "net/ssl/ssl_cipher_suite_names.h"
@@ -114,7 +112,7 @@
           ssl.user_data.get());
   if (!input_events) {
     ssl.user_data =
-        base::MakeUnique<security_state::SSLStatusInputEventData>(events);
+        std::make_unique<security_state::SSLStatusInputEventData>(events);
   } else {
     *input_events->input_events() = events;
   }
@@ -1426,15 +1424,6 @@
   helper->GetSecurityInfo(&security_info);
   EXPECT_EQ(security_state::NONE, security_info.security_level);
 
-  // Verify an InsertText operation isn't treated as user-input.
-  EXPECT_TRUE(content::ExecuteScript(
-      contents, "document.execCommand('InsertText',false,'a');"));
-  InjectScript(contents);
-  base::RunLoop().RunUntilIdle();
-  helper->GetSecurityInfo(&security_info);
-  ASSERT_EQ(security_state::NONE, security_info.security_level);
-  ASSERT_FALSE(security_info.field_edit_downgraded_security_level);
-
   // Type one character into the focused input control and wait for a security
   // state change.
   SecurityStyleTestObserver observer(contents);
@@ -1487,6 +1476,46 @@
   EXPECT_EQ(0u, observer.latest_explanations().neutral_explanations.size());
 }
 
+// Tests that the security level of a HTTP page is not downgraded when a form
+// field is modified by JavaScript.
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
+                       SecurityLevelNotDowngradedAfterScriptModification) {
+  content::WebContents* contents =
+      browser()->tab_strip_model()->GetActiveWebContents();
+
+  SecurityStateTabHelper* helper =
+      SecurityStateTabHelper::FromWebContents(contents);
+  ASSERT_TRUE(helper);
+
+  // Navigate to an HTTP page. Use a non-local hostname so that it is
+  // not considered secure.
+  ui_test_utils::NavigateToURL(
+      browser(),
+      GetURLWithNonLocalHostname(embedded_test_server(),
+                                 "/textinput/focus_input_on_load.html"));
+  security_state::SecurityInfo security_info;
+  helper->GetSecurityInfo(&security_info);
+  EXPECT_EQ(security_state::NONE, security_info.security_level);
+
+  // Verify a value set operation isn't treated as user-input.
+  EXPECT_TRUE(content::ExecuteScript(
+      contents, "document.getElementById('text_id').value='v';"));
+  InjectScript(contents);
+  base::RunLoop().RunUntilIdle();
+  helper->GetSecurityInfo(&security_info);
+  ASSERT_EQ(security_state::NONE, security_info.security_level);
+  ASSERT_FALSE(security_info.field_edit_downgraded_security_level);
+
+  // Verify an InsertText operation isn't treated as user-input.
+  EXPECT_TRUE(content::ExecuteScript(
+      contents, "document.execCommand('InsertText',false,'a');"));
+  InjectScript(contents);
+  base::RunLoop().RunUntilIdle();
+  helper->GetSecurityInfo(&security_info);
+  ASSERT_EQ(security_state::NONE, security_info.security_level);
+  ASSERT_FALSE(security_info.field_edit_downgraded_security_level);
+}
+
 // A Browser subclass that keeps track of messages that have been
 // added to the console. Messages can be retrieved or cleared with
 // console_messages() and ClearConsoleMessages(). The user of this class
@@ -2626,4 +2655,18 @@
   }
 }
 
+// Tests that the Certificate Transparency compliance of the main resource is
+// recorded in a histogram.
+IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, CTComplianceHistogram) {
+  const char kHistogramName[] =
+      "Security.CertificateTransparency.MainFrameNavigationCompliance";
+  SetUpMockCertVerifierForHttpsServer(0, net::OK);
+  base::HistogramTester histograms;
+  ui_test_utils::NavigateToURL(browser(),
+                               https_server_.GetURL("/ssl/google.html"));
+  histograms.ExpectUniqueSample(
+      kHistogramName, net::ct::CTPolicyCompliance::CT_POLICY_NOT_ENOUGH_SCTS,
+      1);
+}
+
 }  // namespace
diff --git a/chrome/browser/ssl/security_state_tab_helper_unittest.cc b/chrome/browser/ssl/security_state_tab_helper_unittest.cc
index 56551517f..4f6600a8 100644
--- a/chrome/browser/ssl/security_state_tab_helper_unittest.cc
+++ b/chrome/browser/ssl/security_state_tab_helper_unittest.cc
@@ -41,7 +41,7 @@
           ssl.user_data.get());
   if (!input_events) {
     ssl.user_data =
-        base::MakeUnique<security_state::SSLStatusInputEventData>(events);
+        std::make_unique<security_state::SSLStatusInputEventData>(events);
   } else {
     *input_events->input_events() = events;
   }
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index e431c7bd..ee75c49 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -4,12 +4,12 @@
 
 #include "chrome/browser/ssl/ssl_blocking_page.h"
 
+#include <memory>
 #include <utility>
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/callback_helpers.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/time/time.h"
@@ -71,7 +71,7 @@
     reporting_info.metric_prefix =
         overridable ? "ssl_overridable" : "ssl_nonoverridable";
   }
-  return base::MakeUnique<ChromeMetricsHelper>(
+  return std::make_unique<ChromeMetricsHelper>(
       web_contents, request_url, reporting_info,
       GetSamplingEventName(overridable, cert_error));
 }
@@ -153,7 +153,7 @@
           std::move(ssl_cert_reporter),
           overridable,
           time_triggered,
-          base::MakeUnique<SSLErrorControllerClient>(
+          std::make_unique<SSLErrorControllerClient>(
               web_contents,
               ssl_info,
               request_url,
@@ -165,14 +165,14 @@
           (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0),
       ssl_error_ui_(
           is_superfish
-              ? base::MakeUnique<security_interstitials::SuperfishErrorUI>(
+              ? std::make_unique<security_interstitials::SuperfishErrorUI>(
                     request_url,
                     cert_error,
                     ssl_info,
                     options_mask,
                     time_triggered,
                     controller())
-              : base::MakeUnique<SSLErrorUI>(request_url,
+              : std::make_unique<SSLErrorUI>(request_url,
                                              cert_error,
                                              ssl_info,
                                              options_mask,
diff --git a/chrome/browser/ssl/ssl_browsertest.cc b/chrome/browser/ssl/ssl_browsertest.cc
index 2e9ef8f..8c5895bd 100644
--- a/chrome/browser/ssl/ssl_browsertest.cc
+++ b/chrome/browser/ssl/ssl_browsertest.cc
@@ -2,6 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <memory>
 #include <utility>
 
 #include "base/base64.h"
@@ -989,11 +990,75 @@
   void SendInterstitialCommand(
       WebContents* tab,
       security_interstitials::SecurityInterstitialCommand command) override {
-    // TODO(crbug.com/785077): Execute script inside the interstitial.
     if (IsCommittedInterstitialTest()) {
-      SSLErrorTabHelper* helper = SSLErrorTabHelper::FromWebContents(tab);
-      helper->GetBlockingPageForCurrentlyCommittedNavigationForTesting()
-          ->CommandReceived(base::IntToString(command));
+      std::string javascript;
+      switch (command) {
+        case security_interstitials::CMD_DONT_PROCEED: {
+          javascript = "window.certificateErrorPageController.dontProceed();";
+          break;
+        }
+        case security_interstitials::CMD_PROCEED: {
+          javascript = "window.certificateErrorPageController.proceed();";
+          break;
+        }
+        case security_interstitials::CMD_SHOW_MORE_SECTION: {
+          javascript =
+              "window.certificateErrorPageController.showMoreSection();";
+          break;
+        }
+        case security_interstitials::CMD_OPEN_HELP_CENTER: {
+          javascript =
+              "window.certificateErrorPageController.openHelpCenter();";
+          break;
+        }
+        case security_interstitials::CMD_OPEN_DIAGNOSTIC: {
+          javascript =
+              "window.certificateErrorPageController.openDiagnostic();";
+          break;
+        }
+        case security_interstitials::CMD_RELOAD: {
+          javascript = "window.certificateErrorPageController.reload();";
+          break;
+        }
+        case security_interstitials::CMD_OPEN_DATE_SETTINGS: {
+          javascript =
+              "window.certificateErrorPageController.openDateSettings();";
+          break;
+        }
+        case security_interstitials::CMD_OPEN_LOGIN: {
+          javascript = "window.certificateErrorPageController.openLogin();";
+          break;
+        }
+        case security_interstitials::CMD_DO_REPORT: {
+          javascript = "window.certificateErrorPageController.doReport();";
+          break;
+        }
+        case security_interstitials::CMD_DONT_REPORT: {
+          javascript = "window.certificateErrorPageController.dontReport();";
+          break;
+        }
+        case security_interstitials::CMD_OPEN_REPORTING_PRIVACY: {
+          javascript =
+              "window.certificateErrorPageController.openReportingPrivacy();";
+          break;
+        }
+        case security_interstitials::CMD_OPEN_WHITEPAPER: {
+          javascript =
+              "window.certificateErrorPageController.openWhitepaper();";
+          break;
+        }
+        case security_interstitials::CMD_REPORT_PHISHING_ERROR: {
+          javascript =
+              "window.certificateErrorPageController.reportPhishingError();";
+          break;
+        }
+        default: {
+          // Other values in the enum are not used by these tests, and don't
+          // have a Javascript equivalent that can be called here.
+          NOTREACHED();
+        }
+      }
+      ASSERT_TRUE(content::ExecuteScript(tab, javascript));
       return;
     }
     SSLUITestBase::SendInterstitialCommand(tab, command);
@@ -1441,7 +1506,7 @@
 
 // Visits a page in an app window with https error and proceed:
 IN_PROC_BROWSER_TEST_P(SSLUITest, InAppTestHTTPSExpiredCertAndProceed) {
-  auto feature_list = base::MakeUnique<base::test::ScopedFeatureList>();
+  auto feature_list = std::make_unique<base::test::ScopedFeatureList>();
   feature_list->InitAndEnableFeature(features::kDesktopPWAWindowing);
 
   ASSERT_TRUE(https_server_expired_.Start());
@@ -3909,9 +3974,7 @@
 #endif  // !defined(OS_CHROMEOS)
 
 // Verifies that the interstitial can proceed, even if JavaScript is disabled.
-// http://crbug.com/322948
-// TODO(estark): fix for committed interstitials. https://crbug.com/792135
-IN_PROC_BROWSER_TEST_F(SSLUITestBase, TestInterstitialJavaScriptProceeds) {
+IN_PROC_BROWSER_TEST_P(SSLUITest, TestInterstitialJavaScriptProceeds) {
   HostContentSettingsMapFactory::GetForProfile(browser()->profile())
       ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT,
                                  CONTENT_SETTING_BLOCK);
@@ -3929,14 +3992,20 @@
   content::WindowedNotificationObserver observer(
       content::NOTIFICATION_LOAD_STOP,
       content::Source<NavigationController>(&tab->GetController()));
-  int result = security_interstitials::CMD_ERROR;
-  const std::string javascript =
-      base::StringPrintf("window.domAutomationController.send(%d);",
-                         security_interstitials::CMD_PROCEED);
-  ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
-      tab->GetInterstitialPage()->GetMainFrame(), javascript, &result));
-  // The above will hang without the fix.
-  EXPECT_EQ(1, result);
+  if (AreCommittedInterstitialsEnabled()) {
+    const std::string javascript =
+        "window.certificateErrorPageController.proceed();";
+    EXPECT_TRUE(content::ExecuteScript(tab, javascript));
+  } else {
+    int result = security_interstitials::CMD_ERROR;
+    const std::string javascript =
+        base::StringPrintf("window.domAutomationController.send(%d);",
+                           security_interstitials::CMD_PROCEED);
+    ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
+        tab->GetInterstitialPage()->GetMainFrame(), javascript, &result));
+    // The above will hang without the fix.
+    EXPECT_EQ(1, result);
+  }
   observer.Wait();
   CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
                                  AuthState::NONE);
@@ -3944,8 +4013,7 @@
 
 // Verifies that the interstitial can go back, even if JavaScript is disabled.
 // http://crbug.com/322948
-// TODO(estark): fix for committed interstitials. https://crbug.com/792135
-IN_PROC_BROWSER_TEST_F(SSLUITestBase, TestInterstitialJavaScriptGoesBack) {
+IN_PROC_BROWSER_TEST_P(SSLUITest, TestInterstitialJavaScriptGoesBack) {
   HostContentSettingsMapFactory::GetForProfile(browser()->profile())
       ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT,
                                  CONTENT_SETTING_BLOCK);
@@ -3958,16 +4026,25 @@
                                  AuthState::SHOWING_INTERSTITIAL);
   WaitForInterstitial(tab);
   ASSERT_NO_FATAL_FAILURE(ExpectSSLInterstitial(tab));
-
-  int result = security_interstitials::CMD_ERROR;
-  const std::string javascript =
-      base::StringPrintf("window.domAutomationController.send(%d);",
-                         security_interstitials::CMD_DONT_PROCEED);
-  ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
-      tab->GetInterstitialPage()->GetMainFrame(), javascript, &result));
-  // The above will hang without the fix.
-  EXPECT_EQ(0, result);
-  WaitForInterstitialDetach(tab);
+  if (AreCommittedInterstitialsEnabled()) {
+    content::WindowedNotificationObserver observer(
+        content::NOTIFICATION_LOAD_STOP,
+        content::Source<NavigationController>(&tab->GetController()));
+    const std::string javascript =
+        "window.certificateErrorPageController.dontProceed();";
+    EXPECT_TRUE(content::ExecuteScript(tab, javascript));
+    observer.Wait();
+  } else {
+    int result = security_interstitials::CMD_ERROR;
+    const std::string javascript =
+        base::StringPrintf("window.domAutomationController.send(%d);",
+                           security_interstitials::CMD_DONT_PROCEED);
+    ASSERT_TRUE(content::ExecuteScriptAndExtractInt(
+        tab->GetInterstitialPage()->GetMainFrame(), javascript, &result));
+    // The above will hang without the fix.
+    EXPECT_EQ(0, result);
+    WaitForInterstitialDetach(tab);
+  }
   EXPECT_EQ("about:blank", tab->GetVisibleURL().spec());
 }
 
@@ -5583,7 +5660,7 @@
 MakeCaptivePortalConfig(int version_id,
                         const std::set<std::string>& spki_hashes) {
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(version_id);
   for (const std::string& hash : spki_hashes) {
     config_proto->add_captive_portal_cert()->set_sha256_hash(hash);
@@ -6075,7 +6152,7 @@
   // certificate as a MITM software certificate.
   void SetUpMITMSoftwareCertList(uint32_t version_id) {
     auto config_proto =
-        base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+        std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
     config_proto->set_version_id(version_id);
 
     chrome_browser_ssl::MITMSoftware* mitm_software =
@@ -6255,7 +6332,7 @@
   // Set up an error assistant proto with a list of MITM software regexed that
   // the certificate issued by our server won't match.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   chrome_browser_ssl::MITMSoftware* mitm_software =
       config_proto->add_mitm_software();
   mitm_software->set_name(kTestMITMSoftwareName);
@@ -6301,7 +6378,7 @@
   // Set up an error assistant proto with a list of MITM software regexed that
   // the certificate issued by our server won't match.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   chrome_browser_ssl::MITMSoftware* mitm_software =
       config_proto->add_mitm_software();
   mitm_software->set_name(kTestMITMSoftwareName);
@@ -6345,7 +6422,7 @@
   // Set up an error assistant proto with a list of MITM software regexes that
   // the certificate issued by our server won't match.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   chrome_browser_ssl::MITMSoftware* mitm_software =
       config_proto->add_mitm_software();
   mitm_software->set_name("Non-Matching MITM Software");
@@ -6708,7 +6785,7 @@
 
     https_server_.AddDefaultHandlers(base::FilePath(kDocRoot));
 
-    require_ct_delegate_ = base::MakeUnique<NoRequireCTDelegate>();
+    require_ct_delegate_ = std::make_unique<NoRequireCTDelegate>();
     content::BrowserThread::PostTask(
         content::BrowserThread::IO, FROM_HERE,
         base::BindOnce(
@@ -6858,7 +6935,7 @@
 std::unique_ptr<chrome_browser_ssl::SSLErrorAssistantConfig>
 MakeDynamicInterstitial(const std::vector<DynamicInterstitialInfo>& list) {
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   for (const DynamicInterstitialInfo& info : list) {
diff --git a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
index b4ac5fb7..b6058c69 100644
--- a/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
+++ b/chrome/browser/ssl/ssl_client_auth_requestor_mock.cc
@@ -5,7 +5,6 @@
 #include "chrome/browser/ssl/ssl_client_auth_requestor_mock.h"
 
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "content/public/browser/client_certificate_delegate.h"
 #include "net/ssl/ssl_cert_request_info.h"
 #include "net/url_request/url_request.h"
@@ -48,5 +47,5 @@
 
 std::unique_ptr<content::ClientCertificateDelegate>
 SSLClientAuthRequestorMock::CreateDelegate() {
-  return base::MakeUnique<FakeClientCertificateDelegate>(this);
+  return std::make_unique<FakeClientCertificateDelegate>(this);
 }
diff --git a/chrome/browser/ssl/ssl_error_assistant.cc b/chrome/browser/ssl/ssl_error_assistant.cc
index 69a443e..a262ce9f 100644
--- a/chrome/browser/ssl/ssl_error_assistant.cc
+++ b/chrome/browser/ssl/ssl_error_assistant.cc
@@ -4,8 +4,9 @@
 
 #include "chrome/browser/ssl/ssl_error_assistant.h"
 
+#include <memory>
+
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "build/build_config.h"
 #include "chrome/common/features.h"
 #include "chrome/grit/browser_resources.h"
@@ -70,7 +71,7 @@
 
 std::unique_ptr<std::unordered_set<std::string>> LoadCaptivePortalCertHashes(
     const chrome_browser_ssl::SSLErrorAssistantConfig& proto) {
-  auto hashes = base::MakeUnique<std::unordered_set<std::string>>();
+  auto hashes = std::make_unique<std::unordered_set<std::string>>();
   for (const chrome_browser_ssl::CaptivePortalCert& cert :
        proto.captive_portal_cert()) {
     hashes.get()->insert(cert.sha256_hash());
@@ -80,7 +81,7 @@
 
 std::unique_ptr<std::vector<MITMSoftwareType>> LoadMITMSoftwareList(
     const chrome_browser_ssl::SSLErrorAssistantConfig& proto) {
-  auto mitm_software_list = base::MakeUnique<std::vector<MITMSoftwareType>>();
+  auto mitm_software_list = std::make_unique<std::vector<MITMSoftwareType>>();
 
   for (const chrome_browser_ssl::MITMSoftware& proto_entry :
        proto.mitm_software()) {
@@ -106,7 +107,7 @@
 LoadDynamicInterstitialList(
     const chrome_browser_ssl::SSLErrorAssistantConfig& proto) {
   auto dynamic_interstitial_list =
-      base::MakeUnique<std::vector<DynamicInterstitialInfo>>();
+      std::make_unique<std::vector<DynamicInterstitialInfo>>();
   for (const chrome_browser_ssl::DynamicInterstitial& entry :
        proto.dynamic_interstitial()) {
     dynamic_interstitial_list.get()->push_back(DynamicInterstitialInfo(
@@ -120,7 +121,7 @@
 // Reads the SSL error assistant configuration from the resource bundle.
 std::unique_ptr<chrome_browser_ssl::SSLErrorAssistantConfig>
 ReadErrorAssistantProtoFromResourceBundle() {
-  auto proto = base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+  auto proto = std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
   DCHECK(proto);
   ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
diff --git a/chrome/browser/ssl/ssl_error_assistant_unittest.cc b/chrome/browser/ssl/ssl_error_assistant_unittest.cc
index 13ef950..ee1d2fa9 100644
--- a/chrome/browser/ssl/ssl_error_assistant_unittest.cc
+++ b/chrome/browser/ssl/ssl_error_assistant_unittest.cc
@@ -4,7 +4,8 @@
 
 #include "chrome/browser/ssl/ssl_error_assistant.h"
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "chrome/browser/ssl/ssl_error_assistant.pb.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "crypto/sha2.h"
@@ -101,7 +102,7 @@
 
  protected:
   SSLErrorAssistantTest() {
-    embedded_test_server_ = base::MakeUnique<net::EmbeddedTestServer>();
+    embedded_test_server_ = std::make_unique<net::EmbeddedTestServer>();
   }
 
   ~SSLErrorAssistantTest() override {}
@@ -130,7 +131,7 @@
 
   // Test without the known captive portal certificate in config_proto.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
   config_proto->add_captive_portal_cert()->set_sha256_hash("sha256/boxfish");
   config_proto->add_captive_portal_cert()->set_sha256_hash(
@@ -159,7 +160,7 @@
   ASSERT_TRUE(embedded_test_server()->Start());
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   // Tests for a basic and more complex regex match.
@@ -205,7 +206,7 @@
   EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   // Add a dynamic interstitial that will mismatch.
@@ -245,7 +246,7 @@
   EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   // Add a dynamic interstitial that will mismatch.
@@ -284,7 +285,7 @@
   EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::DynamicInterstitial* filter =
@@ -307,7 +308,7 @@
   EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::DynamicInterstitial* filter =
diff --git a/chrome/browser/ssl/ssl_error_handler.cc b/chrome/browser/ssl/ssl_error_handler.cc
index 6b77f00..64fde3d 100644
--- a/chrome/browser/ssl/ssl_error_handler.cc
+++ b/chrome/browser/ssl/ssl_error_handler.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/ssl/ssl_error_handler.h"
 
 #include <stdint.h>
+#include <memory>
 #include <unordered_set>
 #include <utility>
 
@@ -265,7 +266,7 @@
           base::TimeDelta::FromMilliseconds(kInterstitialDelayInMilliseconds)),
       is_enterprise_managed_for_testing_(ENTERPRISE_MANAGED_STATUS_NOT_SET),
       os_captive_portal_status_for_testing_(OS_CAPTIVE_PORTAL_STATUS_NOT_SET),
-      ssl_error_assistant_(base::MakeUnique<SSLErrorAssistant>()) {}
+      ssl_error_assistant_(std::make_unique<SSLErrorAssistant>()) {}
 
 base::TimeDelta ConfigSingleton::interstitial_delay() const {
   return interstitial_delay_;
diff --git a/chrome/browser/ssl/ssl_error_handler_unittest.cc b/chrome/browser/ssl/ssl_error_handler_unittest.cc
index 6a403416..5953b24 100644
--- a/chrome/browser/ssl/ssl_error_handler_unittest.cc
+++ b/chrome/browser/ssl/ssl_error_handler_unittest.cc
@@ -4,9 +4,10 @@
 
 #include "chrome/browser/ssl/ssl_error_handler.h"
 
+#include <memory>
+
 #include "base/callback.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/metrics/field_trial.h"
 #include "base/run_loop.h"
 #include "base/test/histogram_tester.h"
@@ -120,7 +121,7 @@
     const net::test_server::HttpRequest& request) {
   content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
                                    quit_closure);
-  return base::MakeUnique<net::test_server::HungResponse>();
+  return std::make_unique<net::test_server::HungResponse>();
 }
 
 class TestSSLErrorHandler : public SSLErrorHandler {
@@ -429,7 +430,7 @@
     EXPECT_EQ(1u, ssl_info().public_key_hashes.size());
 
     auto config_proto =
-        base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+        std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
     config_proto->set_version_id(kLargeVersionId);
 
     config_proto->add_captive_portal_cert()->set_sha256_hash(
@@ -499,7 +500,7 @@
   // outdated antivirus and misconfigured firewall certificate.
   void InitMITMSoftwareList() {
     auto config_proto =
-        base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+        std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
     config_proto->set_version_id(kLargeVersionId);
 
     chrome_browser_ssl::MITMSoftware* filter =
@@ -1216,7 +1217,7 @@
                               net::CERT_STATUS_AUTHORITY_INVALID);
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::MITMSoftware* filter = config_proto->add_mitm_software();
@@ -1238,7 +1239,7 @@
                               net::CERT_STATUS_AUTHORITY_INVALID);
 
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::MITMSoftware* filter = config_proto->add_mitm_software();
@@ -1283,7 +1284,7 @@
   // Register a MITM Software entry in the SSL error assistant proto that has a
   // common name regex but not an organization name regex.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::MITMSoftware* filter = config_proto->add_mitm_software();
@@ -1304,7 +1305,7 @@
   // Register a MITM Software entry in the SSL error assistant proto that has an
   // organization name regex, but not a common name regex.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::MITMSoftware* filter = config_proto->add_mitm_software();
@@ -1327,7 +1328,7 @@
   // regexes that will match part of each the certificate's common name and
   // organization name fields but not the entire field.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(kLargeVersionId);
 
   chrome_browser_ssl::MITMSoftware* filter = config_proto->add_mitm_software();
@@ -1455,7 +1456,7 @@
   // less than the version_id of the local resource bundle, so the dynamic
   // update will be ignored.
   auto config_proto =
-      base::MakeUnique<chrome_browser_ssl::SSLErrorAssistantConfig>();
+      std::make_unique<chrome_browser_ssl::SSLErrorAssistantConfig>();
   config_proto->set_version_id(0u);
 
   chrome_browser_ssl::MITMSoftware* filter = config_proto->add_mitm_software();
diff --git a/chrome/browser/ssl/ssl_error_tab_helper_unittest.cc b/chrome/browser/ssl/ssl_error_tab_helper_unittest.cc
index 672493f..c30fe6d0 100644
--- a/chrome/browser/ssl/ssl_error_tab_helper_unittest.cc
+++ b/chrome/browser/ssl/ssl_error_tab_helper_unittest.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/ssl/ssl_error_tab_helper.h"
 
+#include <memory>
+
 #include "base/bind.h"
 #include "base/time/time.h"
 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
@@ -25,7 +27,7 @@
     content::WebContents* web_contents) {
   security_interstitials::MetricsHelper::ReportDetails report_details;
   report_details.metric_prefix = kMetricsName;
-  return base::MakeUnique<ChromeMetricsHelper>(web_contents, GURL(),
+  return std::make_unique<ChromeMetricsHelper>(web_contents, GURL(),
                                                report_details, kMetricsName);
 }
 
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 211191f..1a43eba 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -3335,6 +3335,7 @@
       "app_list/chrome_app_list_item.h",
       "app_list/chrome_app_list_model_updater.cc",
       "app_list/chrome_app_list_model_updater.h",
+      "app_list/chrome_app_list_model_updater_delegate.h",
       "app_list/extension_app_context_menu.cc",
       "app_list/extension_app_context_menu.h",
       "app_list/extension_app_item.cc",
diff --git a/chrome/browser/ui/app_list/app_list_model_updater.h b/chrome/browser/ui/app_list/app_list_model_updater.h
index 9aad8e7..479b7d1 100644
--- a/chrome/browser/ui/app_list/app_list_model_updater.h
+++ b/chrome/browser/ui/app_list/app_list_model_updater.h
@@ -60,6 +60,20 @@
   virtual void PublishSearchResults(
       std::vector<std::unique_ptr<app_list::SearchResult>> results) {}
 
+  // Item field setters only used by ChromeAppListItem and its derived classes.
+  virtual void SetItemIcon(const std::string& id, const gfx::ImageSkia& icon) {}
+  virtual void SetItemName(const std::string& id, const std::string& name) {}
+  virtual void SetItemNameAndShortName(const std::string& id,
+                                       const std::string& name,
+                                       const std::string& short_name) {}
+  virtual void SetItemPosition(const std::string& id,
+                               const syncer::StringOrdinal& new_position) {}
+  virtual void SetItemFolderId(const std::string& id,
+                               const std::string& folder_id) {}
+  virtual void SetItemIsInstalling(const std::string& id, bool is_installing) {}
+  virtual void SetItemPercentDownloaded(const std::string& id,
+                                        int32_t percent_downloaded) {}
+
   // For AppListModel:
   virtual ChromeAppListItem* FindItem(const std::string& id) = 0;
   virtual size_t ItemCount() = 0;
@@ -76,21 +90,6 @@
 
  protected:
   virtual ~AppListModelUpdater() {}
-
-  // Item field setters only used by ChromeAppListItem and its derived classes.
-  virtual void SetItemIcon(const std::string& id, const gfx::ImageSkia& icon) {}
-  virtual void SetItemName(const std::string& id, const std::string& name) {}
-  virtual void SetItemNameAndShortName(const std::string& id,
-                                       const std::string& name,
-                                       const std::string& short_name) {}
-  virtual void SetItemPosition(const std::string& id,
-                               const syncer::StringOrdinal& new_position) {}
-  virtual void SetItemFolderId(const std::string& id,
-                               const std::string& folder_id) {}
-  virtual void SetItemIsInstalling(const std::string& id, bool is_installing) {}
-  virtual void SetItemPercentDownloaded(const std::string& id,
-                                        int32_t percent_downloaded) {}
 };
 
-
 #endif  // CHROME_BROWSER_UI_APP_LIST_APP_LIST_MODEL_UPDATER_H_
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc
index 53749d06..aa408f24 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.cc
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -27,6 +27,7 @@
 #include "chrome/browser/ui/app_list/arc/arc_app_model_builder.h"
 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
 #include "chrome/browser/ui/app_list/chrome_app_list_model_updater.h"
+#include "chrome/browser/ui/app_list/chrome_app_list_model_updater_delegate.h"
 #include "chrome/browser/ui/app_list/extension_app_item.h"
 #include "chrome/browser/ui/app_list/extension_app_model_builder.h"
 #include "chrome/common/chrome_switches.h"
@@ -215,23 +216,24 @@
 AppListSyncableService::SyncItem::~SyncItem() {
 }
 
-// AppListSyncableService::ModelObserver
+// AppListSyncableService::ModelUpdaterDelegate
 
-class AppListSyncableService::ModelObserver : public AppListModelObserver {
+class AppListSyncableService::ModelUpdaterDelegate
+    : public ChromeAppListModelUpdaterDelegate {
  public:
-  explicit ModelObserver(AppListSyncableService* owner) : owner_(owner) {
-    DVLOG(2) << owner_ << ": ModelObserver Added";
-    owner_->GetModel()->AddObserver(this);
+  explicit ModelUpdaterDelegate(AppListSyncableService* owner) : owner_(owner) {
+    DVLOG(2) << owner_ << ": ModelUpdaterDelegate Added";
+    owner_->GetModelUpdater()->SetDelegate(this);
   }
 
-  ~ModelObserver() override {
-    owner_->GetModel()->RemoveObserver(this);
-    DVLOG(2) << owner_ << ": ModelObserver Removed";
+  ~ModelUpdaterDelegate() override {
+    owner_->GetModelUpdater()->SetDelegate(nullptr);
+    DVLOG(2) << owner_ << ": ModelUpdaterDelegate Removed";
   }
 
  private:
-  // AppListModelObserver
-  void OnAppListItemAdded(AppListItem* item) override {
+  // ChromeAppListModelUpdaterDelegate
+  void OnAppListItemAdded(ChromeAppListItem* item) override {
     DCHECK(adding_item_id_.empty());
     adding_item_id_ = item->id();  // Ignore updates while adding an item.
     VLOG(2) << owner_ << " OnAppListItemAdded: " << item->ToDebugString();
@@ -239,7 +241,7 @@
     adding_item_id_.clear();
   }
 
-  void OnAppListItemWillBeDeleted(AppListItem* item) override {
+  void OnAppListItemWillBeDeleted(ChromeAppListItem* item) override {
     DCHECK(adding_item_id_.empty());
     VLOG(2) << owner_ << " OnAppListItemDeleted: " << item->ToDebugString();
     // Don't sync folder removal in case the folder still exists on another
@@ -257,7 +259,7 @@
     owner_->RemoveSyncItem(item->id());
   }
 
-  void OnAppListItemUpdated(AppListItem* item) override {
+  void OnAppListItemUpdated(ChromeAppListItem* item) override {
     if (!adding_item_id_.empty()) {
       // Adding an item may trigger update notifications which should be
       // ignored.
@@ -271,7 +273,7 @@
   AppListSyncableService* owner_;
   std::string adding_item_id_;
 
-  DISALLOW_COPY_AND_ASSIGN(ModelObserver);
+  DISALLOW_COPY_AND_ASSIGN(ModelUpdaterDelegate);
 };
 
 // AppListSyncableService
@@ -314,7 +316,7 @@
 
 AppListSyncableService::~AppListSyncableService() {
   // Remove observers.
-  model_observer_.reset();
+  model_updater_delegate_.reset();
 }
 
 bool AppListSyncableService::IsExtensionServiceReady() const {
@@ -438,7 +440,7 @@
 
 void AppListSyncableService::HandleUpdateStarted() {
   // Don't observe the model while processing update changes.
-  model_observer_.reset();
+  model_updater_delegate_.reset();
 }
 
 void AppListSyncableService::HandleUpdateFinished() {
@@ -449,7 +451,7 @@
   RemoveDriveAppItems();
 
   // Resume or start observing app list model changes.
-  model_observer_.reset(new ModelObserver(this));
+  model_updater_delegate_ = std::make_unique<ModelUpdaterDelegate>(this);
 
   NotifyObserversSyncUpdated();
 }
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.h b/chrome/browser/ui/app_list/app_list_syncable_service.h
index 2fd9562f..4af78ae 100644
--- a/chrome/browser/ui/app_list/app_list_syncable_service.h
+++ b/chrome/browser/ui/app_list/app_list_syncable_service.h
@@ -158,7 +158,7 @@
       const syncer::SyncChangeList& change_list) override;
 
  private:
-  class ModelObserver;
+  class ModelUpdaterDelegate;
 
   // Builds the model once ExtensionService is ready.
   void BuildModel();
@@ -210,10 +210,6 @@
   // Handles an existing sync item.
   void ProcessExistingSyncItem(SyncItem* sync_item);
 
-  // Updates |app_item| from |sync_item| (e.g. updates item positions).
-  void UpdateAppItemFromSyncItem(const SyncItem* sync_item,
-                                 AppListItem* app_item);
-
   // Sends ADD or CHANGED for sync item.
   void SendSyncChange(SyncItem* sync_item,
                       syncer::SyncChange::SyncChangeType sync_change_type);
@@ -268,7 +264,7 @@
   Profile* profile_;
   extensions::ExtensionSystem* extension_system_;
   std::unique_ptr<ChromeAppListModelUpdater> model_updater_;
-  std::unique_ptr<ModelObserver> model_observer_;
+  std::unique_ptr<ModelUpdaterDelegate> model_updater_delegate_;
   std::unique_ptr<ExtensionAppModelBuilder> apps_builder_;
   std::unique_ptr<ArcAppModelBuilder> arc_apps_builder_;
   std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_;
diff --git a/chrome/browser/ui/app_list/chrome_app_list_model_updater.cc b/chrome/browser/ui/app_list/chrome_app_list_model_updater.cc
index d7f6ae7..257cc36b 100644
--- a/chrome/browser/ui/app_list/chrome_app_list_model_updater.cc
+++ b/chrome/browser/ui/app_list/chrome_app_list_model_updater.cc
@@ -17,9 +17,13 @@
 
 ChromeAppListModelUpdater::ChromeAppListModelUpdater()
     : model_(std::make_unique<app_list::AppListModel>()),
-      search_model_(std::make_unique<app_list::SearchModel>()) {}
+      search_model_(std::make_unique<app_list::SearchModel>()) {
+  model_->AddObserver(this);
+}
 
-ChromeAppListModelUpdater::~ChromeAppListModelUpdater() = default;
+ChromeAppListModelUpdater::~ChromeAppListModelUpdater() {
+  model_->RemoveObserver(this);
+}
 
 void ChromeAppListModelUpdater::AddItem(
     std::unique_ptr<ChromeAppListItem> app_item) {
@@ -266,6 +270,28 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
+// Methods called from Ash:
+
+void ChromeAppListModelUpdater::OnAppListItemAdded(
+    app_list::AppListItem* item) {
+  if (delegate_)
+    delegate_->OnAppListItemAdded(static_cast<ChromeAppListItem*>(item));
+}
+
+void ChromeAppListModelUpdater::OnAppListItemWillBeDeleted(
+    app_list::AppListItem* item) {
+  if (delegate_)
+    delegate_->OnAppListItemWillBeDeleted(
+        static_cast<ChromeAppListItem*>(item));
+}
+
+void ChromeAppListModelUpdater::OnAppListItemUpdated(
+    app_list::AppListItem* item) {
+  if (delegate_)
+    delegate_->OnAppListItemUpdated(static_cast<ChromeAppListItem*>(item));
+}
+
+////////////////////////////////////////////////////////////////////////////////
 // TODO(hejq): Move the following methods to ash.
 
 void ChromeAppListModelUpdater::FindOrCreateOemFolder(
diff --git a/chrome/browser/ui/app_list/chrome_app_list_model_updater.h b/chrome/browser/ui/app_list/chrome_app_list_model_updater.h
index 45c56eb..ed82e93 100644
--- a/chrome/browser/ui/app_list/chrome_app_list_model_updater.h
+++ b/chrome/browser/ui/app_list/chrome_app_list_model_updater.h
@@ -10,8 +10,10 @@
 #include <string>
 #include <vector>
 
+#include "ash/app_list/model/app_list_model_observer.h"
 #include "chrome/browser/ui/app_list/app_list_model_updater.h"
 #include "chrome/browser/ui/app_list/app_list_syncable_service.h"
+#include "chrome/browser/ui/app_list/chrome_app_list_model_updater_delegate.h"
 
 namespace ui {
 class MenuModel;
@@ -20,7 +22,8 @@
 class ChromeAppListItem;
 class SearchModel;
 
-class ChromeAppListModelUpdater : public AppListModelUpdater {
+class ChromeAppListModelUpdater : public app_list::AppListModelObserver,
+                                  public AppListModelUpdater {
  public:
   ChromeAppListModelUpdater();
   ~ChromeAppListModelUpdater() override;
@@ -48,6 +51,20 @@
   void PublishSearchResults(
       std::vector<std::unique_ptr<app_list::SearchResult>> results) override;
 
+  // Methods only used by ChromeAppListItem that talk to ash directly.
+  void SetItemIcon(const std::string& id, const gfx::ImageSkia& icon) override;
+  void SetItemName(const std::string& id, const std::string& name) override;
+  void SetItemNameAndShortName(const std::string& id,
+                               const std::string& name,
+                               const std::string& short_name) override;
+  void SetItemPosition(const std::string& id,
+                       const syncer::StringOrdinal& new_position) override;
+  void SetItemFolderId(const std::string& id,
+                       const std::string& folder_id) override;
+  void SetItemIsInstalling(const std::string& id, bool is_installing) override;
+  void SetItemPercentDownloaded(const std::string& id,
+                                int32_t percent_downloaded) override;
+
   // Methods only for visiting Chrome items that never talk to ash.
   void ActivateChromeItem(const std::string& id, int event_flags);
 
@@ -79,21 +96,15 @@
       bool update_name,
       bool update_folder);
 
- protected:
-  // AppListModelUpdater:
-  // Methods only used by ChromeAppListItem that talk to ash directly.
-  void SetItemIcon(const std::string& id, const gfx::ImageSkia& icon) override;
-  void SetItemName(const std::string& id, const std::string& name) override;
-  void SetItemNameAndShortName(const std::string& id,
-                               const std::string& name,
-                               const std::string& short_name) override;
-  void SetItemPosition(const std::string& id,
-                       const syncer::StringOrdinal& new_position) override;
-  void SetItemFolderId(const std::string& id,
-                       const std::string& folder_id) override;
-  void SetItemIsInstalling(const std::string& id, bool is_installing) override;
-  void SetItemPercentDownloaded(const std::string& id,
-                                int32_t percent_downloaded) override;
+  // Overridden frome app_list::AppListModelObserver:
+  // TODO(hejq): We temporarily put them here to make tests happy.
+  void OnAppListItemAdded(app_list::AppListItem* item) override;
+  void OnAppListItemWillBeDeleted(app_list::AppListItem* item) override;
+  void OnAppListItemUpdated(app_list::AppListItem* item) override;
+
+  void SetDelegate(ChromeAppListModelUpdaterDelegate* delegate) {
+    delegate_ = delegate;
+  }
 
  private:
   // TODO(hejq): Remove this friend. Currently |model_| and |search_model_| are
@@ -110,6 +121,7 @@
 
   std::unique_ptr<app_list::AppListModel> model_;
   std::unique_ptr<app_list::SearchModel> search_model_;
+  ChromeAppListModelUpdaterDelegate* delegate_ = nullptr;
 
   DISALLOW_COPY_AND_ASSIGN(ChromeAppListModelUpdater);
 };
diff --git a/chrome/browser/ui/app_list/chrome_app_list_model_updater_delegate.h b/chrome/browser/ui/app_list/chrome_app_list_model_updater_delegate.h
new file mode 100644
index 0000000..ad00d56
--- /dev/null
+++ b/chrome/browser/ui/app_list/chrome_app_list_model_updater_delegate.h
@@ -0,0 +1,27 @@
+// 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 CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_MODEL_UPDATER_DELEGATE_H_
+#define CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_MODEL_UPDATER_DELEGATE_H_
+
+class ChromeAppListItem;
+
+// A delegate interface of ChromeAppListModelUpdater to perform
+// additional work on ChromeAppListItem changes.
+class ChromeAppListModelUpdaterDelegate {
+ public:
+  // Triggered after an item has been added to the model.
+  virtual void OnAppListItemAdded(ChromeAppListItem* item) {}
+
+  // Triggered just before an item is deleted from the model.
+  virtual void OnAppListItemWillBeDeleted(ChromeAppListItem* item) {}
+
+  // Triggered after an item has moved, changed folders, or changed properties.
+  virtual void OnAppListItemUpdated(ChromeAppListItem* item) {}
+
+ protected:
+  virtual ~ChromeAppListModelUpdaterDelegate() {}
+};
+
+#endif  // CHROME_BROWSER_UI_APP_LIST_CHROME_APP_LIST_MODEL_UPDATER_DELEGATE_H_
diff --git a/chrome/browser/ui/app_list/search/common/url_icon_source.cc b/chrome/browser/ui/app_list/search/common/url_icon_source.cc
index 7f11363c..8f142e7 100644
--- a/chrome/browser/ui/app_list/search/common/url_icon_source.cc
+++ b/chrome/browser/ui/app_list/search/common/url_icon_source.cc
@@ -11,10 +11,10 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/common/simple_url_loader.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/base/load_flags.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/image/image_skia_operations.h"
 
@@ -67,7 +67,7 @@
           })");
   simple_loader_ = content::SimpleURLLoader::Create(std::move(resource_request),
                                                     traffic_annotation);
-  content::mojom::URLLoaderFactory* loader_factory =
+  network::mojom::URLLoaderFactory* loader_factory =
       content::BrowserContext::GetDefaultStoragePartition(browser_context_)
           ->GetURLLoaderFactoryForBrowserProcess();
   simple_loader_->DownloadToStringOfUnboundedSizeUntilCrashAndDie(
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
index 94ded6f..2d3a7ba 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
@@ -25,7 +25,6 @@
 #include "chrome/grit/theme_resources.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "extensions/browser/extension_registry.h"
 #include "extensions/browser/extension_system.h"
 #include "extensions/common/extension_urls.h"
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
index 2ea4236c..eb3bac9 100644
--- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
+++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc
@@ -40,7 +40,6 @@
 #include "ui/aura/window_tree_host.h"
 #include "ui/base/ui_base_types.h"
 #include "ui/events/event.h"
-#include "ui/message_center/message_center.h"
 #include "ui/wm/core/transient_window_manager.h"
 #include "ui/wm/core/window_animations.h"
 #include "ui/wm/core/window_util.h"
diff --git a/chrome/browser/ui/ash/network/data_promo_notification.cc b/chrome/browser/ui/ash/network/data_promo_notification.cc
index 1e18317d..d3ba234 100644
--- a/chrome/browser/ui/ash/network/data_promo_notification.cc
+++ b/chrome/browser/ui/ash/network/data_promo_notification.cc
@@ -36,7 +36,6 @@
 #include "extensions/browser/extension_registry.h"
 #include "third_party/cros_system_api/dbus/service_constants.h"
 #include "ui/base/l10n/l10n_util.h"
-#include "ui/message_center/message_center.h"
 #include "ui/message_center/notification.h"
 #include "ui/views/view.h"
 #include "ui/views/widget/widget.h"
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index c65db3c8..031a335 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -748,10 +748,9 @@
 
   WebContents* contents = browser_->tab_strip_model()->GetActiveWebContents();
   if (contents) {
+    CGFloat intrinsicWidth =
+        static_cast<CGFloat>(contents->GetPreferredSize().width());
     // If the intrinsic width is bigger, then make it the zoomed width.
-    const int kScrollbarWidth = 16;  // TODO(viettrungluu): ugh.
-    CGFloat intrinsicWidth = static_cast<CGFloat>(
-        contents->GetPreferredSize().width() + kScrollbarWidth);
     zoomedWidth = std::max(zoomedWidth,
                            std::min(intrinsicWidth, NSWidth(frame)));
   }
diff --git a/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h b/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h
index 3be32c6..bec5989 100644
--- a/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h
+++ b/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.h
@@ -8,7 +8,7 @@
 #include <Cocoa/Cocoa.h>
 
 #include "base/memory/ref_counted.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 class AccountAvatarFetcherBridge;
 @class CredentialItemButton;
@@ -17,11 +17,11 @@
 // Handles retrieving avatar images for credential items.
 @interface AccountAvatarFetcherManager : NSObject {
   std::vector<std::unique_ptr<AccountAvatarFetcherBridge>> bridges_;
-  content::mojom::URLLoaderFactory* loaderFactory_;
+  network::mojom::URLLoaderFactory* loaderFactory_;
 }
 
 // Initializes a manager with the specified URL loader factory.
-- (id)initWithLoaderFactory:(content::mojom::URLLoaderFactory*)loaderFactory;
+- (id)initWithLoaderFactory:(network::mojom::URLLoaderFactory*)loaderFactory;
 
 // Retrieves the image located at |avatarURL| and updates |view| if successful.
 - (void)fetchAvatar:(const GURL&)avatarURL forView:(CredentialItemButton*)view;
diff --git a/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.mm b/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.mm
index 26a40209..4f084f3 100644
--- a/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.mm
+++ b/chrome/browser/ui/cocoa/passwords/account_avatar_fetcher_manager.mm
@@ -54,7 +54,7 @@
 
 @implementation AccountAvatarFetcherManager
 
-- (id)initWithLoaderFactory:(content::mojom::URLLoaderFactory*)loaderFactory {
+- (id)initWithLoaderFactory:(network::mojom::URLLoaderFactory*)loaderFactory {
   if ((self = [super init])) {
     loaderFactory_ = loaderFactory;
   }
diff --git a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm
index fa3a70c..796f7942 100644
--- a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm
@@ -82,7 +82,7 @@
   // PasswordPromptBridgeInterface:
   void PerformClose() override;
   PasswordDialogController* GetDialogController() override;
-  content::mojom::URLLoaderFactory* GetURLLoaderFactory() const override;
+  network::mojom::URLLoaderFactory* GetURLLoaderFactory() const override;
 
  private:
   PasswordDialogControllerMock dialog_controller_;
@@ -121,7 +121,7 @@
   return &dialog_controller_;
 }
 
-content::mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 AccountChooserViewControllerTest::GetURLLoaderFactory() const {
   NOTREACHED();
   return nullptr;
diff --git a/chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.mm b/chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.mm
index 961020c6..a9a18a6 100644
--- a/chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.mm
+++ b/chrome/browser/ui/cocoa/passwords/auto_signin_view_controller.mm
@@ -19,7 +19,7 @@
 #include "chrome/grit/generated_resources.h"
 #include "components/strings/grit/components_strings.h"
 #include "content/public/browser/storage_partition.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "skia/ext/skia_utils_mac.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/resource/resource_bundle.h"
diff --git a/chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller_unittest.mm b/chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller_unittest.mm
index 63bba56..c68977c3 100644
--- a/chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/autosignin_prompt_view_controller_unittest.mm
@@ -41,7 +41,7 @@
   // PasswordPromptBridgeInterface:
   void PerformClose() override;
   PasswordDialogController* GetDialogController() override;
-  content::mojom::URLLoaderFactory* GetURLLoaderFactory() const override;
+  network::mojom::URLLoaderFactory* GetURLLoaderFactory() const override;
 
  private:
   PasswordDialogControllerMock dialog_controller_;
@@ -70,7 +70,7 @@
   return &dialog_controller_;
 }
 
-content::mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 AutoSigninPromptViewControllerTest::GetURLLoaderFactory() const {
   NOTREACHED();
   return nullptr;
diff --git a/chrome/browser/ui/cocoa/passwords/password_prompt_bridge_interface.h b/chrome/browser/ui/cocoa/passwords/password_prompt_bridge_interface.h
index bc2cc86..d81defd 100644
--- a/chrome/browser/ui/cocoa/passwords/password_prompt_bridge_interface.h
+++ b/chrome/browser/ui/cocoa/passwords/password_prompt_bridge_interface.h
@@ -6,7 +6,7 @@
 #define CHROME_BROWSER_UI_COCOA_PASSWORDS_PASSWORD_PROMPT_BRIDGE_INTERFACE_H_
 
 class PasswordDialogController;
-namespace content {
+namespace network {
 namespace mojom {
 class URLLoaderFactory;
 }
@@ -23,7 +23,7 @@
   virtual PasswordDialogController* GetDialogController() = 0;
 
   // Returns the URL loader factory for fetching the avatars.
-  virtual content::mojom::URLLoaderFactory* GetURLLoaderFactory() const = 0;
+  virtual network::mojom::URLLoaderFactory* GetURLLoaderFactory() const = 0;
 
  protected:
   virtual ~PasswordPromptBridgeInterface() = default;
diff --git a/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.h b/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.h
index a936f77..47a7732 100644
--- a/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.h
+++ b/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.h
@@ -36,7 +36,7 @@
   // PasswordPromptBridgeInterface:
   void PerformClose() override;
   PasswordDialogController* GetDialogController() override;
-  content::mojom::URLLoaderFactory* GetURLLoaderFactory() const override;
+  network::mojom::URLLoaderFactory* GetURLLoaderFactory() const override;
 
  private:
   void ShowWindow();
diff --git a/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.mm b/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.mm
index 392f776..2c77383b 100644
--- a/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.mm
+++ b/chrome/browser/ui/cocoa/passwords/password_prompt_view_bridge.mm
@@ -12,7 +12,7 @@
 #include "chrome/browser/ui/passwords/password_dialog_controller.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/browser/web_contents.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 PasswordPromptViewBridge::PasswordPromptViewBridge(
     PasswordDialogController* controller,
@@ -58,7 +58,7 @@
   return controller_;
 }
 
-content::mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 PasswordPromptViewBridge::GetURLLoaderFactory() const {
   return content::BrowserContext::GetDefaultStoragePartition(
              Profile::FromBrowserContext(web_contents_->GetBrowserContext()))
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index e7a687a..6842358 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -61,8 +61,6 @@
 
 using base::ASCIIToUTF16;
 using base::UTF16ToUTF8;
-using base::Time;
-using base::TimeDelta;
 using bookmarks::BookmarkModel;
 
 namespace {
@@ -290,7 +288,7 @@
     }
   }
 
-  void AddHistoryEntry(const TestHistoryEntry& entry, const Time& time) {
+  void AddHistoryEntry(const TestHistoryEntry& entry, const base::Time& time) {
     Profile* profile = browser()->profile();
     history::HistoryService* history_service =
         HistoryServiceFactory::GetForProfile(
@@ -328,7 +326,7 @@
     for (size_t i = 0; i < arraysize(kHistoryEntries); i++) {
       // Add everything in order of time. We don't want to have a time that
       // is "right now" or it will nondeterministically appear in the results.
-      Time t = Time::Now() - TimeDelta::FromHours(i + 1);
+      base::Time t = base::Time::Now() - base::TimeDelta::FromHours(i + 1);
       ASSERT_NO_FATAL_FAILURE(AddHistoryEntry(kHistoryEntries[i], t));
     }
   }
@@ -1100,8 +1098,8 @@
   };
 
   // Add a history entry to trigger inline autocomplete when typing "foo".
-  ASSERT_NO_FATAL_FAILURE(
-      AddHistoryEntry(kHistoryFoobar, Time::Now() - TimeDelta::FromHours(1)));
+  ASSERT_NO_FATAL_FAILURE(AddHistoryEntry(
+      kHistoryFoobar, base::Time::Now() - base::TimeDelta::FromHours(1)));
 
   // Type "fo" to trigger inline autocomplete.
   ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordPrefixKeys));
@@ -1159,8 +1157,8 @@
 
   // Add a history entry to trigger HQP matching with text == keyword when
   // typing "fo te".
-  ASSERT_NO_FATAL_FAILURE(
-      AddHistoryEntry(kHistoryFoo, Time::Now() - TimeDelta::FromMinutes(10)));
+  ASSERT_NO_FATAL_FAILURE(AddHistoryEntry(
+      kHistoryFoo, base::Time::Now() - base::TimeDelta::FromMinutes(10)));
 
   ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_F, 0));
   ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_O, 0));
@@ -1445,8 +1443,8 @@
   };
 
   // Add a history entry so "foo" gets multiple matches.
-  ASSERT_NO_FATAL_FAILURE(
-      AddHistoryEntry(kHistoryFoo, Time::Now() - TimeDelta::FromHours(1)));
+  ASSERT_NO_FATAL_FAILURE(AddHistoryEntry(
+      kHistoryFoo, base::Time::Now() - base::TimeDelta::FromHours(1)));
 
   // Load results.
   ASSERT_NO_FATAL_FAILURE(omnibox_view->SelectAll(false));
diff --git a/chrome/browser/ui/passwords/account_avatar_fetcher.cc b/chrome/browser/ui/passwords/account_avatar_fetcher.cc
index 6d054f3..bb515fc 100644
--- a/chrome/browser/ui/passwords/account_avatar_fetcher.cc
+++ b/chrome/browser/ui/passwords/account_avatar_fetcher.cc
@@ -53,7 +53,7 @@
 AccountAvatarFetcher::~AccountAvatarFetcher() = default;
 
 void AccountAvatarFetcher::Start(
-    content::mojom::URLLoaderFactory* loader_factory) {
+    network::mojom::URLLoaderFactory* loader_factory) {
   fetcher_.Init(std::string(), net::URLRequest::NEVER_CLEAR_REFERRER,
                 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES |
                     net::LOAD_DO_NOT_SEND_AUTH_DATA |
diff --git a/chrome/browser/ui/passwords/account_avatar_fetcher.h b/chrome/browser/ui/passwords/account_avatar_fetcher.h
index 0ae07e8..f70f969 100644
--- a/chrome/browser/ui/passwords/account_avatar_fetcher.h
+++ b/chrome/browser/ui/passwords/account_avatar_fetcher.h
@@ -10,16 +10,16 @@
 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h"
 #include "url/gurl.h"
 
-namespace content {
-namespace mojom {
-class URLLoaderFactory;
-}
-}  // namespace content
-
 namespace gfx {
 class ImageSkia;
 }  // namespace gfx
 
+namespace network {
+namespace mojom {
+class URLLoaderFactory;
+}
+}  // namespace network
+
 class AccountAvatarFetcherDelegate {
  public:
   virtual void UpdateAvatar(const gfx::ImageSkia& image) = 0;
@@ -35,7 +35,7 @@
 
   ~AccountAvatarFetcher() override;
 
-  void Start(content::mojom::URLLoaderFactory* loader_factory);
+  void Start(network::mojom::URLLoaderFactory* loader_factory);
 
  private:
   // BitmapFetcherDelegate:
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
index c355406..bd917010 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc
@@ -100,7 +100,8 @@
   BrowserList::AddObserver(this);
   Initialize(profile, browser);
 
-  DCHECK(!refresh_token.empty() || signin::IsDicePrepareMigrationEnabled());
+  DCHECK(!signin::IsDicePrepareMigrationEnabled());
+  DCHECK(!refresh_token.empty());
   SigninManagerFactory::GetForProfile(profile_)->StartSignInWithRefreshToken(
       refresh_token, gaia_id, email, password,
       base::Bind(&OneClickSigninSyncStarter::ConfirmSignin,
@@ -160,19 +161,10 @@
       // initialized.
       policy::UserPolicySigninService* policy_service =
           policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
-      if (oauth_token.empty()) {
-        DCHECK(signin::IsDicePrepareMigrationEnabled());
-        policy_service->RegisterForPolicyWithAccountId(
-            signin->GetUsernameForAuthInProgress(),
-            signin->GetAccountIdForAuthInProgress(),
-            base::Bind(&OneClickSigninSyncStarter::OnRegisteredForPolicy,
-                       weak_pointer_factory_.GetWeakPtr()));
-      } else {
-        policy_service->RegisterForPolicyWithLoginToken(
-            signin->GetUsernameForAuthInProgress(), oauth_token,
-            base::Bind(&OneClickSigninSyncStarter::OnRegisteredForPolicy,
-                       weak_pointer_factory_.GetWeakPtr()));
-      }
+      policy_service->RegisterForPolicyWithLoginToken(
+          signin->GetUsernameForAuthInProgress(), oauth_token,
+          base::Bind(&OneClickSigninSyncStarter::OnRegisteredForPolicy,
+                     weak_pointer_factory_.GetWeakPtr()));
       break;
     }
     case NEW_PROFILE:
@@ -319,16 +311,9 @@
       break;
     }
     case Profile::CREATE_STATUS_INITIALIZED:
-      if (signin::IsDicePrepareMigrationEnabled()) {
-        // When DICE is enabled, the refresh token is not copied to the new
-        // profile and the user needs to sign in to the new profile in order
-        // to enable sync.
-        CancelSigninAndStartNewSigninInNewProfile(new_profile);
-      } else {
         // Pre-DICE, the refresh token is copied to the new profile and the user
         // does not need to autehnticate in the new profile.
         CopyCredentialsToNewProfileAndFinishSignin(new_profile);
-      }
       break;
     case Profile::CREATE_STATUS_REMOTE_FAIL:
     case Profile::CREATE_STATUS_CANCELED:
@@ -340,21 +325,6 @@
   }
 }
 
-void OneClickSigninSyncStarter::CancelSigninAndStartNewSigninInNewProfile(
-    Profile* new_profile) {
-  SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_);
-  std::string email = signin_manager->GetUsernameForAuthInProgress();
-  CancelSigninAndDelete();
-
-  profiles::FindOrCreateNewWindowForProfile(
-      new_profile, chrome::startup::IS_PROCESS_STARTUP,
-      chrome::startup::IS_FIRST_RUN, false);
-  Browser* browser = chrome::FindTabbedBrowser(new_profile, false);
-  browser->signin_view_controller()->ShowDiceSigninTab(
-      profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, browser,
-      signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE, email);
-}
-
 void OneClickSigninSyncStarter::CopyCredentialsToNewProfileAndFinishSignin(
     Profile* new_profile) {
   // Wait until the profile is initialized before we transfer credentials.
@@ -411,21 +381,11 @@
 void OneClickSigninSyncStarter::CancelSigninAndDelete() {
   SigninManager* signin_manager = SigninManagerFactory::GetForProfile(profile_);
   DCHECK(signin_manager->AuthInProgress());
-  if (signin::IsDicePrepareMigrationEnabled()) {
-    // TODO: Do not delete the token if it existed prior this login flow. See
-    // http://crbug.com/797342.
-    ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)
-        ->RevokeCredentials(signin_manager->GetAccountIdForAuthInProgress());
-    signin_manager->SignOutAndKeepAllAccounts(
-        signin_metrics::ABORT_SIGNIN,
-        signin_metrics::SignoutDelete::IGNORE_METRIC);
-  } else {
-    // SignoutAndRemoveAllAccounts does not actually remove the accounts if the
-    // signin is still pending. See http://crbug.com/799437.
-    signin_manager->SignOutAndRemoveAllAccounts(
-        signin_metrics::ABORT_SIGNIN,
-        signin_metrics::SignoutDelete::IGNORE_METRIC);
-  }
+  // SignoutAndRemoveAllAccounts does not actually remove the accounts if the
+  // signin is still pending. See http://crbug.com/799437.
+  signin_manager->SignOutAndRemoveAllAccounts(
+      signin_metrics::ABORT_SIGNIN,
+      signin_metrics::SignoutDelete::IGNORE_METRIC);
   // The statement above results in a call to SigninFailed() which will free
   // this object, so do not refer to the OneClickSigninSyncStarter object
   // after this point.
@@ -480,13 +440,9 @@
 
   switch (result) {
     case LoginUIService::CONFIGURE_SYNC_FIRST:
-      base::RecordAction(
-          base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings"));
       ShowSyncSetupSettingsSubpage();
       break;
     case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
-      base::RecordAction(
-          base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
       ProfileSyncService* profile_sync_service = GetProfileSyncService();
       if (profile_sync_service)
         profile_sync_service->SetFirstSetupComplete();
@@ -494,6 +450,9 @@
       break;
     }
     case LoginUIService::ABORT_SIGNIN:
+      SigninManagerFactory::GetForProfile(profile_)->SignOut(
+          signin_metrics::ABORT_SIGNIN,
+          signin_metrics::SignoutDelete::IGNORE_METRIC);
       FinishProfileSyncServiceSetup();
       break;
   }
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.h b/chrome/browser/ui/sync/one_click_signin_sync_starter.h
index 90a78ed..95f0ce62 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.h
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.h
@@ -125,8 +125,6 @@
   friend class OneClickSigninSyncStarterTest;
   FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackSigninFailed);
   FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTest, CallbackNull);
-  FRIEND_TEST_ALL_PREFIXES(OneClickSigninSyncStarterTestDice,
-                           RemoveAccountOnCancel);
 
   // Initializes the internals of the OneClickSigninSyncStarter object. Can also
   // be used to re-initialize the object to refer to a newly created profile.
@@ -170,9 +168,6 @@
   // in-progress auth credentials currently stored in this object.
   void CreateNewSignedInProfile();
 
-  // Opens a browser window for new profile showing the sign-in page.
-  void CancelSigninAndStartNewSigninInNewProfile(Profile* new_profile);
-
   // Copies the sign-in credentials to |new_profile| and starts syncing in
   // |new_profile|.
   void CopyCredentialsToNewProfileAndFinishSignin(Profile* new_profile);
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc
index 519e7f84..6008dcc5 100644
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter_unittest.cc
@@ -6,26 +6,18 @@
 
 #include "base/command_line.h"
 #include "base/compiler_specific.h"
-#include "base/files/file_util.h"
 #include "base/macros.h"
-#include "base/run_loop.h"
-#include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/browser/signin/account_tracker_service_factory.h"
 #include "chrome/browser/signin/chrome_signin_client_factory.h"
-#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
 #include "chrome/browser/signin/signin_manager_factory.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
-#include "chrome/test/base/scoped_testing_local_state.h"
-#include "chrome/test/base/testing_browser_process.h"
 #include "chrome/test/base/testing_profile.h"
-#include "chrome/test/base/testing_profile_manager.h"
 #include "components/browser_sync/browser_sync_switches.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/fake_signin_manager.h"
-#include "components/signin/core/browser/scoped_account_consistency.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/test_browser_thread_bundle.h"
@@ -37,31 +29,6 @@
 const char kTestingRefreshToken[] = "refresh_token";
 const char kTestingUsername[] = "fake_username";
 
-// Test signin manager creating testing profiles.
-class UnittestProfileManager : public ProfileManagerWithoutInit {
- public:
-  explicit UnittestProfileManager(const base::FilePath& user_data_dir)
-      : ProfileManagerWithoutInit(user_data_dir) {}
-
- protected:
-  Profile* CreateProfileHelper(const base::FilePath& file_path) override {
-    if (!base::PathExists(file_path)) {
-      if (!base::CreateDirectory(file_path))
-        return nullptr;
-    }
-    return new TestingProfile(file_path, nullptr);
-  }
-
-  Profile* CreateProfileAsyncHelper(const base::FilePath& path,
-                                    Delegate* delegate) override {
-    base::ThreadTaskRunnerHandle::Get()->PostTask(
-        FROM_HERE,
-        base::BindOnce(base::IgnoreResult(&base::CreateDirectory), path));
-
-    return new TestingProfile(path, this);
-  }
-};
-
 }  // namespace
 
 class OneClickSigninSyncStarterTest : public ChromeRenderViewHostTestHarness {
@@ -154,82 +121,3 @@
   EXPECT_EQ(0, failed_count_);
   EXPECT_EQ(0, succeeded_count_);
 }
-
-class OneClickSigninSyncStarterTestDice
-    : public ChromeRenderViewHostTestHarness {
- public:
-  OneClickSigninSyncStarterTestDice()
-      : local_state_(TestingBrowserProcess::GetGlobal()) {}
-
-  // ChromeRenderViewHostTestHarness:
-  void SetUp() override {
-    ChromeRenderViewHostTestHarness::SetUp();
-
-    ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
-    TestingBrowserProcess::GetGlobal()->SetProfileManager(
-        new UnittestProfileManager(temp_dir_.GetPath()));
-
-    // Disable sync to simplify the creation of a OneClickSigninSyncStarter.
-    base::CommandLine::ForCurrentProcess()->AppendSwitch(
-        switches::kDisableSync);
-
-    account_id_ =
-        AccountTrackerServiceFactory::GetForProfile(profile())
-            ->PickAccountIdForAccount(kTestingGaiaId, kTestingUsername);
-  }
-
-  void TearDown() override {
-    base::RunLoop().RunUntilIdle();
-    TestingBrowserProcess::GetGlobal()->SetProfileManager(nullptr);
-    ChromeRenderViewHostTestHarness::TearDown();
-  }
-
-  // ChromeRenderViewHostTestHarness:
-  content::BrowserContext* CreateBrowserContext() override {
-    // Create the sign in manager required by OneClickSigninSyncStarter.
-    TestingProfile::Builder builder;
-    builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
-                              BuildFakeProfileOAuth2TokenService);
-    return builder.Build().release();
-  }
-
-  std::string account_id_;
-
- private:
-  base::ScopedTempDir temp_dir_;
-  ScopedTestingLocalState local_state_;
-
-  DISALLOW_COPY_AND_ASSIGN(OneClickSigninSyncStarterTestDice);
-};
-
-// Checks that the token is revoked when signin is canceled while authentication
-// is in progress.
-TEST_F(OneClickSigninSyncStarterTestDice, RemoveAccountOnCancel) {
-  signin::ScopedAccountConsistencyDicePrepareMigration prepare_migration;
-  SigninManager* signin_manager =
-      SigninManagerFactory::GetForProfile(profile());
-  // Start from signed-out state.
-  signin_manager->SignOut(signin_metrics::SIGNOUT_TEST,
-                          signin_metrics::SignoutDelete::IGNORE_METRIC);
-  ProfileOAuth2TokenService* token_service =
-      ProfileOAuth2TokenServiceFactory::GetForProfile(profile());
-  token_service->UpdateCredentials(account_id_, kTestingRefreshToken);
-  ASSERT_TRUE(token_service->RefreshTokenIsAvailable(account_id_));
-
-  // Use NEW_PROFILE to pause the OneClickSynStarter in the middle of the
-  // signin, while it is waiting for a new Profile to be created.
-  // Deletes itself when SigninFailed() or SigninSuccess() is called.
-  OneClickSigninSyncStarter* sync_starter = new OneClickSigninSyncStarter(
-      profile(), nullptr, kTestingGaiaId, kTestingUsername, std::string(),
-      kTestingRefreshToken, signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN,
-      signin_metrics::Reason::REASON_UNKNOWN_REASON,
-      OneClickSigninSyncStarter::NEW_PROFILE,
-      OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS,
-      OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN,
-      OneClickSigninSyncStarter::Callback());
-
-  // Check that the token is deleted.
-  ASSERT_TRUE(signin_manager->AuthInProgress());
-  sync_starter->CancelSigninAndDelete();
-  EXPECT_FALSE(token_service->RefreshTokenIsAvailable(account_id_));
-}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
index ea7a0888..71cfc11 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
@@ -22,8 +22,6 @@
 
 using base::ASCIIToUTF16;
 using base::UTF8ToUTF16;
-using base::Time;
-using base::TimeDelta;
 using bookmarks::BookmarkModel;
 using bookmarks::BookmarkNode;
 
@@ -202,7 +200,7 @@
 
 // Changes the url and makes sure parent/visual order doesn't change.
 TEST_F(BookmarkEditorViewTest, EditURLKeepsPosition) {
-  Time node_time = Time::Now() + TimeDelta::FromDays(2);
+  base::Time node_time = base::Time::Now() + base::TimeDelta::FromDays(2);
   GetMutableNode("a")->set_date_added(node_time);
   CreateEditor(profile_.get(), NULL,
                BookmarkEditor::EditDetails::EditNode(GetNode("a")),
@@ -234,7 +232,7 @@
 
 // Moves 'a' to be a child of the other node and changes its url to new_a.
 TEST_F(BookmarkEditorViewTest, ChangeParentAndURL) {
-  Time node_time = Time::Now() + TimeDelta::FromDays(2);
+  base::Time node_time = base::Time::Now() + base::TimeDelta::FromDays(2);
   GetMutableNode("a")->set_date_added(node_time);
   CreateEditor(profile_.get(), NULL,
                BookmarkEditor::EditDetails::EditNode(GetNode("a")),
diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
index 29c0bbc5..0e9309c 100644
--- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
+++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc
@@ -54,7 +54,7 @@
 views::ScrollView* CreateCredentialsView(
     const PasswordDialogController::FormsVector& forms,
     views::ButtonListener* button_listener,
-    content::mojom::URLLoaderFactory* loader_factory) {
+    network::mojom::URLLoaderFactory* loader_factory) {
   views::View* list_view = new views::View;
   list_view->SetLayoutManager(
       std::make_unique<views::BoxLayout>(views::BoxLayout::kVertical));
diff --git a/chrome/browser/ui/views/passwords/credentials_item_view.cc b/chrome/browser/ui/views/passwords/credentials_item_view.cc
index a4d91a64..9d89c0b7 100644
--- a/chrome/browser/ui/views/passwords/credentials_item_view.cc
+++ b/chrome/browser/ui/views/passwords/credentials_item_view.cc
@@ -62,7 +62,7 @@
     const base::string16& lower_text,
     SkColor hover_color,
     const autofill::PasswordForm* form,
-    content::mojom::URLLoaderFactory* loader_factory)
+    network::mojom::URLLoaderFactory* loader_factory)
     : Button(button_listener),
       form_(form),
       upper_label_(nullptr),
diff --git a/chrome/browser/ui/views/passwords/credentials_item_view.h b/chrome/browser/ui/views/passwords/credentials_item_view.h
index 877dcb00..60dd5f2 100644
--- a/chrome/browser/ui/views/passwords/credentials_item_view.h
+++ b/chrome/browser/ui/views/passwords/credentials_item_view.h
@@ -14,14 +14,14 @@
 struct PasswordForm;
 }
 
-namespace content {
+namespace gfx {
+class ImageSkia;
+}
+
+namespace network {
 namespace mojom {
 class URLLoaderFactory;
 }
-}  // namespace content
-
-namespace gfx {
-class ImageSkia;
 }
 
 namespace views {
@@ -39,7 +39,7 @@
                       const base::string16& lower_text,
                       SkColor hover_color,
                       const autofill::PasswordForm* form,
-                      content::mojom::URLLoaderFactory* loader_factory);
+                      network::mojom::URLLoaderFactory* loader_factory);
   ~CredentialsItemView() override;
 
   const autofill::PasswordForm* form() const { return form_; }
diff --git a/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.cc b/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.cc
index d8934d0..6567984 100644
--- a/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.cc
@@ -7,63 +7,58 @@
 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
 #include "chrome/browser/ui/views/harmony/chrome_typography.h"
 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
+#include "chrome/grit/generated_resources.h"
 #include "components/strings/grit/components_strings.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/views/controls/button/md_text_button.h"
 #include "ui/views/controls/styled_label.h"
-#include "ui/views/layout/grid_layout.h"
+#include "ui/views/layout/fill_layout.h"
 
 ManagePasswordSaveConfirmationView::ManagePasswordSaveConfirmationView(
-    ManagePasswordsBubbleView* parent)
-    : parent_(parent) {
-  views::GridLayout* layout =
-      SetLayoutManager(std::make_unique<views::GridLayout>(this));
-  layout->set_minimum_size(
-      gfx::Size(ManagePasswordsBubbleView::kDesiredBubbleWidth, 0));
+    content::WebContents* web_contents,
+    views::View* anchor_view,
+    const gfx::Point& anchor_point,
+    DisplayReason reason)
+    : ManagePasswordsBubbleDelegateViewBase(web_contents,
+                                            anchor_view,
+                                            anchor_point,
+                                            reason) {
+  SetLayoutManager(std::make_unique<views::FillLayout>());
 
-  views::StyledLabel* confirmation =
-      new views::StyledLabel(parent_->model()->save_confirmation_text(), this);
-  confirmation->SetTextContext(CONTEXT_DEPRECATED_SMALL);
+  auto label = std::make_unique<views::StyledLabel>(
+      model()->save_confirmation_text(), this);
+  label->SetTextContext(CONTEXT_BODY_TEXT_LARGE);
+  label->SetDefaultTextStyle(STYLE_SECONDARY);
   auto link_style = views::StyledLabel::RangeStyleInfo::CreateForLink();
   link_style.disable_line_wrapping = false;
-  confirmation->AddStyleRange(parent_->model()->save_confirmation_link_range(),
-                              link_style);
+  label->AddStyleRange(model()->save_confirmation_link_range(), link_style);
 
-  ManagePasswordsBubbleView::BuildColumnSet(
-      layout, ManagePasswordsBubbleView::SINGLE_VIEW_COLUMN_SET);
-  layout->StartRow(0, ManagePasswordsBubbleView::SINGLE_VIEW_COLUMN_SET);
-  layout->AddView(confirmation);
-
-  ok_button_ = views::MdTextButton::CreateSecondaryUiButton(
-      this, l10n_util::GetStringUTF16(IDS_OK));
-
-  ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get();
-  layout->AddPaddingRow(0,
-                        layout_provider->GetDistanceMetric(
-                            views::DISTANCE_DIALOG_CONTENT_MARGIN_BOTTOM_TEXT));
-  ManagePasswordsBubbleView::BuildColumnSet(
-      layout, ManagePasswordsBubbleView::SINGLE_BUTTON_COLUMN_SET);
-  layout->StartRow(0, ManagePasswordsBubbleView::SINGLE_BUTTON_COLUMN_SET);
-  layout->AddView(ok_button_);
-
-  parent_->set_initially_focused_view(ok_button_);
+  AddChildView(label.release());
 }
 
 ManagePasswordSaveConfirmationView::~ManagePasswordSaveConfirmationView() =
     default;
 
-void ManagePasswordSaveConfirmationView::ButtonPressed(views::Button* sender,
-                                                       const ui::Event& event) {
-  DCHECK_EQ(sender, ok_button_);
-  parent_->model()->OnOKClicked();
-  parent_->CloseBubble();
+int ManagePasswordSaveConfirmationView::GetDialogButtons() const {
+  return ui::DIALOG_BUTTON_NONE;
+}
+
+bool ManagePasswordSaveConfirmationView::ShouldShowCloseButton() const {
+  return true;
 }
 
 void ManagePasswordSaveConfirmationView::StyledLabelLinkClicked(
     views::StyledLabel* label,
     const gfx::Range& range,
     int event_flags) {
-  DCHECK_EQ(range, parent_->model()->save_confirmation_link_range());
-  parent_->model()->OnNavigateToPasswordManagerAccountDashboardLinkClicked();
-  parent_->CloseBubble();
+  DCHECK_EQ(range, model()->save_confirmation_link_range());
+  model()->OnNavigateToPasswordManagerAccountDashboardLinkClicked();
+  CloseBubble();
+}
+
+gfx::Size ManagePasswordSaveConfirmationView::CalculatePreferredSize() const {
+  const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
+                        DISTANCE_BUBBLE_PREFERRED_WIDTH) -
+                    margins().width();
+  return gfx::Size(width, GetHeightForWidth(width));
 }
diff --git a/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.h b/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.h
index 4bd0ea2..dd272f4 100644
--- a/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.h
+++ b/chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.h
@@ -5,33 +5,33 @@
 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_SAVE_CONFIRMATION_VIEW_H_
 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORD_SAVE_CONFIRMATION_VIEW_H_
 
-#include "ui/views/controls/button/button.h"
+#include "chrome/browser/ui/views/passwords/manage_passwords_bubble_delegate_view_base.h"
 #include "ui/views/controls/styled_label_listener.h"
 #include "ui/views/view.h"
 
-class ManagePasswordsBubbleView;
-
 // A view confirming to the user that a password was saved and offering a link
 // to the Google account manager.
-class ManagePasswordSaveConfirmationView : public views::View,
-                                           public views::ButtonListener,
-                                           public views::StyledLabelListener {
+class ManagePasswordSaveConfirmationView
+    : public ManagePasswordsBubbleDelegateViewBase,
+      public views::StyledLabelListener {
  public:
   explicit ManagePasswordSaveConfirmationView(
-      ManagePasswordsBubbleView* parent);
+      content::WebContents* web_contents,
+      views::View* anchor_view,
+      const gfx::Point& anchor_point,
+      DisplayReason reason);
   ~ManagePasswordSaveConfirmationView() override;
 
  private:
-  // views::ButtonListener:
-  void ButtonPressed(views::Button* sender, const ui::Event& event) override;
-
-  // views::StyledLabelListener implementation
+  // views::StyledLabelListener:
   void StyledLabelLinkClicked(views::StyledLabel* label,
                               const gfx::Range& range,
                               int event_flags) override;
 
-  ManagePasswordsBubbleView* parent_;
-  views::Button* ok_button_;
+  // LocationBarBubbleDelegateView:
+  int GetDialogButtons() const override;
+  bool ShouldShowCloseButton() const override;
+  gfx::Size CalculatePreferredSize() const override;
 
   DISALLOW_COPY_AND_ASSIGN(ManagePasswordSaveConfirmationView);
 };
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_delegate_view_base.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_delegate_view_base.cc
index d03420874..1e6594f 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_delegate_view_base.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_delegate_view_base.cc
@@ -10,6 +10,7 @@
 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
 #include "chrome/browser/ui/views/passwords/manage_password_auto_sign_in_view.h"
 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h"
+#include "chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.h"
 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h"
 #include "ui/base/material_design/material_design_controller.h"
@@ -90,6 +91,9 @@
   } else if (model_state == password_manager::ui::AUTO_SIGNIN_STATE) {
     view = new ManagePasswordAutoSignInView(web_contents, anchor_view,
                                             anchor_point, reason);
+  } else if (model_state == password_manager::ui::CONFIRMATION_STATE) {
+    view = new ManagePasswordSaveConfirmationView(web_contents, anchor_view,
+                                                  anchor_point, reason);
   } else {
     // TODO(crbug.com/654115): Get rid of the one-bubble-for-everything
     // BubbleView.
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index 1881169a..f475f37 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -23,7 +23,6 @@
 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h"
 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h"
 #include "chrome/browser/ui/views/passwords/manage_password_pending_view.h"
-#include "chrome/browser/ui/views/passwords/manage_password_save_confirmation_view.h"
 #include "chrome/browser/ui/views/passwords/manage_password_sign_in_promo_view.h"
 #include "chrome/browser/ui/views/passwords/manage_password_update_pending_view.h"
 #include "chrome/grit/generated_resources.h"
@@ -305,8 +304,6 @@
   } else if (model()->state() ==
              password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
     AddChildView(new ManagePasswordUpdatePendingView(this));
-  } else if (model()->state() == password_manager::ui::CONFIRMATION_STATE) {
-    AddChildView(new ManagePasswordSaveConfirmationView(this));
   } else {
     // This model state should be handled by separate dialogs.
     NOTREACHED();
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
index 51ac9f3..2dddaeb 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
@@ -41,7 +41,6 @@
   // dialogs need to access their parent, as the dialogs become truly separate
   // this should go away on its own.
   friend class ManagePasswordPendingView;
-  friend class ManagePasswordSaveConfirmationView;
   friend class ManagePasswordSignInPromoView;
   friend class ManagePasswordUpdatePendingView;
 
diff --git a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc
index 4d44c2e34..7f3ee1f 100644
--- a/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc
+++ b/chrome/browser/ui/views/payments/payment_handler_web_flow_view_controller.cc
@@ -9,6 +9,9 @@
 #include "base/base64.h"
 #include "chrome/browser/profiles/profile.h"
 #include "content/public/browser/navigation_handle.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_contents.h"
 #include "ui/views/controls/webview/webview.h"
 #include "ui/views/layout/fill_layout.h"
 
@@ -39,19 +42,21 @@
   std::unique_ptr<views::WebView> web_view =
       std::make_unique<views::WebView>(profile_);
 
-  web_view->LoadInitialURL(target_);
   // TODO(anthonyvd): Size to the actual available size in the dialog.
   web_view->SetPreferredSize(gfx::Size(100, 300));
+  Observe(web_view->GetWebContents());
+  web_view->LoadInitialURL(target_);
+
   content_view->AddChildView(web_view.release());
 }
 
 void PaymentHandlerWebFlowViewController::DidFinishNavigation(
     content::NavigationHandle* navigation_handle) {
-  // TODO(crbug.com/802261): Investigate failure cases (for example, what
-  // happens when the first navigation ends on a 404?)
   if (first_navigation_complete_callback_) {
-    std::move(first_navigation_complete_callback_).Run(true);
-    first_navigation_complete_callback_ = base::OnceCallback<void(bool)>();
+    std::move(first_navigation_complete_callback_)
+        .Run(true, web_contents()->GetMainFrame()->GetProcess()->GetID(),
+             web_contents()->GetMainFrame()->GetRoutingID());
+    first_navigation_complete_callback_ = PaymentHandlerOpenWindowCallback();
   }
 }
 
diff --git a/chrome/browser/ui/views/toolbar/toolbar_view.cc b/chrome/browser/ui/views/toolbar/toolbar_view.cc
index b26f9cb..faf7fff 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -458,11 +458,11 @@
     return;
   }
 
-  // We assume all child elements except the location bar are the same height.
-  // Set child_y such that buttons appear vertically centered.
-  const int child_height =
+  // We assume all toolbar buttons except for the browser actions are the same
+  // height. Set toolbar_button_y such that buttons appear vertically centered.
+  const int toolbar_button_height =
       std::min(back_->GetPreferredSize().height(), height());
-  const int child_y = (height() - child_height) / 2;
+  const int toolbar_button_y = (height() - toolbar_button_height) / 2;
 
   // If the window is maximized, we extend the back button to the left so that
   // clicking on the left-most pixel will activate the back button.
@@ -476,28 +476,31 @@
   // The padding at either end of the toolbar.
   const int end_padding = GetToolbarHorizontalPadding();
   back_->SetLeadingMargin(maximized ? end_padding : 0);
-  back_->SetBounds(maximized ? 0 : end_padding, child_y,
-                   back_->GetPreferredSize().width(), child_height);
+  back_->SetBounds(maximized ? 0 : end_padding, toolbar_button_y,
+                   back_->GetPreferredSize().width(), toolbar_button_height);
   const int element_padding = GetLayoutConstant(TOOLBAR_ELEMENT_PADDING);
   int next_element_x = back_->bounds().right() + element_padding;
 
-  forward_->SetBounds(next_element_x, child_y,
-                      forward_->GetPreferredSize().width(), child_height);
+  forward_->SetBounds(next_element_x, toolbar_button_y,
+                      forward_->GetPreferredSize().width(),
+                      toolbar_button_height);
   next_element_x = forward_->bounds().right() + element_padding;
 
-  reload_->SetBounds(next_element_x, child_y,
-                     reload_->GetPreferredSize().width(), child_height);
+  reload_->SetBounds(next_element_x, toolbar_button_y,
+                     reload_->GetPreferredSize().width(),
+                     toolbar_button_height);
   next_element_x = reload_->bounds().right();
 
   if (show_home_button_.GetValue() ||
       (browser_->is_app() && extensions::util::IsNewBookmarkAppsEnabled())) {
     next_element_x += element_padding;
     home_->SetVisible(true);
-    home_->SetBounds(next_element_x, child_y,
-                     home_->GetPreferredSize().width(), child_height);
+    home_->SetBounds(next_element_x, toolbar_button_y,
+                     home_->GetPreferredSize().width(), toolbar_button_height);
   } else {
     home_->SetVisible(false);
-    home_->SetBounds(next_element_x, child_y, 0, child_height);
+    home_->SetBounds(next_element_x, toolbar_button_y, 0,
+                     toolbar_button_height);
   }
   next_element_x =
       home_->bounds().right() + GetLayoutConstant(TOOLBAR_STANDARD_SPACING);
@@ -528,8 +531,13 @@
                            location_bar_width, location_height);
 
   next_element_x = location_bar_->bounds().right();
-  browser_actions_->SetBounds(
-      next_element_x, child_y, browser_actions_width, child_height);
+
+  // Note height() may be zero in fullscreen.
+  const int browser_actions_height =
+      std::min(browser_actions_->GetPreferredSize().height(), height());
+  const int browser_actions_y = (height() - browser_actions_height) / 2;
+  browser_actions_->SetBounds(next_element_x, browser_actions_y,
+                              browser_actions_width, browser_actions_height);
   next_element_x = browser_actions_->bounds().right();
   if (!browser_actions_width)
     next_element_x += right_padding;
@@ -547,8 +555,8 @@
   // we extend the back button to the left edge.
   if (maximized)
     app_menu_width += end_padding;
-  app_menu_button_->SetBounds(next_element_x, child_y, app_menu_width,
-                              child_height);
+  app_menu_button_->SetBounds(next_element_x, toolbar_button_y, app_menu_width,
+                              toolbar_button_height);
   app_menu_button_->SetTrailingMargin(maximized ? end_padding : 0);
 }
 
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc
index 8990345..8c97750 100644
--- a/chrome/browser/ui/webui/about_ui.cc
+++ b/chrome/browser/ui/webui/about_ui.cc
@@ -83,10 +83,7 @@
 #include "chrome/browser/chromeos/customization/customization_document.h"
 #endif
 
-using base::Time;
-using base::TimeDelta;
 using content::BrowserThread;
-using content::WebContents;
 
 namespace {
 
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
index 5fde64c4..0031061 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc
@@ -417,6 +417,19 @@
   source->AddBoolean("isEnterpriseManaged", enterprise_managed);
 }
 
+void SetupPrintPreviewPlugin(content::WebUIDataSource* source) {
+  source->AddResourcePath("pdf_preview.html",
+                          IDR_PRINT_PREVIEW_PDF_PREVIEW_HTML);
+  source->SetRequestFilter(base::BindRepeating(&HandleRequestCallback));
+  source->OverrideContentSecurityPolicyScriptSrc(
+      base::StringPrintf("script-src chrome://resources 'self' 'unsafe-eval' "
+                         "chrome-extension://%s;",
+                         extension_misc::kPdfExtensionId));
+  source->OverrideContentSecurityPolicyChildSrc("child-src 'self';");
+  source->DisableDenyXFrameOptions();
+  source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
+}
+
 content::WebUIDataSource* CreateNewPrintPreviewUISource(Profile* profile) {
   content::WebUIDataSource* source =
       content::WebUIDataSource::Create(chrome::kChromeUIPrintHost);
@@ -428,6 +441,7 @@
   }
   AddPrintPreviewImages(source);
   source->SetDefaultResource(IDR_PRINT_PREVIEW_NEW_HTML);
+  SetupPrintPreviewPlugin(source);
   AddPrintPreviewFlags(source, profile);
   return source;
 }
@@ -438,18 +452,9 @@
   AddPrintPreviewStrings(source);
   source->SetJsonPath("strings.js");
   source->AddResourcePath("print_preview.js", IDR_PRINT_PREVIEW_JS);
-  source->AddResourcePath("pdf_preview.html",
-                          IDR_PRINT_PREVIEW_PDF_PREVIEW_HTML);
   AddPrintPreviewImages(source);
   source->SetDefaultResource(IDR_PRINT_PREVIEW_HTML);
-  source->SetRequestFilter(base::Bind(&HandleRequestCallback));
-  source->OverrideContentSecurityPolicyScriptSrc(
-      base::StringPrintf("script-src chrome://resources 'self' 'unsafe-eval' "
-                         "chrome-extension://%s;",
-                         extension_misc::kPdfExtensionId));
-  source->OverrideContentSecurityPolicyChildSrc("child-src 'self';");
-  source->DisableDenyXFrameOptions();
-  source->OverrideContentSecurityPolicyObjectSrc("object-src 'self';");
+  SetupPrintPreviewPlugin(source);
   AddPrintPreviewFlags(source, profile);
   return source;
 }
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
index 72b933577..6b171c72 100644
--- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
+++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
@@ -4,37 +4,140 @@
 
 #include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h"
 
+#include "base/bind.h"
 #include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
 #include "base/metrics/user_metrics.h"
 #include "base/metrics/user_metrics_action.h"
 #include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/browser_process.h"
+#include "chrome/browser/policy/cloud/user_policy_signin_service.h"
+#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h"
+#include "chrome/browser/profiles/profile_attributes_storage.h"
+#include "chrome/browser/profiles/profile_avatar_icon_util.h"
+#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/profiles/profile_window.h"
 #include "chrome/browser/signin/account_tracker_service_factory.h"
 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
 #include "chrome/browser/signin/signin_manager_factory.h"
-#include "chrome/browser/signin/signin_promo.h"
 #include "chrome/browser/signin/signin_util.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
 #include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/startup/startup_types.h"
+#include "chrome/browser/ui/tab_dialogs.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
 #include "chrome/browser/ui/webui/signin/signin_utils_desktop.h"
+#include "chrome/common/url_constants.h"
+#include "components/browser_sync/profile_sync_service.h"
 #include "components/prefs/pref_service.h"
 #include "components/signin/core/browser/account_info.h"
 #include "components/signin/core/browser/account_tracker_service.h"
+#include "components/signin/core/browser/profile_management_switches.h"
 #include "components/signin/core/browser/profile_oauth2_token_service.h"
 #include "components/signin/core/browser/signin_metrics.h"
 #include "components/signin/core/browser/signin_pref_names.h"
+#include "components/sync/base/sync_prefs.h"
+#include "net/url_request/url_request_context_getter.h"
 
 namespace {
 
+// UMA histogram for tracking what users do when presented with the signin
+// screen.
+// Hence,
+//   (a) existing enumerated constants should never be deleted or reordered, and
+//   (b) new constants should only be appended at the end of the enumeration.
+//
+// Keep this in sync with SigninChoice in histograms.xml.
+enum SigninChoice {
+  SIGNIN_CHOICE_CANCEL = 0,
+  SIGNIN_CHOICE_CONTINUE = 1,
+  SIGNIN_CHOICE_NEW_PROFILE = 2,
+  // SIGNIN_CHOICE_SIZE should always be last - this is a count of the number
+  // of items in this enum.
+  SIGNIN_CHOICE_SIZE,
+};
+
+void SetUserChoiceHistogram(SigninChoice choice) {
+  UMA_HISTOGRAM_ENUMERATION("Enterprise.UserSigninChoice", choice,
+                            SIGNIN_CHOICE_SIZE);
+}
+
 AccountInfo GetAccountInfo(Profile* profile, const std::string& account_id) {
   return AccountTrackerServiceFactory::GetForProfile(profile)->GetAccountInfo(
       account_id);
 }
 
+// If the |browser| argument is non-null, returns the pointer directly.
+// Otherwise creates a new browser for the given profile on the given desktop,
+// adds an empty tab and makes sure the browser is visible.
+Browser* EnsureBrowser(Browser* browser, Profile* profile) {
+  if (!browser) {
+    // The user just created a new profile or has closed the browser that
+    // we used previously. Grab the most recently active browser or else
+    // create a new one.
+    browser = chrome::FindLastActiveWithProfile(profile);
+    if (!browser) {
+      browser = new Browser(Browser::CreateParams(profile, true));
+      chrome::AddTabAt(browser, GURL(), -1, true);
+    }
+    browser->window()->Show();
+  }
+  return browser;
+}
+
+void StartNewSigninInNewProfile(Profile* new_profile,
+                                const std::string& username) {
+  profiles::FindOrCreateNewWindowForProfile(
+      new_profile, chrome::startup::IS_PROCESS_STARTUP,
+      chrome::startup::IS_FIRST_RUN, false);
+  Browser* browser = chrome::FindTabbedBrowser(new_profile, false);
+  browser->signin_view_controller()->ShowDiceSigninTab(
+      profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, browser,
+      signin_metrics::AccessPoint::ACCESS_POINT_START_PAGE, username);
+}
+
 }  // namespace
 
+DiceTurnSyncOnHelper::SigninDialogDelegate::SigninDialogDelegate(
+    base::WeakPtr<DiceTurnSyncOnHelper> sync_starter)
+    : sync_starter_(sync_starter) {}
+
+DiceTurnSyncOnHelper::SigninDialogDelegate::~SigninDialogDelegate() {}
+
+void DiceTurnSyncOnHelper::SigninDialogDelegate::OnCancelSignin() {
+  SetUserChoiceHistogram(SIGNIN_CHOICE_CANCEL);
+  base::RecordAction(
+      base::UserMetricsAction("Signin_EnterpriseAccountPrompt_Cancel"));
+
+  if (sync_starter_)
+    sync_starter_->AbortAndDelete();
+}
+
+void DiceTurnSyncOnHelper::SigninDialogDelegate::OnContinueSignin() {
+  SetUserChoiceHistogram(SIGNIN_CHOICE_CONTINUE);
+  base::RecordAction(
+      base::UserMetricsAction("Signin_EnterpriseAccountPrompt_ImportData"));
+
+  if (sync_starter_)
+    sync_starter_->LoadPolicyWithCachedCredentials();
+}
+
+void DiceTurnSyncOnHelper::SigninDialogDelegate::OnSigninWithNewProfile() {
+  SetUserChoiceHistogram(SIGNIN_CHOICE_NEW_PROFILE);
+  base::RecordAction(
+      base::UserMetricsAction("Signin_EnterpriseAccountPrompt_DontImportData"));
+
+  if (sync_starter_)
+    sync_starter_->CreateNewSignedInProfile();
+}
+
 DiceTurnSyncOnHelper::DiceTurnSyncOnHelper(
     Profile* profile,
     Browser* browser,
@@ -44,29 +147,56 @@
     SigninAbortedMode signin_aborted_mode)
     : profile_(profile),
       browser_(browser),
+      signin_manager_(SigninManagerFactory::GetForProfile(profile)),
+      token_service_(ProfileOAuth2TokenServiceFactory::GetForProfile(profile)),
       signin_access_point_(signin_access_point),
       signin_reason_(signin_reason),
       signin_aborted_mode_(signin_aborted_mode),
-      account_info_(GetAccountInfo(profile, account_id)) {
+      account_info_(GetAccountInfo(profile, account_id)),
+      scoped_browser_list_observer_(this),
+      scoped_login_ui_service_observer_(this),
+      weak_pointer_factory_(this) {
+  DCHECK(signin::IsDicePrepareMigrationEnabled());
   DCHECK(profile_);
   DCHECK(browser_);
   DCHECK(!account_info_.gaia.empty());
   DCHECK(!account_info_.email.empty());
-  // Should not start synching if the profile is already authenticated
-  DCHECK(!SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated());
+  // Should not start syncing if the profile is already authenticated
+  DCHECK(!signin_manager_->IsAuthenticated());
 
   // Force sign-in uses the modal sign-in flow.
   DCHECK(!signin_util::IsForceSigninEnabled());
 
-  if (!HandleCanOfferSigninError() && !HandleCrossAccountError()) {
-    CreateSyncStarter(OneClickSigninSyncStarter::CURRENT_PROFILE);
-    base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
+  if (HasCanOfferSigninError()) {
+    AbortAndDelete();
+    return;
   }
+
+  if (!IsCrossAccountError(profile_, account_info_.email, account_info_.gaia)) {
+    TurnSyncOnWithProfileMode(ProfileMode::CURRENT_PROFILE);
+    return;
+  }
+
+  // Handles cross account sign in error. If |account_info_| does not match the
+  // last authenticated account of the current profile, then Chrome will show a
+  // confirmation dialog before starting sync.
+  // TODO(skym): Warn for high risk upgrade scenario (https://crbug.com/572754).
+  content::WebContents* web_contents =
+      browser_->tab_strip_model()->GetActiveWebContents();
+  std::string last_email =
+      profile_->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername);
+  SigninEmailConfirmationDialog::AskForConfirmation(
+      web_contents, profile_, last_email, account_info_.email,
+      base::Bind(&DiceTurnSyncOnHelper::ConfirmEmailAction,
+                 weak_pointer_factory_.GetWeakPtr()));
 }
 
-DiceTurnSyncOnHelper::~DiceTurnSyncOnHelper() {}
+DiceTurnSyncOnHelper::~DiceTurnSyncOnHelper() {
+  DCHECK(!scoped_login_ui_service_observer_.IsObservingSources());
+}
 
-bool DiceTurnSyncOnHelper::HandleCanOfferSigninError() {
+bool DiceTurnSyncOnHelper::HasCanOfferSigninError() {
+  DCHECK(browser_);
   std::string error_msg;
   bool can_offer =
       CanOfferSignin(profile_, CAN_OFFER_SIGNIN_FOR_ALL_ACCOUNTS,
@@ -78,26 +208,6 @@
   LoginUIServiceFactory::GetForProfile(profile_)->DisplayLoginResult(
       browser_, base::UTF8ToUTF16(error_msg),
       base::UTF8ToUTF16(account_info_.email));
-  Abort();
-  base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
-  return true;
-}
-
-bool DiceTurnSyncOnHelper::HandleCrossAccountError() {
-  std::string last_email =
-      profile_->GetPrefs()->GetString(prefs::kGoogleServicesLastUsername);
-
-  // TODO(skym): Warn for high risk upgrade scenario, crbug.com/572754.
-  if (!IsCrossAccountError(profile_, account_info_.email, account_info_.gaia))
-    return false;
-
-  content::WebContents* web_contents =
-      browser_->tab_strip_model()->GetActiveWebContents();
-
-  SigninEmailConfirmationDialog::AskForConfirmation(
-      web_contents, profile_, last_email, account_info_.email,
-      base::Bind(&DiceTurnSyncOnHelper::ConfirmEmailAction,
-                 base::Unretained(this)));
   return true;
 }
 
@@ -107,38 +217,209 @@
     case SigninEmailConfirmationDialog::CREATE_NEW_USER:
       base::RecordAction(
           base::UserMetricsAction("Signin_ImportDataPrompt_DontImport"));
-      CreateSyncStarter(OneClickSigninSyncStarter::NEW_PROFILE);
+      TurnSyncOnWithProfileMode(ProfileMode::NEW_PROFILE);
       break;
     case SigninEmailConfirmationDialog::START_SYNC:
       base::RecordAction(
           base::UserMetricsAction("Signin_ImportDataPrompt_ImportData"));
-      CreateSyncStarter(OneClickSigninSyncStarter::CURRENT_PROFILE);
+      TurnSyncOnWithProfileMode(ProfileMode::CURRENT_PROFILE);
       break;
     case SigninEmailConfirmationDialog::CLOSE:
       base::RecordAction(
           base::UserMetricsAction("Signin_ImportDataPrompt_Cancel"));
-      Abort();
+      AbortAndDelete();
       break;
-    default:
-      NOTREACHED() << "Invalid action";
   }
-  base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
 }
 
-void DiceTurnSyncOnHelper::CreateSyncStarter(
-    OneClickSigninSyncStarter::ProfileMode profile_mode) {
-  // OneClickSigninSyncStarter will delete itself once the job is done.
-  new OneClickSigninSyncStarter(
-      profile_, browser_, account_info_.gaia, account_info_.email, "", "",
-      signin_access_point_, signin_reason_, profile_mode,
-      OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST,
-      OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN,
-      OneClickSigninSyncStarter::Callback());
+void DiceTurnSyncOnHelper::TurnSyncOnWithProfileMode(ProfileMode profile_mode) {
+  scoped_browser_list_observer_.Add(BrowserList::GetInstance());
+
+  // Make sure the syncing is requested, otherwise the SigninManager
+  // will not be able to complete successfully.
+  syncer::SyncPrefs sync_prefs(profile_->GetPrefs());
+  sync_prefs.SetSyncRequested(true);
+
+  switch (profile_mode) {
+    case ProfileMode::CURRENT_PROFILE: {
+      // If this is a new signin (no account authenticated yet) try loading
+      // policy for this user now, before any signed in services are
+      // initialized.
+      policy::UserPolicySigninService* policy_service =
+          policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
+      policy_service->RegisterForPolicyWithAccountId(
+          account_info_.email, account_info_.account_id,
+          base::Bind(&DiceTurnSyncOnHelper::OnRegisteredForPolicy,
+                     weak_pointer_factory_.GetWeakPtr()));
+      break;
+    }
+    case ProfileMode::NEW_PROFILE:
+      // If this is a new signin (no account authenticated yet) in a new
+      // profile, then just create the new signed-in profile and skip loading
+      // the policy as there is no need to ask the user again if they should be
+      // signed in to a new profile. Note that in this case the policy will be
+      // applied after the new profile is signed in.
+      CreateNewSignedInProfile();
+      break;
+  }
 }
 
-void DiceTurnSyncOnHelper::Abort() {
+void DiceTurnSyncOnHelper::OnRegisteredForPolicy(const std::string& dm_token,
+                                                 const std::string& client_id) {
+  // If there's no token for the user (policy registration did not succeed) just
+  // finish signing in.
+  if (dm_token.empty()) {
+    DVLOG(1) << "Policy registration failed";
+    SigninAndShowSyncConfirmationUI();
+    return;
+  }
+
+  DVLOG(1) << "Policy registration succeeded: dm_token=" << dm_token;
+
+  DCHECK(dm_token_.empty());
+  DCHECK(client_id_.empty());
+  dm_token_ = dm_token;
+  client_id_ = client_id;
+
+  // Allow user to create a new profile before continuing with sign-in.
+  browser_ = EnsureBrowser(browser_, profile_);
+  content::WebContents* web_contents =
+      browser_->tab_strip_model()->GetActiveWebContents();
+  if (!web_contents) {
+    AbortAndDelete();
+    return;
+  }
+
+  base::RecordAction(
+      base::UserMetricsAction("Signin_Show_EnterpriseAccountPrompt"));
+  TabDialogs::FromWebContents(web_contents)
+      ->ShowProfileSigninConfirmation(browser_, profile_, account_info_.email,
+                                      std::make_unique<SigninDialogDelegate>(
+                                          weak_pointer_factory_.GetWeakPtr()));
+}
+
+void DiceTurnSyncOnHelper::LoadPolicyWithCachedCredentials() {
+  DCHECK(!dm_token_.empty());
+  DCHECK(!client_id_.empty());
+  policy::UserPolicySigninService* policy_service =
+      policy::UserPolicySigninServiceFactory::GetForProfile(profile_);
+  policy_service->FetchPolicyForSignedInUser(
+      account_info_.email, dm_token_, client_id_, profile_->GetRequestContext(),
+      base::Bind(&DiceTurnSyncOnHelper::OnPolicyFetchComplete,
+                 weak_pointer_factory_.GetWeakPtr()));
+}
+
+void DiceTurnSyncOnHelper::OnPolicyFetchComplete(bool success) {
+  // For now, we allow signin to complete even if the policy fetch fails. If
+  // we ever want to change this behavior, we could call
+  // SigninManager::SignOut() here instead.
+  DLOG_IF(ERROR, !success) << "Error fetching policy for user";
+  DVLOG_IF(1, success) << "Policy fetch successful - completing signin";
+  SigninAndShowSyncConfirmationUI();
+}
+
+void DiceTurnSyncOnHelper::CreateNewSignedInProfile() {
+  // Create a new profile and have it call back when done so we can start the
+  // signin flow.
+  size_t icon_index = g_browser_process->profile_manager()
+                          ->GetProfileAttributesStorage()
+                          .ChooseAvatarIconIndexForNewProfile();
+  ProfileManager::CreateMultiProfileAsync(
+      base::UTF8ToUTF16(account_info_.email),
+      profiles::GetDefaultAvatarIconUrl(icon_index),
+      base::BindRepeating(&DiceTurnSyncOnHelper::CompleteInitForNewProfile,
+                          weak_pointer_factory_.GetWeakPtr()),
+      std::string());
+}
+
+void DiceTurnSyncOnHelper::CompleteInitForNewProfile(
+    Profile* new_profile,
+    Profile::CreateStatus status) {
+  DCHECK_NE(profile_, new_profile);
+
+  // TODO(atwilson): On error, unregister the client to release the DMToken
+  // and surface a better error for the user.
+  switch (status) {
+    case Profile::CREATE_STATUS_LOCAL_FAIL:
+      NOTREACHED() << "Error creating new profile";
+      AbortAndDelete();
+      break;
+    case Profile::CREATE_STATUS_CREATED:
+      // Ignore this, wait for profile to be initialized.
+      break;
+    case Profile::CREATE_STATUS_INITIALIZED:
+      // The user needs to sign in to the new profile in order to enable sync.
+      StartNewSigninInNewProfile(new_profile, account_info_.email);
+      AbortAndDelete();
+      break;
+    case Profile::CREATE_STATUS_REMOTE_FAIL:
+    case Profile::CREATE_STATUS_CANCELED:
+    case Profile::MAX_CREATE_STATUS: {
+      NOTREACHED() << "Invalid profile creation status";
+      AbortAndDelete();
+      break;
+    }
+  }
+}
+
+browser_sync::ProfileSyncService*
+DiceTurnSyncOnHelper::GetProfileSyncService() {
+  return profile_->IsSyncAllowed()
+             ? ProfileSyncServiceFactory::GetForProfile(profile_)
+             : nullptr;
+}
+
+void DiceTurnSyncOnHelper::SigninAndShowSyncConfirmationUI() {
+  // Signin.
+  signin_manager_->OnExternalSigninCompleted(account_info_.email);
+  signin_metrics::LogSigninAccessPointCompleted(signin_access_point_);
+  signin_metrics::LogSigninReason(signin_reason_);
+  base::RecordAction(base::UserMetricsAction("Signin_Signin_Succeed"));
+
+  // Show Sync confirmation.
+  browser_sync::ProfileSyncService* sync_service = GetProfileSyncService();
+  if (sync_service)
+    sync_blocker_ = sync_service->GetSetupInProgressHandle();
+  scoped_login_ui_service_observer_.Add(
+      LoginUIServiceFactory::GetForProfile(profile_));
+  browser_ = EnsureBrowser(browser_, profile_);
+  browser_->signin_view_controller()->ShowModalSyncConfirmationDialog(browser_);
+}
+
+void DiceTurnSyncOnHelper::OnSyncConfirmationUIClosed(
+    LoginUIService::SyncConfirmationUIClosedResult result) {
+  scoped_login_ui_service_observer_.RemoveAll();
+  switch (result) {
+    case LoginUIService::CONFIGURE_SYNC_FIRST:
+      browser_ = EnsureBrowser(browser_, profile_);
+      chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage);
+      break;
+    case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: {
+      browser_sync::ProfileSyncService* sync_service = GetProfileSyncService();
+      if (sync_service)
+        sync_service->SetFirstSetupComplete();
+      break;
+    }
+    case LoginUIService::ABORT_SIGNIN:
+      signin_manager_->SignOutAndKeepAllAccounts(
+          signin_metrics::ABORT_SIGNIN,
+          signin_metrics::SignoutDelete::IGNORE_METRIC);
+      AbortAndDelete();
+      return;
+  }
+  delete this;
+}
+
+void DiceTurnSyncOnHelper::OnBrowserRemoved(Browser* browser) {
+  if (browser == browser_)
+    browser_ = nullptr;
+}
+
+void DiceTurnSyncOnHelper::AbortAndDelete() {
   if (signin_aborted_mode_ == SigninAbortedMode::REMOVE_ACCOUNT) {
-    ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)
-        ->RevokeCredentials(account_info_.account_id);
+    // Revoke the token, and the AccountReconcilor and/or the Gaia server will
+    // take care of invalidating the cookies.
+    token_service_->RevokeCredentials(account_info_.account_id);
   }
+  delete this;
 }
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
index 704e7b0..d1ef87b 100644
--- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
+++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
@@ -7,14 +7,33 @@
 
 #include <string>
 
-#include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
+#include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser_list_observer.h"
+#include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.h"
 #include "chrome/browser/ui/webui/signin/signin_email_confirmation_dialog.h"
 #include "components/signin/core/browser/account_info.h"
 #include "components/signin/core/browser/signin_metrics.h"
 
+class Browser;
+class BrowserList;
+class ProfileOAuth2TokenService;
+class SigninManager;
+
+namespace browser_sync {
+class ProfileSyncService;
+}
+
+namespace syncer {
+class SyncSetupInProgressHandle;
+}
+
 // Handles details of signing the user in with SigninManager and turning on
 // sync for an account that is already present in the token service.
-class DiceTurnSyncOnHelper {
+class DiceTurnSyncOnHelper : public BrowserListObserver,
+                             public LoginUIService::Observer {
  public:
   // Behavior when the signin is aborted (by an error or cancelled by the user).
   enum class SigninAbortedMode {
@@ -33,39 +52,112 @@
                        const std::string& account_id,
                        SigninAbortedMode signin_aborted_mode);
 
-  virtual ~DiceTurnSyncOnHelper();
-
  private:
+  enum class ProfileMode {
+    // Attempts to sign the user in |profile_|. Note that if the account to be
+    // signed in is a managed account, then a profile confirmation dialog is
+    // shown and the user has the possibility to create a new profile before
+    // signing in.
+    CURRENT_PROFILE,
+
+    // Creates a new profile and signs the user in this new profile.
+    NEW_PROFILE
+  };
+
+  // User input handler for the signin confirmation dialog.
+  class SigninDialogDelegate : public ui::ProfileSigninConfirmationDelegate {
+   public:
+    explicit SigninDialogDelegate(
+        base::WeakPtr<DiceTurnSyncOnHelper> sync_starter);
+    ~SigninDialogDelegate() override;
+    void OnCancelSignin() override;
+    void OnContinueSignin() override;
+    void OnSigninWithNewProfile() override;
+
+   private:
+    base::WeakPtr<DiceTurnSyncOnHelper> sync_starter_;
+  };
+  friend class SigninDialogDelegate;
+
+  // DiceTurnSyncOnHelper deletes itself.
+  ~DiceTurnSyncOnHelper() override;
+
   // Handles can offer sign-in errors.  It returns true if there is an error,
   // and false otherwise.
-  bool HandleCanOfferSigninError();
-
-  // Handles cross account sign in error. If |account_info_| does not match the
-  // last authenticated account of the current profile, then Chrome will show a
-  // confirmation dialog before starting sync. It returns true if there is a
-  // cross account error, and false otherwise.
-  bool HandleCrossAccountError();
+  bool HasCanOfferSigninError();
 
   // Callback used with ConfirmEmailDialogDelegate.
   void ConfirmEmailAction(SigninEmailConfirmationDialog::Action action);
 
-  // Creates the sync starter.
-  void CreateSyncStarter(OneClickSigninSyncStarter::ProfileMode profile_mode);
+  // Turns sync on with the current profile or a new profile.
+  void TurnSyncOnWithProfileMode(ProfileMode profile_mode);
 
-  // Aborts the flow.
-  void Abort();
+  // Callback invoked once policy registration is complete. If registration
+  // fails, |dm_token| and |client_id| will be empty.
+  void OnRegisteredForPolicy(const std::string& dm_token,
+                             const std::string& client_id);
+
+  // Helper function that loads policy with the cached |dm_token_| and
+  // |client_id|, then completes the signin process.
+  void LoadPolicyWithCachedCredentials();
+
+  // Callback invoked when a policy fetch request has completed. |success| is
+  // true if policy was successfully fetched.
+  void OnPolicyFetchComplete(bool success);
+
+  // Called to create a new profile, which is then signed in with the
+  // in-progress auth credentials currently stored in this object.
+  void CreateNewSignedInProfile();
+
+  // Callback invoked once a profile is created, so we can complete the
+  // credentials transfer, load policy, and open the first window.
+  void CompleteInitForNewProfile(Profile* new_profile,
+                                 Profile::CreateStatus status);
+
+  // Returns the ProfileSyncService, or nullptr if sync is not allowed.
+  browser_sync::ProfileSyncService* GetProfileSyncService();
+
+  // Completes the signin in SigninManager and displays the Sync confirmation
+  // UI.
+  void SigninAndShowSyncConfirmationUI();
+
+  // LoginUIService::Observer override. Deletes this object.
+  void OnSyncConfirmationUIClosed(
+      LoginUIService::SyncConfirmationUIClosedResult result) override;
+
+  // BrowserListObserver override.
+  void OnBrowserRemoved(Browser* browser) override;
+
+  // Aborts the flow and deletes this object.
+  void AbortAndDelete();
 
   Profile* profile_;
   Browser* browser_;
-  signin_metrics::AccessPoint signin_access_point_;
-  signin_metrics::Reason signin_reason_;
+  SigninManager* signin_manager_;
+  ProfileOAuth2TokenService* token_service_;
+  const signin_metrics::AccessPoint signin_access_point_;
+  const signin_metrics::Reason signin_reason_;
 
   // Whether the refresh token should be deleted if the Sync flow is aborted.
-  SigninAbortedMode signin_aborted_mode_;
+  const SigninAbortedMode signin_aborted_mode_;
 
   // Account information.
   const AccountInfo account_info_;
 
+  // Prevents Sync from running until configuration is complete.
+  std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_;
+
+  // Policy credentials we keep while determining whether to create
+  // a new profile for an enterprise user or not.
+  std::string dm_token_;
+  std::string client_id_;
+
+  ScopedObserver<BrowserList, BrowserListObserver>
+      scoped_browser_list_observer_;
+  ScopedObserver<LoginUIService, LoginUIService::Observer>
+      scoped_login_ui_service_observer_;
+
+  base::WeakPtrFactory<DiceTurnSyncOnHelper> weak_pointer_factory_;
   DISALLOW_COPY_AND_ASSIGN(DiceTurnSyncOnHelper);
 };
 
diff --git a/chrome/browser/ui/webui/signin/login_ui_test_utils.cc b/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
index 6a0d125..05d2e82 100644
--- a/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
+++ b/chrome/browser/ui/webui/signin/login_ui_test_utils.cc
@@ -5,12 +5,15 @@
 #include "chrome/browser/ui/webui/signin/login_ui_test_utils.h"
 
 #include "base/run_loop.h"
+#include "base/scoped_observer.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "chrome/browser/signin/signin_promo.h"
 #include "chrome/browser/signin/signin_tracker_factory.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/signin_view_controller_delegate.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
 #include "chrome/browser/ui/webui/signin/signin_utils.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/browser/notification_service.h"
@@ -100,6 +103,30 @@
   scoped_refptr<MessageLoopRunner> message_loop_runner_;
 };
 
+// Synchronously waits for the Sync confirmation to be closed.
+class SyncConfirmationClosedObserver : public LoginUIService::Observer {
+ public:
+  void WaitForConfirmationClosed() {
+    if (sync_confirmation_closed_)
+      return;
+
+    base::RunLoop run_loop;
+    quit_closure_ = run_loop.QuitClosure();
+    run_loop.Run();
+  }
+
+ private:
+  void OnSyncConfirmationUIClosed(
+      LoginUIService::SyncConfirmationUIClosedResult result) override {
+    sync_confirmation_closed_ = true;
+    if (quit_closure_)
+      std::move(quit_closure_).Run();
+  }
+
+  bool sync_confirmation_closed_ = false;
+  base::OnceClosure quit_closure_;
+};
+
 void RunLoopFor(base::TimeDelta duration) {
   base::RunLoop run_loop;
   base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
@@ -127,16 +154,25 @@
         signin_view_controller->GetModalDialogWebContentsForTesting();
     DCHECK_NE(dialog_web_contents, nullptr);
     std::string message;
-    std::string js =
-        "if (document.getElementById('confirmButton') == null) {"
+    std::string find_button_js =
+        "if (document.readyState != 'complete') {"
+        "  window.domAutomationController.send('DocumentNotReady');"
+        "} else if (document.getElementById('confirmButton') == null) {"
         "  window.domAutomationController.send('NotFound');"
         "} else {"
-        "  document.getElementById('confirmButton').click();"
         "  window.domAutomationController.send('Ok');"
         "}";
-    EXPECT_TRUE(content::ExecuteScriptAndExtractString(dialog_web_contents, js,
-                                                       &message));
-    return message == "Ok";
+    EXPECT_TRUE(content::ExecuteScriptAndExtractString(
+        dialog_web_contents, find_button_js, &message));
+    if (message != "Ok")
+      return false;
+
+    // This cannot be a synchronous call, because it closes the window as a side
+    // effect, which may cause the javascript execution to never finish.
+    content::ExecuteScriptAsync(
+        dialog_web_contents,
+        "document.getElementById('confirmButton').click();");
+    return true;
 #endif
   }
 };
@@ -275,10 +311,19 @@
 }
 
 bool DismissSyncConfirmationDialog(Browser* browser, base::TimeDelta timeout) {
+  SyncConfirmationClosedObserver confirmation_closed_observer;
+  ScopedObserver<LoginUIService, LoginUIService::Observer>
+      scoped_confirmation_closed_observer(&confirmation_closed_observer);
+  scoped_confirmation_closed_observer.Add(
+      LoginUIServiceFactory::GetForProfile(browser->profile()));
+
   const base::Time expire_time = base::Time::Now() + timeout;
   while (base::Time::Now() <= expire_time) {
-    if (SigninViewControllerTestUtil::TryDismissSyncConfirmationDialog(browser))
+    if (SigninViewControllerTestUtil::TryDismissSyncConfirmationDialog(
+            browser)) {
+      confirmation_closed_observer.WaitForConfirmationClosed();
       return true;
+    }
     RunLoopFor(base::TimeDelta::FromMilliseconds(1000));
   }
   return false;
diff --git a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
index 7805897..170211b6 100644
--- a/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
+++ b/chrome/browser/ui/webui/signin/sync_confirmation_handler.cc
@@ -77,15 +77,7 @@
 
 void SyncConfirmationHandler::HandleUndo(const base::ListValue* args) {
   did_user_explicitly_interact = true;
-  base::RecordAction(base::UserMetricsAction("Signin_Undo_Signin"));
-  LoginUIServiceFactory::GetForProfile(profile_)->SyncConfirmationUIClosed(
-      LoginUIService::ABORT_SIGNIN);
-  SigninManagerFactory::GetForProfile(profile_)->SignOut(
-      signin_metrics::ABORT_SIGNIN,
-      signin_metrics::SignoutDelete::IGNORE_METRIC);
-
-  if (browser_)
-    browser_->signin_view_controller()->CloseModalSignin();
+  CloseModalSigninWindow(LoginUIService::ABORT_SIGNIN);
 }
 
 void SyncConfirmationHandler::SetUserImageURL(const std::string& picture_url) {
@@ -119,6 +111,19 @@
 
 void SyncConfirmationHandler::CloseModalSigninWindow(
     LoginUIService::SyncConfirmationUIClosedResult result) {
+  switch (result) {
+    case LoginUIService::CONFIGURE_SYNC_FIRST:
+      base::RecordAction(
+          base::UserMetricsAction("Signin_Signin_WithAdvancedSyncSettings"));
+      break;
+    case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS:
+      base::RecordAction(
+          base::UserMetricsAction("Signin_Signin_WithDefaultSyncSettings"));
+      break;
+    case LoginUIService::ABORT_SIGNIN:
+      base::RecordAction(base::UserMetricsAction("Signin_Undo_Signin"));
+      break;
+  }
   LoginUIServiceFactory::GetForProfile(profile_)->SyncConfirmationUIClosed(
       result);
   if (browser_)
diff --git a/chrome/browser/vr/elements/button.cc b/chrome/browser/vr/elements/button.cc
index dda9c77..018427c 100644
--- a/chrome/browser/vr/elements/button.cc
+++ b/chrome/browser/vr/elements/button.cc
@@ -38,6 +38,7 @@
 
   auto hit_plane = std::make_unique<InvisibleHitTarget>();
   hit_plane->SetType(kTypeButtonHitTarget);
+  hit_plane->set_focusable(false);
   hit_plane->set_bubble_events(true);
   hit_plane->set_contributes_to_parent_bounds(false);
   hit_plane_ = hit_plane.get();
diff --git a/chrome/browser/vr/elements/text_input.cc b/chrome/browser/vr/elements/text_input.cc
index 4cd4c74..5c72ef9 100644
--- a/chrome/browser/vr/elements/text_input.cc
+++ b/chrome/browser/vr/elements/text_input.cc
@@ -85,14 +85,14 @@
 }
 
 void TextInput::RequestFocus() {
-  if (!delegate_)
+  if (!delegate_ || focused_)
     return;
 
   delegate_->RequestFocus(id());
 }
 
 void TextInput::RequestUnfocus() {
-  if (!delegate_)
+  if (!delegate_ || !focused_)
     return;
 
   delegate_->RequestUnfocus(id());
diff --git a/chrome/browser/vr/text_perftest.cc b/chrome/browser/vr/text_perftest.cc
index 832a3e5d..22bef41a 100644
--- a/chrome/browser/vr/text_perftest.cc
+++ b/chrome/browser/vr/text_perftest.cc
@@ -43,9 +43,9 @@
 
  protected:
   void PrintResults(const std::string& name) {
-    perf_test::PrintResult(name, "", "render_time_avg", timer_.MsPerLap(), "ms",
-                           true);
-    perf_test::PrintResult(name, "", "number_of_runs",
+    perf_test::PrintResult("TextPerfTest", ".render_time_avg", name,
+                           timer_.MsPerLap(), "ms", true);
+    perf_test::PrintResult("TextPerfTest", ".number_of_runs", name,
                            static_cast<size_t>(timer_.NumLaps()), "runs", true);
   }
 
diff --git a/chrome/browser/vr/ui_scene_creator.cc b/chrome/browser/vr/ui_scene_creator.cc
index a96e67c..50426ec 100644
--- a/chrome/browser/vr/ui_scene_creator.cc
+++ b/chrome/browser/vr/ui_scene_creator.cc
@@ -278,6 +278,7 @@
   auto spacer = Create<Rect>(kNone, kPhaseForeground);
   spacer->SetType(kTypeOmniboxSuggestionSpacer);
   spacer->SetSize(kOmniboxWidthDMM, kSuggestionVerticalPaddingDMM);
+  spacer->set_focusable(false);
   spacer->AddBinding(std::make_unique<Binding<bool>>(
       VR_BIND_LAMBDA([](Model* m) { return !m->omnibox_suggestions.empty(); },
                      base::Unretained(model)),
@@ -1560,8 +1561,12 @@
   omnibox_text_field->set_x_anchoring(LEFT);
   omnibox_text_field->SetTranslate(kOmniboxTextMarginDMM, 0, 0);
   omnibox_text_field->AddBinding(std::make_unique<Binding<bool>>(
-      VR_BIND_LAMBDA([](Model* m) { return m->omnibox_editing_enabled(); },
-                     base::Unretained(model_)),
+      VR_BIND_LAMBDA(
+          [](Model* m) {
+            return m->omnibox_editing_enabled() &&
+                   m->active_modal_prompt_type == kModalPromptTypeNone;
+          },
+          base::Unretained(model_)),
       VR_BIND_LAMBDA(
           [](TextInput* e, Model* m, const bool& v) {
             if (v) {
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java
index eeacc8c..05fd3e4 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/ApplicationTestUtils.java
@@ -82,6 +82,8 @@
         ApplicationData.clearAppData(context);
     }
 
+    // TODO(bauerb): make this function throw more specific exception and update
+    // StartupLoadingMetricsTest correspondingly.
     /** Send the user to the Android home screen. */
     public static void fireHomeScreenIntent(Context context) throws Exception {
         Intent intent = new Intent(Intent.ACTION_MAIN);
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/notifications/MockNotificationManagerProxy.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/notifications/MockNotificationManagerProxy.java
index a5898f8..8623c33 100644
--- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/notifications/MockNotificationManagerProxy.java
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/notifications/MockNotificationManagerProxy.java
@@ -9,6 +9,7 @@
 import android.app.NotificationChannel;
 import android.app.NotificationChannelGroup;
 import android.os.Build;
+import android.service.notification.StatusBarNotification;
 
 import org.chromium.chrome.browser.notifications.NotificationManagerProxy;
 
@@ -111,8 +112,8 @@
         return key;
     }
 
-    // The following Channel methods are not implemented because a naive implementation would
-    // have compatibility issues (NotificationChannel is new in O), and we currently don't need them
+    // The following methods are not implemented because a naive implementation would
+    // have compatibility issues (this functionality is new in O), and we currently don't need them
     // where the MockNotificationManagerProxy is used in tests.
 
     @TargetApi(Build.VERSION_CODES.O)
@@ -147,4 +148,9 @@
 
     @Override
     public void deleteNotificationChannelGroup(String groupId) {}
+
+    @Override
+    public StatusBarNotification[] getActiveNotifications() {
+        return new StatusBarNotification[0];
+    }
 }
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc
index 32c7334..4a82b593 100644
--- a/chrome/test/base/testing_profile.cc
+++ b/chrome/test/base/testing_profile.cc
@@ -799,7 +799,10 @@
 
   if (!policy_service_) {
     std::vector<policy::ConfigurationPolicyProvider*> providers;
-    policy_service_.reset(new policy::PolicyServiceImpl(providers));
+    std::unique_ptr<policy::PolicyServiceImpl> policy_service =
+        std::make_unique<policy::PolicyServiceImpl>();
+    policy_service->SetProviders(providers);
+    policy_service_ = std::move(policy_service);
   }
   profile_policy_connector_.reset(new policy::ProfilePolicyConnector());
   profile_policy_connector_->InitForTesting(std::move(policy_service_));
diff --git a/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js b/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js
index 7dc67d5..42c974c 100644
--- a/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js
+++ b/chrome/test/data/webui/print_preview/new_print_preview_ui_browsertest.js
@@ -140,6 +140,7 @@
     return super.extraLibraries.concat([
       '../test_browser_proxy.js',
       'native_layer_stub.js',
+      'plugin_stub.js',
       'print_preview_test_utils.js',
       'restore_state_test.js',
     ]);
diff --git a/chrome/test/data/webui/print_preview/restore_state_test.js b/chrome/test/data/webui/print_preview/restore_state_test.js
index d6a1892b..73ea48c 100644
--- a/chrome/test/data/webui/print_preview/restore_state_test.js
+++ b/chrome/test/data/webui/print_preview/restore_state_test.js
@@ -76,6 +76,8 @@
           print_preview_test_utils.getCddTemplate(initialSettings.printerName));
 
       page = document.createElement('print-preview-app');
+      const previewArea = page.$$('print-preview-preview-area');
+      previewArea.plugin_ = new print_preview.PDFPluginStub(previewArea);
       document.body.appendChild(page);
       return nativeLayer.whenCalled('getInitialSettings').then(function() {
         verifyStickySettingsApplied(stickySettings);
@@ -221,6 +223,8 @@
           print_preview_test_utils.getCddTemplate(initialSettings.printerName));
 
       page = document.createElement('print-preview-app');
+      const previewArea = page.$$('print-preview-preview-area');
+      previewArea.plugin_ = new print_preview.PDFPluginStub(previewArea);
       document.body.appendChild(page);
 
       return nativeLayer.whenCalled('getInitialSettings')
diff --git a/chrome/test/data/webui/print_preview/settings_section_test.js b/chrome/test/data/webui/print_preview/settings_section_test.js
index 7cd22066..7af18e2c 100644
--- a/chrome/test/data/webui/print_preview/settings_section_test.js
+++ b/chrome/test/data/webui/print_preview/settings_section_test.js
@@ -59,6 +59,14 @@
       page.set('documentInfo_', info);
     }
 
+    function addSelection() {
+      // Add a selection.
+      let info = new print_preview.DocumentInfo();
+      info.init(page.documentInfo_.isModifiable, 'title', true);
+      page.set('documentInfo_', info);
+      Polymer.dom.flush();
+    }
+
     function setPdfDestination() {
       const saveAsPdfDestination = new print_preview.Destination(
           print_preview.Destination.GooglePromotedId.SAVE_AS_PDF,
@@ -333,7 +341,8 @@
         expectEquals(valid, hint.hidden);
       };
       validateInputState(true, '', true);
-      expectEquals(0, page.settings.pages.value.length);
+      expectEquals(0, page.settings.ranges.value.length);
+      expectEquals(3, page.settings.pages.value.length);
       expectEquals(true, page.settings.pages.valid);
 
       // Set selection of pages 1 and 2.
@@ -342,20 +351,22 @@
       pagesInput.value = '1-2';
       pagesInput.dispatchEvent(new CustomEvent('input'));
       validateInputState(false, '1-2', true);
-      assertEquals(1, page.settings.pages.value.length);
-      expectEquals(1, page.settings.pages.value[0].from);
-      expectEquals(2, page.settings.pages.value[0].to);
+      assertEquals(1, page.settings.ranges.value.length);
+      expectEquals(1, page.settings.ranges.value[0].from);
+      expectEquals(2, page.settings.ranges.value[0].to);
+      expectEquals(2, page.settings.pages.value.length);
       expectEquals(true, page.settings.pages.valid);
 
       // Select pages 1 and 3
       pagesInput.value = '1, 3';
       pagesInput.dispatchEvent(new CustomEvent('input'));
       validateInputState(false, '1, 3', true);
-      assertEquals(2, page.settings.pages.value.length);
-      expectEquals(1, page.settings.pages.value[0].from);
-      expectEquals(1, page.settings.pages.value[0].to);
-      expectEquals(3, page.settings.pages.value[1].from);
-      expectEquals(3, page.settings.pages.value[1].to);
+      assertEquals(2, page.settings.ranges.value.length);
+      expectEquals(1, page.settings.ranges.value[0].from);
+      expectEquals(1, page.settings.ranges.value[0].to);
+      expectEquals(3, page.settings.ranges.value[1].from);
+      expectEquals(3, page.settings.ranges.value[1].to);
+      expectEquals(2, page.settings.pages.value.length);
       expectEquals(true, page.settings.pages.valid);
 
       // Enter an out of bounds value.
@@ -564,7 +575,7 @@
       const optionsElement = page.$$('print-preview-other-options-settings');
       expectEquals(false, optionsElement.hidden);
 
-      // HTML - Header/footer, duplex, and CSS background. Also add seleciton.
+      // HTML - Header/footer, duplex, and CSS background. Also add selection.
       initDocumentInfo(false, true);
 
       const testOptionCheckbox = (element, defaultValue, optionSetting) => {
diff --git a/chrome/test/data/webui/settings/site_details_tests.js b/chrome/test/data/webui/settings/site_details_tests.js
index a4b7e9ca..d99cfb56 100644
--- a/chrome/test/data/webui/settings/site_details_tests.js
+++ b/chrome/test/data/webui/settings/site_details_tests.js
@@ -146,9 +146,19 @@
     optionalSiteDetailsContentSettingsTypes[settings.ContentSettingsTypes
                                                 .CLIPBOARD] =
         'enableClipboardContentSetting';
+    optionalSiteDetailsContentSettingsTypes[settings.ContentSettingsTypes.ADS] =
+        'enableSafeBrowsingSubresourceFilter';
 
     browserProxy.setPrefs(prefs);
 
+    // First, explicitly set all the optional settings to false.
+    for (contentSetting in optionalSiteDetailsContentSettingsTypes) {
+      const loadTimeDataOverride = {};
+      loadTimeDataOverride
+          [optionalSiteDetailsContentSettingsTypes[contentSetting]] = false;
+      loadTimeData.overrideValues(loadTimeDataOverride);
+    }
+
     // Iterate over each flag in on / off state, assuming that the on state
     // means the content setting will show, and off hides it.
     for (contentSetting in optionalSiteDetailsContentSettingsTypes) {
diff --git a/chromecast/browser/cast_content_browser_client.cc b/chromecast/browser/cast_content_browser_client.cc
index 4b72f31..3a23447 100644
--- a/chromecast/browser/cast_content_browser_client.cc
+++ b/chromecast/browser/cast_content_browser_client.cc
@@ -171,8 +171,13 @@
   std::string process_type =
       command_line->GetSwitchValueNative(switches::kProcessType);
   if (process_type == switches::kGpuProcess) {
-    gfx::Size res =
-        display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel();
+    auto display = display::Screen::GetScreen()->GetPrimaryDisplay();
+    gfx::Size res = display.GetSizeInPixel();
+    if (display.rotation() == display::Display::ROTATE_90 ||
+        display.rotation() == display::Display::ROTATE_270) {
+      res = gfx::Size(res.height(), res.width());
+    }
+
     if (!command_line->HasSwitch(switches::kCastInitialScreenWidth)) {
       command_line->AppendSwitchASCII(switches::kCastInitialScreenWidth,
                                       base::IntToString(res.width()));
diff --git a/chromecast/graphics/DEPS b/chromecast/graphics/DEPS
index d49a92ab..11f2ce64 100644
--- a/chromecast/graphics/DEPS
+++ b/chromecast/graphics/DEPS
@@ -7,6 +7,7 @@
   "+ui/gfx",
   "+ui/gl/test",
   "+ui/views",
+  "+ui/wm/core",
   "+ui/wm/public",
 ]
 
diff --git a/chromecast/graphics/cast_window_manager_aura.cc b/chromecast/graphics/cast_window_manager_aura.cc
index 6d3deb9..30385d7f5 100644
--- a/chromecast/graphics/cast_window_manager_aura.cc
+++ b/chromecast/graphics/cast_window_manager_aura.cc
@@ -8,6 +8,7 @@
 #include "chromecast/graphics/cast_focus_client_aura.h"
 #include "ui/aura/client/default_capture_client.h"
 #include "ui/aura/client/focus_change_observer.h"
+#include "ui/aura/client/screen_position_client.h"
 #include "ui/aura/env.h"
 #include "ui/aura/layout_manager.h"
 #include "ui/aura/window.h"
@@ -16,6 +17,7 @@
 #include "ui/base/ime/input_method_factory.h"
 #include "ui/display/display.h"
 #include "ui/display/screen.h"
+#include "ui/wm/core/default_screen_position_client.h"
 
 namespace chromecast {
 namespace {
@@ -27,7 +29,10 @@
     case display::Display::ROTATE_0:
       break;
     case display::Display::ROTATE_90:
-      rotation.Translate(display.bounds().height(), 0);
+      // TODO(dnicoara): Figure out why this is not correct.
+      // rotation.Translate(display.height(), 0);
+      rotation.Translate(
+          (display.bounds().height() + display.bounds().width()) / 2, 0);
       rotation.Rotate(90);
       break;
     case display::Display::ROTATE_180:
@@ -35,7 +40,10 @@
       rotation.Rotate(180);
       break;
     case display::Display::ROTATE_270:
-      rotation.Translate(0, display.bounds().width());
+      // TODO(dnicoara): Figure out why this is not correct.
+      // rotation.Translate(0, display.width());
+      rotation.Translate(
+          0, (display.bounds().height() + display.bounds().width()) / 2);
       rotation.Rotate(270);
       break;
   }
@@ -210,6 +218,13 @@
 
   gfx::Size display_size =
       display::Screen::GetScreen()->GetPrimaryDisplay().GetSizeInPixel();
+  display::Display::Rotation rotation =
+      display::Screen::GetScreen()->GetPrimaryDisplay().rotation();
+  if (rotation == display::Display::ROTATE_90 ||
+      rotation == display::Display::ROTATE_270) {
+    display_size = gfx::Size(display_size.height(), display_size.width());
+  }
+
   LOG(INFO) << "Starting window manager, screen size: " << display_size.width()
             << "x" << display_size.height();
   CHECK(aura::Env::GetInstance());
@@ -230,6 +245,11 @@
   capture_client_.reset(
       new aura::client::DefaultCaptureClient(window_tree_host_->window()));
 
+  screen_position_client_.reset(new wm::DefaultScreenPositionClient());
+  aura::client::SetScreenPositionClient(
+      window_tree_host_->window()->GetRootWindow(),
+      screen_position_client_.get());
+
   window_tree_host_->Show();
 }
 
diff --git a/chromecast/graphics/cast_window_manager_aura.h b/chromecast/graphics/cast_window_manager_aura.h
index 44a1e57d..4cbeab61 100644
--- a/chromecast/graphics/cast_window_manager_aura.h
+++ b/chromecast/graphics/cast_window_manager_aura.h
@@ -14,6 +14,7 @@
 namespace aura {
 namespace client {
 class DefaultCaptureClient;
+class ScreenPositionClient;
 }  // namespace client
 }  // namespace aura
 
@@ -50,6 +51,7 @@
   std::unique_ptr<CastWindowTreeHost> window_tree_host_;
   std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_;
   std::unique_ptr<CastFocusClientAura> focus_client_;
+  std::unique_ptr<aura::client::ScreenPositionClient> screen_position_client_;
 
   DISALLOW_COPY_AND_ASSIGN(CastWindowManagerAura);
 };
diff --git a/chromecast/media/cma/backend/BUILD.gn b/chromecast/media/cma/backend/BUILD.gn
index 73bce9ca..426326a 100644
--- a/chromecast/media/cma/backend/BUILD.gn
+++ b/chromecast/media/cma/backend/BUILD.gn
@@ -141,6 +141,7 @@
     "//base",
     "//chromecast/base",
     "//chromecast/media/base",
+    "//chromecast/media/cma/backend/post_processors:post_processor_wrapper",
     "//chromecast/media/cma/base",
     "//chromecast/media/cma/decoder",
     "//chromecast/public/media",
@@ -153,19 +154,13 @@
   testonly = true
   sources = [
     "filter_group_unittest.cc",
-    "post_processors/governor_unittest.cc",
-    "post_processors/saturated_gain_unittest.cc",
   ]
 
   deps = [
     ":audio",
-    ":governor",
-    ":libcast_governor_1.0",
-    ":libcast_saturated_gain_1.0",
-    ":saturated_gain",
     "//base",
     "//base/test:run_all_unittests",
-    "//chromecast/media/cma/backend/post_processors:test_support",
+    "//chromecast/media/cma/backend/post_processors:unittests",
     "//chromecast/public",
     "//chromecast/public/media",
     "//media:shared_memory_support",
@@ -180,59 +175,3 @@
     deps += [ "fuchsia:unit_tests" ]
   }
 }
-
-# This is separate from ":governor" because the associated unittest needs
-# to create a Governor directly (to use test functions).
-cast_shared_library("libcast_governor_1.0") {
-  sources = [
-    "post_processors/governor_create.cc",
-  ]
-  deps = [
-    ":governor",
-    "//chromecast/public/media",
-  ]
-  if (is_fuchsia) {
-    ldflags = [ "-Wl,-Bsymbolic" ]
-  }
-}
-
-cast_source_set("governor") {
-  sources = [
-    "post_processors/governor.cc",
-    "post_processors/governor.h",
-  ]
-  deps = [
-    "//base",
-    "//chromecast/base",
-    "//chromecast/media/base",
-    "//chromecast/public/media",
-  ]
-  public_configs = [ "//chromecast/public:public_config" ]
-}
-
-cast_shared_library("libcast_saturated_gain_1.0") {
-  sources = [
-    "post_processors/saturated_gain_create.cc",
-  ]
-  deps = [
-    ":saturated_gain",
-    "//chromecast/public/media",
-  ]
-  if (is_fuchsia) {
-    ldflags = [ "-Wl,-Bsymbolic" ]
-  }
-}
-
-cast_source_set("saturated_gain") {
-  sources = [
-    "post_processors/saturated_gain.cc",
-    "post_processors/saturated_gain.h",
-  ]
-  deps = [
-    "//base",
-    "//chromecast/base",
-    "//chromecast/media/base",
-    "//chromecast/public/media",
-  ]
-  public_configs = [ "//chromecast/public:public_config" ]
-}
diff --git a/chromecast/media/cma/backend/alsa/stream_mixer_unittest.cc b/chromecast/media/cma/backend/alsa/stream_mixer_unittest.cc
index 38d21dd6..bae591b 100644
--- a/chromecast/media/cma/backend/alsa/stream_mixer_unittest.cc
+++ b/chromecast/media/cma/backend/alsa/stream_mixer_unittest.cc
@@ -267,9 +267,13 @@
   MockPostProcessor(const std::string& name,
                     const base::ListValue* filter_description_list,
                     int channels)
-      : name_(name) {
+      : name_(name), num_output_channels_(channels) {
     CHECK(instances_.insert({name_, this}).second);
 
+    ON_CALL(*this, ProcessFrames(_, _, _, _))
+        .WillByDefault(
+            testing::Invoke(this, &MockPostProcessor::DoProcessFrames));
+
     if (!filter_description_list) {
       // This happens for PostProcessingPipeline with no post-processors.
       return;
@@ -291,11 +295,10 @@
         CHECK(processor_config_dict->GetInteger("delay", &module_delay));
         rendering_delay_ += module_delay;
         processor_config_dict->GetBoolean("ringing", &ringing_);
+        processor_config_dict->GetInteger("output_channels",
+                                          &num_output_channels_);
       }
     }
-    ON_CALL(*this, ProcessFrames(_, _, _, _))
-        .WillByDefault(
-            testing::Invoke(this, &MockPostProcessor::DoProcessFrames));
   }
   ~MockPostProcessor() override { instances_.erase(name_); }
   MOCK_METHOD4(
@@ -306,6 +309,8 @@
   bool IsRinging() override { return ringing_; }
   int delay() { return rendering_delay_; }
   std::string name() const { return name_; }
+  float* GetOutputBuffer() override { return output_buffer_; }
+  int NumOutputChannels() override { return num_output_channels_; }
 
   MOCK_METHOD2(SetPostProcessorConfig,
                void(const std::string& name, const std::string& config));
@@ -318,7 +323,8 @@
   int DoProcessFrames(float* data,
                       int num_frames,
                       float current_volume,
-                      bool is_sience) {
+                      bool is_silence) {
+    output_buffer_ = data;
     return rendering_delay_;
   }
 
@@ -326,6 +332,8 @@
   std::string name_;
   int rendering_delay_ = 0;
   bool ringing_ = false;
+  float* output_buffer_ = nullptr;
+  int num_output_channels_;
 
   DISALLOW_COPY_AND_ASSIGN(MockPostProcessor);
 };
@@ -474,6 +482,8 @@
   DISALLOW_COPY_AND_ASSIGN(StreamMixerTest);
 };
 
+using StreamMixerDeathTest = StreamMixerTest;
+
 TEST_F(StreamMixerTest, AddSingleInput) {
   auto* input = new testing::StrictMock<MockInputQueue>(kTestSamplesPerSecond);
   StreamMixer* mixer = StreamMixer::Get();
@@ -1035,9 +1045,11 @@
                                           false);
   EXPECT_POSTPROCESSOR_CALL_PROCESSFRAMES(post_processors, "linearize", 1,
                                           kNumFrames, false);
-  EXPECT_POSTPROCESSOR_CALL_PROCESSFRAMES(post_processors, "communications", 0,
+
+  // These will be called once to ensure their buffers are initialized.
+  EXPECT_POSTPROCESSOR_CALL_PROCESSFRAMES(post_processors, "communications", 1,
                                           _, _);
-  EXPECT_POSTPROCESSOR_CALL_PROCESSFRAMES(post_processors, "assistant-tts", 0,
+  EXPECT_POSTPROCESSOR_CALL_PROCESSFRAMES(post_processors, "assistant-tts", 1,
                                           _, _);
 
   StreamMixer* mixer = StreamMixer::Get();
@@ -1174,10 +1186,10 @@
       std::make_unique<MockPostProcessorFactory>(), "{}");
 
   auto* instances = MockPostProcessor::instances();
-  CHECK(instances->find("default") != instances->end());
+  CHECK(instances->find("default") == instances->end());
   CHECK(instances->find("mix") != instances->end());
   CHECK(instances->find("linearize") != instances->end());
-  CHECK_EQ(MockPostProcessor::instances()->size(), 3u);
+  CHECK_EQ(MockPostProcessor::instances()->size(), 2u);
 }
 
 TEST_F(StreamMixerTest, InvalidStreamTypeCrashes) {
@@ -1341,5 +1353,25 @@
   mixer->SetPostProcessorConfig(name, config);
 }
 
+TEST_F(StreamMixerDeathTest, CrashesIfChannelCountDoesNotMatchFlags) {
+  StreamMixer* mixer = StreamMixer::Get();
+  const std::string config = R"Json({
+"postprocessors": {
+  "output_streams": [{
+    "streams": [ "default" ],
+    "processors": [{
+      "processor": "delay.so",
+      "config": { "output_channels": 4,
+                  "delay": 0 }
+    }]
+  }]
+}})Json";
+
+  ASSERT_DEATH(mixer->ResetPostProcessorsForTest(
+                   std::make_unique<MockPostProcessorFactory>(), config),
+               "PostProcessor configuration channel count does not match "
+               "command line flag");
+}
+
 }  // namespace media
 }  // namespace chromecast
diff --git a/chromecast/media/cma/backend/filter_group.cc b/chromecast/media/cma/backend/filter_group.cc
index e725576..31611663 100644
--- a/chromecast/media/cma/backend/filter_group.cc
+++ b/chromecast/media/cma/backend/filter_group.cc
@@ -62,17 +62,17 @@
   active_inputs_.push_back(input);
 }
 
-float FilterGroup::MixAndFilter(int chunk_size) {
+float FilterGroup::MixAndFilter(int num_frames) {
   DCHECK_NE(output_samples_per_second_, 0);
 
-  ResizeBuffersIfNecessary(chunk_size);
+  bool resize_needed = ResizeBuffersIfNecessary(num_frames);
 
   float volume = 0.0f;
   AudioContentType content_type = static_cast<AudioContentType>(-1);
 
   // Recursively mix inputs.
   for (auto* filter_group : mixed_inputs_) {
-    volume = std::max(volume, filter_group->MixAndFilter(chunk_size));
+    volume = std::max(volume, filter_group->MixAndFilter(num_frames));
     content_type = std::max(content_type, filter_group->content_type());
   }
 
@@ -83,12 +83,17 @@
   // b) The output volume is 0 and has NEVER been non-zero,
   //    since FilterGroup will use last_volume_ if volume is 0.
   //    In this case, there was never any data in the pipeline.
+  // However, we still need to ensure that output buffers are initialized &
+  // large enough to hold |num_frames|, so we cannot use this shortcut if
+  // |resize_needed|.
   if (active_inputs_.empty() && volume == 0.0f &&
-      !post_processing_pipeline_->IsRinging()) {
-    if (frames_zeroed_ < chunk_size) {
-      // Ensure interleaved_ is zeros.
-      std::fill_n(interleaved(), chunk_size * num_channels_, 0);
-      frames_zeroed_ = chunk_size;
+      !post_processing_pipeline_->IsRinging() && !resize_needed) {
+    if (frames_zeroed_ < num_frames) {
+      // Ensure OutputBuffer() is zeros.
+      // TODO(bshaya): Determine if this is necessary - if RingingTime is
+      //               calculated correctly, then we could skip the fill_n.
+      std::fill_n(GetOutputBuffer(), num_frames * GetOutputChannelCount(), 0);
+      frames_zeroed_ = num_frames;
     }
     return 0.0f;  // Output will be silence, no need to mix.
   }
@@ -96,25 +101,26 @@
   frames_zeroed_ = 0;
 
   // Mix InputQueues
-  mixed_->ZeroFramesPartial(0, chunk_size);
+  mixed_->ZeroFramesPartial(0, num_frames);
   for (StreamMixer::InputQueue* input : active_inputs_) {
-    input->GetResampledData(temp_.get(), chunk_size);
+    input->GetResampledData(temp_.get(), num_frames);
     for (int c = 0; c < num_channels_; ++c) {
-      input->VolumeScaleAccumulate(c != 0, temp_->channel(c), chunk_size,
+      input->VolumeScaleAccumulate(c != 0, temp_->channel(c), num_frames,
                                    mixed_->channel(c));
     }
     volume = std::max(volume, input->InstantaneousVolume());
     content_type = std::max(content_type, input->content_type());
   }
 
-  mixed_->ToInterleaved<::media::FloatSampleTypeTraits<float>>(chunk_size,
-                                                               interleaved());
+  mixed_->ToInterleaved<::media::FloatSampleTypeTraits<float>>(
+      num_frames, interleaved_.get());
 
   // Mix FilterGroups
   for (FilterGroup* group : mixed_inputs_) {
     if (group->last_volume() > 0.0f) {
-      ::media::vector_math::FMAC(group->interleaved(), 1.0f,
-                                 chunk_size * num_channels_, interleaved());
+      ::media::vector_math::FMAC(group->interleaved_.get(), 1.0f,
+                                 num_frames * num_channels_,
+                                 interleaved_.get());
     }
   }
 
@@ -124,10 +130,10 @@
     DCHECK_GE(playout_channel_, 0);
     DCHECK_LT(playout_channel_, num_channels_);
 
-    for (int frame = 0; frame < chunk_size; ++frame) {
-      float s = interleaved()[frame * num_channels_ + playout_channel_];
+    for (int frame = 0; frame < num_frames; ++frame) {
+      float s = interleaved_.get()[frame * num_channels_ + playout_channel_];
       for (int c = 0; c < num_channels_; ++c)
-        interleaved()[frame * num_channels_ + c] = s;
+        interleaved_.get()[frame * num_channels_ + c] = s;
     }
   }
 
@@ -146,22 +152,26 @@
   }
 
   delay_frames_ = post_processing_pipeline_->ProcessFrames(
-      interleaved(), chunk_size, last_volume_, is_silence);
+      interleaved_.get(), num_frames, last_volume_, is_silence);
 
   // Mono mixing if needed. Only used in the "Mix" instance.
   if (mix_to_mono_ && type_ == GroupType::kFinalMix) {
-    for (int frame = 0; frame < chunk_size; ++frame) {
+    for (int frame = 0; frame < num_frames; ++frame) {
       float sum = 0;
       for (int c = 0; c < num_channels_; ++c)
-        sum += interleaved()[frame * num_channels_ + c];
+        sum += interleaved_.get()[frame * num_channels_ + c];
       for (int c = 0; c < num_channels_; ++c)
-        interleaved()[frame * num_channels_ + c] = sum / num_channels_;
+        interleaved_.get()[frame * num_channels_ + c] = sum / num_channels_;
     }
   }
 
   return last_volume_;
 }
 
+float* FilterGroup::GetOutputBuffer() {
+  return post_processing_pipeline_->GetOutputBuffer();
+}
+
 int64_t FilterGroup::GetRenderingDelayMicroseconds() {
   return delay_frames_ * base::Time::kMicrosecondsPerSecond /
          output_samples_per_second_;
@@ -171,18 +181,20 @@
   active_inputs_.clear();
 }
 
-int FilterGroup::GetOutputChannelCount() const {
-  return num_channels_;
+int FilterGroup::GetOutputChannelCount() {
+  return post_processing_pipeline_->NumOutputChannels();
 }
 
-void FilterGroup::ResizeBuffersIfNecessary(int chunk_size) {
-  if (!mixed_ || mixed_->frames() < chunk_size) {
-    mixed_ = ::media::AudioBus::Create(num_channels_, chunk_size);
-    temp_ = ::media::AudioBus::Create(num_channels_, chunk_size);
-    interleaved_.reset(static_cast<float*>(
-        base::AlignedAlloc(chunk_size * num_channels_ * sizeof(float),
-                           ::media::AudioBus::kChannelAlignment)));
+bool FilterGroup::ResizeBuffersIfNecessary(int num_frames) {
+  if (mixed_ && mixed_->frames() >= num_frames) {
+    return false;
   }
+  mixed_ = ::media::AudioBus::Create(num_channels_, num_frames);
+  temp_ = ::media::AudioBus::Create(num_channels_, num_frames);
+  interleaved_.reset(static_cast<float*>(
+      base::AlignedAlloc(num_frames * num_channels_ * sizeof(float),
+                         ::media::AudioBus::kChannelAlignment)));
+  return true;
 }
 
 void FilterGroup::SetPostProcessorConfig(const std::string& name,
diff --git a/chromecast/media/cma/backend/filter_group.h b/chromecast/media/cma/backend/filter_group.h
index c6caed2cf..09a0e93 100644
--- a/chromecast/media/cma/backend/filter_group.h
+++ b/chromecast/media/cma/backend/filter_group.h
@@ -78,7 +78,7 @@
   // Returns the largest volume of all streams with data.
   //         return value will be zero IFF there is no data and
   //         the PostProcessingPipeline is not ringing.
-  float MixAndFilter(int chunk_size);
+  float MixAndFilter(int num_frames);
 
   // Gets the current delay of this filter group's AudioPostProcessors.
   // (Not recursive).
@@ -88,8 +88,10 @@
   // on each mixing iteration.
   void ClearActiveInputs();
 
-  // Retrieves a pointer to the output buffer.
-  float* interleaved() { return interleaved_.get(); }
+  // Retrieves a pointer to the output buffer. This will crash if called before
+  // MixAndFilter(), and the data & memory location may change each time
+  // MixAndFilter() is called.
+  float* GetOutputBuffer();
 
   // Get the last used volume.
   float last_volume() const { return last_volume_; }
@@ -97,7 +99,7 @@
   std::string name() const { return name_; }
 
   // Returns number of audio output channels from the filter group.
-  int GetOutputChannelCount() const;
+  int GetOutputChannelCount();
 
   // Sends configuration string |config| to all post processors with the given
   // |name|.
@@ -114,7 +116,9 @@
   AudioContentType content_type() const { return content_type_; }
 
  private:
-  void ResizeBuffersIfNecessary(int chunk_size);
+  // Resizes temp_ and mixed_ if they are too small to hold |num_frames| frames.
+  // Returns |true| if |num_frames| is larger than all previous |num_frames|.
+  bool ResizeBuffersIfNecessary(int num_frames);
 
   const int num_channels_;
   const GroupType type_;
diff --git a/chromecast/media/cma/backend/filter_group_unittest.cc b/chromecast/media/cma/backend/filter_group_unittest.cc
index 09706c77..1089f63 100644
--- a/chromecast/media/cma/backend/filter_group_unittest.cc
+++ b/chromecast/media/cma/backend/filter_group_unittest.cc
@@ -37,7 +37,16 @@
 
 class MockPostProcessingPipeline : public PostProcessingPipeline {
  public:
-  MockPostProcessingPipeline() {}
+  MockPostProcessingPipeline()
+      : MockPostProcessingPipeline(kNumInputChannels) {}
+
+  MockPostProcessingPipeline(int num_output_channels)
+      : num_output_channels_(num_output_channels) {
+    ON_CALL(*this, ProcessFrames(_, _, _, _))
+        .WillByDefault(
+            testing::Invoke(this, &MockPostProcessingPipeline::StorePtr));
+  }
+
   ~MockPostProcessingPipeline() override {}
   MOCK_METHOD4(
       ProcessFrames,
@@ -47,11 +56,25 @@
   MOCK_METHOD1(SetContentType, void(AudioContentType));
   MOCK_METHOD1(UpdatePlayoutChannel, void(int));
 
+ protected:
+  float* output_buffer_;
+
  private:
   bool SetSampleRate(int sample_rate) override { return true; }
   bool IsRinging() override { return false; }
+  float* GetOutputBuffer() override { return output_buffer_; }
+  int NumOutputChannels() override { return num_output_channels_; }
   int delay() { return 0; }
   std::string name() const { return "mock"; }
+  int StorePtr(float* data,
+               int num_frames,
+               float current_volume,
+               bool is_silence) {
+    output_buffer_ = data;
+    return 0;
+  }
+
+  const int num_output_channels_;
 
   DISALLOW_COPY_AND_ASSIGN(MockPostProcessingPipeline);
 };
@@ -79,6 +102,7 @@
                       int num_frames,
                       float current_volume,
                       bool is_silence) {
+    output_buffer_ = data;
     for (int fr = 0; fr < num_frames; ++fr) {
       for (int ch = 0; ch < channels_; ++ch) {
         if (ch == channel_to_invert_) {
@@ -228,7 +252,7 @@
 
   void AssertPassthrough() {
     // Verify if the fiter group output matches the source.
-    float* interleaved_data = filter_group_->interleaved();
+    float* interleaved_data = filter_group_->GetOutputBuffer();
     for (int f = 0; f < kInputFrames; ++f) {
       for (int ch = 0; ch < kNumInputChannels; ++ch) {
         ASSERT_EQ(Input(ch, f), interleaved_data[f * kNumInputChannels + ch]);
@@ -287,7 +311,7 @@
   filter_group_->MixAndFilter(kInputFrames);
 
   // Verify if the fiter group output matches the source after down mixing.
-  float* interleaved_data = filter_group_->interleaved();
+  float* interleaved_data = filter_group_->GetOutputBuffer();
   for (int i = 0; i < kInputFrames; ++i) {
     ASSERT_EQ((LeftInput(i) + RightInput(i)) / 2, interleaved_data[i * 2]);
     ASSERT_EQ(interleaved_data[i * 2], interleaved_data[i * 2 + 1]);
@@ -302,7 +326,7 @@
 
   // Verify both output channels = (-1 * ch0 + ch1) / 2 after mixing.
   // If order of mixing, filtering is incorrect, the channels won't match.
-  float* interleaved_data = filter_group_->interleaved();
+  float* interleaved_data = filter_group_->GetOutputBuffer();
   for (int i = 0; i < kInputFrames; ++i) {
     ASSERT_EQ((-LeftInput(i) + RightInput(i)) / 2, interleaved_data[i * 2]);
     ASSERT_EQ(interleaved_data[i * 2], interleaved_data[i * 2 + 1]);
@@ -347,7 +371,7 @@
   filter_group_->UpdatePlayoutChannel(0);
   filter_group_->MixAndFilter(kInputFrames);
 
-  float* interleaved_data = filter_group_->interleaved();
+  float* interleaved_data = filter_group_->GetOutputBuffer();
   for (int f = 0; f < kInputFrames; ++f) {
     for (int ch = 0; ch < kNumInputChannels; ++ch) {
       // Both output channels should be equal to left channel.
@@ -388,7 +412,7 @@
   filter_group_->UpdatePlayoutChannel(0);
   filter_group_->MixAndFilter(kInputFrames);
 
-  float* interleaved_data = filter_group_->interleaved();
+  float* interleaved_data = filter_group_->GetOutputBuffer();
   for (int f = 0; f < kInputFrames; ++f) {
     // channel 0 out = channel 0 in * -1
     // channel 1 out = channel 0 in
@@ -433,5 +457,14 @@
   filter_group_->MixAndFilter(kInputFrames);
 }
 
+TEST_F(FilterGroupTest, ReportsOutputChannels) {
+  const int num_output_channels = 4;
+  MakeFilterGroup(
+      FilterGroup::GroupType::kStream, false,
+      std::make_unique<MockPostProcessingPipeline>(num_output_channels));
+
+  EXPECT_EQ(num_output_channels, filter_group_->GetOutputChannelCount());
+}
+
 }  // namespace media
 }  // namespace chromecast
diff --git a/chromecast/media/cma/backend/post_processing_pipeline.h b/chromecast/media/cma/backend/post_processing_pipeline.h
index bb54e6d..c1063fd1 100644
--- a/chromecast/media/cma/backend/post_processing_pipeline.h
+++ b/chromecast/media/cma/backend/post_processing_pipeline.h
@@ -24,6 +24,9 @@
                             int num_frames,
                             float current_multiplier,
                             bool is_silence) = 0;
+  virtual float* GetOutputBuffer() = 0;
+  virtual int NumOutputChannels() = 0;
+
   virtual bool SetSampleRate(int sample_rate) = 0;
   virtual bool IsRinging() = 0;
   virtual void SetPostProcessorConfig(const std::string& name,
diff --git a/chromecast/media/cma/backend/post_processing_pipeline_impl.cc b/chromecast/media/cma/backend/post_processing_pipeline_impl.cc
index 27c3619..b5f18e7 100644
--- a/chromecast/media/cma/backend/post_processing_pipeline_impl.cc
+++ b/chromecast/media/cma/backend/post_processing_pipeline_impl.cc
@@ -12,7 +12,7 @@
 #include "base/scoped_native_library.h"
 #include "base/values.h"
 #include "chromecast/base/serializers.h"
-#include "chromecast/public/media/audio_post_processor_shlib.h"
+#include "chromecast/public/media/audio_post_processor2_shlib.h"
 #include "chromecast/public/volume_control.h"
 
 namespace chromecast {
@@ -22,6 +22,7 @@
 
 const int kNoSampleRate = -1;
 const char kProcessorKey[] = "processor";
+const char kTypeKey[] = "type";
 const char kNameKey[] = "name";
 }  // namespace
 
@@ -43,7 +44,7 @@
     const std::string& name,
     const base::ListValue* filter_description_list,
     int channels)
-    : name_(name), sample_rate_(kNoSampleRate) {
+    : name_(name), sample_rate_(kNoSampleRate), num_output_channels_(channels) {
   if (!filter_description_list) {
     return;  // Warning logged.
   }
@@ -67,6 +68,11 @@
       continue;
     }
 
+    std::string post_processor_name;
+
+    // TODO(bshaya): CHECK this when support for AudioPostProcessor is removed.
+    processor_description_dict->GetString(kTypeKey, &post_processor_name);
+
     const base::Value* processor_config_val;
     CHECK(processor_description_dict->Get("config", &processor_config_val));
     CHECK(processor_config_val->is_dict() || processor_config_val->is_string());
@@ -76,11 +82,16 @@
     LOG(INFO) << "Creating an instance of " << library_path << "("
               << *processor_config_string << ")";
 
-    processors_.emplace_back(
-        PostProcessorInfo{factory_.CreatePostProcessor(
-                              library_path, *processor_config_string, channels),
-                          processor_name});
+    // TODO(bshaya): parse v2 plugin names.
+    std::string plugin_name = "";
+
+    processors_.emplace_back(PostProcessorInfo{
+        factory_.CreatePostProcessor(library_path, plugin_name,
+                                     *processor_config_string, channels),
+        processor_name});
+    channels = processors_.back().ptr->NumOutputChannels();
   }
+  num_output_channels_ = channels;
 }
 
 PostProcessingPipelineImpl::~PostProcessingPipelineImpl() = default;
@@ -90,6 +101,10 @@
                                               float current_multiplier,
                                               bool is_silence) {
   DCHECK_NE(sample_rate_, kNoSampleRate);
+  DCHECK(data);
+
+  output_buffer_ = data;
+
   if (is_silence) {
     if (!IsRinging()) {
       return total_delay_frames_;  // Output will be silence.
@@ -104,11 +119,22 @@
   total_delay_frames_ = 0;
   for (auto& processor : processors_) {
     total_delay_frames_ += processor.ptr->ProcessFrames(
-        data, num_frames, cast_volume_, current_dbfs_);
+        output_buffer_, num_frames, cast_volume_, current_dbfs_);
+    output_buffer_ = processor.ptr->GetOutputBuffer();
   }
   return total_delay_frames_;
 }
 
+int PostProcessingPipelineImpl::NumOutputChannels() {
+  return num_output_channels_;
+}
+
+float* PostProcessingPipelineImpl::GetOutputBuffer() {
+  DCHECK(output_buffer_);
+
+  return output_buffer_;
+}
+
 bool PostProcessingPipelineImpl::SetSampleRate(int sample_rate) {
   sample_rate_ = sample_rate;
   bool result = true;
diff --git a/chromecast/media/cma/backend/post_processing_pipeline_impl.h b/chromecast/media/cma/backend/post_processing_pipeline_impl.h
index ea2c7a0..efe143b3 100644
--- a/chromecast/media/cma/backend/post_processing_pipeline_impl.h
+++ b/chromecast/media/cma/backend/post_processing_pipeline_impl.h
@@ -21,7 +21,7 @@
 namespace chromecast {
 namespace media {
 
-class AudioPostProcessor;
+class AudioPostProcessor2;
 
 // Creates and contains multiple AudioPostProcessors, as specified in ctor.
 // Provides convenience methods to access and use the AudioPostProcessors.
@@ -37,6 +37,9 @@
                     float current_volume,
                     bool is_silence) override;
 
+  float* GetOutputBuffer() override;
+  int NumOutputChannels() override;
+
   bool SetSampleRate(int sample_rate) override;
   bool IsRinging() override;
 
@@ -50,7 +53,7 @@
   // Note: typedef is used to silence chromium-style mandatory constructor in
   // structs.
   typedef struct {
-    std::unique_ptr<AudioPostProcessor> ptr;
+    std::unique_ptr<AudioPostProcessor2> ptr;
     std::string name;
   } PostProcessorInfo;
 
@@ -65,6 +68,8 @@
   float current_multiplier_;
   float cast_volume_;
   float current_dbfs_;
+  int num_output_channels_ = 0;
+  float* output_buffer_ = nullptr;
 
   // factory_ keeps shared libraries open, so it must outlive processors_.
   PostProcessorFactory factory_;
diff --git a/chromecast/media/cma/backend/post_processor_factory.cc b/chromecast/media/cma/backend/post_processor_factory.cc
index d63bbdd7..af93c28b 100644
--- a/chromecast/media/cma/backend/post_processor_factory.cc
+++ b/chromecast/media/cma/backend/post_processor_factory.cc
@@ -7,6 +7,9 @@
 #include "base/files/file_path.h"
 #include "base/memory/ptr_util.h"
 #include "base/scoped_native_library.h"
+#include "base/strings/stringprintf.h"
+#include "chromecast/media/cma/backend/post_processors/post_processor_wrapper.h"
+#include "chromecast/public/media/audio_post_processor2_shlib.h"
 #include "chromecast/public/media/audio_post_processor_shlib.h"
 
 namespace chromecast {
@@ -14,30 +17,54 @@
 
 namespace {
 
-const char kSoCreateFunction[] = "AudioPostProcessorShlib_Create";
+const char kV1SoCreateFunction[] = "AudioPostProcessorShlib_Create";
+const char kV2SoCreateFunctionFormat[] = "AudioPostProcessorShlib2_%s_Create";
 
 }  // namespace
 
+using CreatePostProcessor2Function =
+    AudioPostProcessor2* (*)(const std::string&, int);
+
 using CreatePostProcessorFunction = AudioPostProcessor* (*)(const std::string&,
                                                             int);
 
 PostProcessorFactory::PostProcessorFactory() = default;
 PostProcessorFactory::~PostProcessorFactory() = default;
 
-std::unique_ptr<AudioPostProcessor> PostProcessorFactory::CreatePostProcessor(
+std::unique_ptr<AudioPostProcessor2> PostProcessorFactory::CreatePostProcessor(
     const std::string& library_path,
+    const std::string& plugin_name,
     const std::string& config,
     int channels) {
-  libraries_.push_back(base::MakeUnique<base::ScopedNativeLibrary>(
+  libraries_.push_back(std::make_unique<base::ScopedNativeLibrary>(
       base::FilePath(library_path)));
   CHECK(libraries_.back()->is_valid())
       << "Could not open post processing library " << library_path;
-  auto create = reinterpret_cast<CreatePostProcessorFunction>(
-      libraries_.back()->GetFunctionPointer(kSoCreateFunction));
 
-  CHECK(create) << "Could not find " << kSoCreateFunction << "() in "
-                << library_path;
-  return base::WrapUnique(create(config, channels));
+  if (!plugin_name.empty()) {
+    std::string create_function =
+        base::StringPrintf(kV2SoCreateFunctionFormat, plugin_name.c_str());
+    auto v2_create = reinterpret_cast<CreatePostProcessor2Function>(
+        libraries_.back()->GetFunctionPointer(create_function.c_str()));
+
+    DCHECK(v2_create) << "Could not find " << create_function << "() in "
+                      << library_path;
+
+    return base::WrapUnique(v2_create(config, channels));
+  }
+
+  auto v1_create = reinterpret_cast<CreatePostProcessorFunction>(
+      libraries_.back()->GetFunctionPointer(kV1SoCreateFunction));
+
+  DCHECK(v1_create) << "Could not find " << kV1SoCreateFunction << "() in "
+                    << library_path;
+
+  LOG(WARNING) << "[Deprecated]: AudioPostProcessor will be deprecated soon."
+               << " Please update " << library_path
+               << " to AudioPostProcessor2.";
+
+  return base::MakeUnique<AudioPostProcessorWrapper>(
+      base::WrapUnique(v1_create(config, channels)), channels);
 }
 
 }  // namespace media
diff --git a/chromecast/media/cma/backend/post_processor_factory.h b/chromecast/media/cma/backend/post_processor_factory.h
index e60a3bfc..281e94f 100644
--- a/chromecast/media/cma/backend/post_processor_factory.h
+++ b/chromecast/media/cma/backend/post_processor_factory.h
@@ -18,15 +18,17 @@
 namespace chromecast {
 namespace media {
 
-class AudioPostProcessor;
+class AudioPostProcessor2;
 
 class PostProcessorFactory {
  public:
   PostProcessorFactory();
   ~PostProcessorFactory();
 
-  std::unique_ptr<AudioPostProcessor> CreatePostProcessor(
+  // Creates an instance of AudioPostProcessor2 or a wrapped AudioPostProcessor.
+  std::unique_ptr<AudioPostProcessor2> CreatePostProcessor(
       const std::string& so_name,
+      const std::string& plugin_name,
       const std::string& config,
       int channels);
 
diff --git a/chromecast/media/cma/backend/post_processors/BUILD.gn b/chromecast/media/cma/backend/post_processors/BUILD.gn
index 9da8a17..be7aeb89 100644
--- a/chromecast/media/cma/backend/post_processors/BUILD.gn
+++ b/chromecast/media/cma/backend/post_processors/BUILD.gn
@@ -4,6 +4,74 @@
 
 import("//chromecast/chromecast.gni")
 
+cast_source_set("post_processor_wrapper") {
+  sources = [
+    "post_processor_wrapper.cc",
+    "post_processor_wrapper.h",
+  ]
+  deps = [
+    "//base",
+    "//chromecast/public",
+    "//chromecast/public/media",
+  ]
+}
+
+# This is separate from ":governor" because the associated unittest needs
+# to create a Governor directly (to use test functions).
+cast_shared_library("libcast_governor_1.0") {
+  sources = [
+    "governor_create.cc",
+  ]
+  deps = [
+    ":governor",
+    "//chromecast/public/media",
+  ]
+  if (is_fuchsia) {
+    ldflags = [ "-Wl,-Bsymbolic" ]
+  }
+}
+
+cast_source_set("governor") {
+  sources = [
+    "governor.cc",
+    "governor.h",
+  ]
+  deps = [
+    "//base",
+    "//chromecast/base",
+    "//chromecast/media/base",
+    "//chromecast/public/media",
+  ]
+  public_configs = [ "//chromecast/public:public_config" ]
+}
+
+cast_shared_library("libcast_saturated_gain_1.0") {
+  sources = [
+    "saturated_gain_create.cc",
+  ]
+  deps = [
+    ":saturated_gain",
+    "//chromecast/public/media",
+  ]
+  if (is_fuchsia) {
+    ldflags = [ "-Wl,-Bsymbolic" ]
+  }
+}
+
+cast_source_set("saturated_gain") {
+  sources = [
+    "saturated_gain.cc",
+    "saturated_gain.h",
+  ]
+  deps = [
+    "//base",
+    "//chromecast/base",
+    "//chromecast/media/base",
+    "//chromecast/public/media",
+  ]
+  public_configs = [ "//chromecast/public:public_config" ]
+}
+
 cast_source_set("test_support") {
   testonly = true
   sources = [
@@ -18,3 +86,20 @@
     "//testing/gtest",
   ]
 }
+
+cast_source_set("unittests") {
+  testonly = true
+  sources = [
+    "governor_unittest.cc",
+    "saturated_gain_unittest.cc",
+  ]
+  deps = [
+    ":governor",
+    ":saturated_gain",
+    ":test_support",
+    "//base",
+    "//chromecast/public",
+    "//chromecast/public/media",
+    "//testing/gtest:gtest",
+  ]
+}
diff --git a/chromecast/media/cma/backend/post_processors/governor_unittest.cc b/chromecast/media/cma/backend/post_processors/governor_unittest.cc
index dc8520b..f1661cf7 100644
--- a/chromecast/media/cma/backend/post_processors/governor_unittest.cc
+++ b/chromecast/media/cma/backend/post_processors/governor_unittest.cc
@@ -5,13 +5,13 @@
 #include <cmath>
 #include <cstdint>
 #include <limits>
+#include <memory>
 #include <string>
 #include <vector>
 
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
 #include "base/strings/stringprintf.h"
-#include "chromecast/media/cma/backend/post_processor_factory.h"
 #include "chromecast/media/cma/backend/post_processors/governor.h"
 #include "chromecast/media/cma/backend/post_processors/post_processor_benchmark.h"
 #include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h"
@@ -26,7 +26,6 @@
 const char* kConfigTemplate =
     R"config({"onset_volume": %f, "clamp_multiplier": %f})config";
 
-const char kLibraryPath[] = "libcast_governor_1.0.so";
 const float kDefaultClamp = 0.6f;
 const int kNumFrames = 100;
 const int kFrequency = 2000;
@@ -114,29 +113,25 @@
 // Default tests from post_processor_test
 TEST_P(PostProcessorTest, GovernorDelay) {
   std::string config = MakeConfigString(1.0, 1.0);
-  PostProcessorFactory factory;
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<Governor>(config, kNumChannels);
   TestDelay(pp.get(), sample_rate_);
 }
 
 TEST_P(PostProcessorTest, GovernorRinging) {
   std::string config = MakeConfigString(1.0, 1.0);
-  PostProcessorFactory factory;
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<Governor>(config, kNumChannels);
   TestRingingTime(pp.get(), sample_rate_);
 }
 
 TEST_P(PostProcessorTest, GovernorPassthrough) {
   std::string config = MakeConfigString(1.0, 1.0);
-  PostProcessorFactory factory;
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<Governor>(config, kNumChannels);
   TestPassthrough(pp.get(), sample_rate_);
 }
 
 TEST_P(PostProcessorTest, GovernorBenchmark) {
   std::string config = MakeConfigString(1.0, 1.0);
-  PostProcessorFactory factory;
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<Governor>(config, kNumChannels);
   AudioProcessorBenchmark(pp.get(), sample_rate_);
 }
 
@@ -151,4 +146,4 @@
 ----------------------------------------------------
 GovernorBenchmark   44100          0.0013%
 GovernorBenchmark   48000          0.0015%
-*/
\ No newline at end of file
+*/
diff --git a/chromecast/media/cma/backend/post_processors/post_processor_wrapper.cc b/chromecast/media/cma/backend/post_processors/post_processor_wrapper.cc
new file mode 100644
index 0000000..8b42cf26
--- /dev/null
+++ b/chromecast/media/cma/backend/post_processors/post_processor_wrapper.cc
@@ -0,0 +1,56 @@
+// 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 "chromecast/media/cma/backend/post_processors/post_processor_wrapper.h"
+
+#include "chromecast/public/media/audio_post_processor_shlib.h"
+
+namespace chromecast {
+namespace media {
+
+AudioPostProcessorWrapper::AudioPostProcessorWrapper(
+    std::unique_ptr<AudioPostProcessor> pp,
+    int channels)
+    : pp_(std::move(pp)), channels_(channels) {}
+
+AudioPostProcessorWrapper::~AudioPostProcessorWrapper() = default;
+
+bool AudioPostProcessorWrapper::SetSampleRate(int sample_rate) {
+  return pp_->SetSampleRate(sample_rate);
+}
+
+int AudioPostProcessorWrapper::ProcessFrames(float* data,
+                                             int frames,
+                                             float system_volume,
+                                             float volume_dbfs) {
+  output_buffer_ = data;
+  return pp_->ProcessFrames(data, frames, system_volume, volume_dbfs);
+}
+
+float* AudioPostProcessorWrapper::GetOutputBuffer() {
+  return output_buffer_;
+}
+
+int AudioPostProcessorWrapper::GetRingingTimeInFrames() {
+  return pp_->GetRingingTimeInFrames();
+}
+
+void AudioPostProcessorWrapper::UpdateParameters(const std::string& message) {
+  pp_->UpdateParameters(message);
+}
+
+void AudioPostProcessorWrapper::SetContentType(AudioContentType content_type) {
+  pp_->SetContentType(content_type);
+}
+
+void AudioPostProcessorWrapper::SetPlayoutChannel(int channel) {
+  pp_->SetPlayoutChannel(channel);
+}
+
+int AudioPostProcessorWrapper::NumOutputChannels() {
+  return channels_;
+}
+
+}  // namespace media
+}  // namespace chromecast
diff --git a/chromecast/media/cma/backend/post_processors/post_processor_wrapper.h b/chromecast/media/cma/backend/post_processors/post_processor_wrapper.h
new file mode 100644
index 0000000..034b0a6
--- /dev/null
+++ b/chromecast/media/cma/backend/post_processors/post_processor_wrapper.h
@@ -0,0 +1,55 @@
+// 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 CHROMECAST_MEDIA_CMA_BACKEND_POST_PROCESSORS_POST_PROCESSOR_WRAPPER_H_
+#define CHROMECAST_MEDIA_CMA_BACKEND_POST_PROCESSORS_POST_PROCESSOR_WRAPPER_H_
+
+// Provides a wrapper for AudioPostProcessor to allow using it as an
+// AudioPostProcessor2. This works by simply fowarding the input buffer as the
+// output buffer, since the original AudioPostProcessor API has equal numbers of
+// input and output channels.
+
+#include <memory>
+#include <string>
+
+#include "base/macros.h"
+#include "chromecast/public/media/audio_post_processor2_shlib.h"
+
+namespace chromecast {
+namespace media {
+
+class AudioPostProcessor;
+
+class AudioPostProcessorWrapper : public AudioPostProcessor2 {
+ public:
+  // AudioPostProcessorWrapper owns |pp|.
+  AudioPostProcessorWrapper(std::unique_ptr<AudioPostProcessor> pp,
+                            int channels);
+  ~AudioPostProcessorWrapper() override;
+
+ private:
+  // AudioPostProcessor2 implementation:
+  bool SetSampleRate(int sample_rate) override;
+  int ProcessFrames(float* data,
+                    int frames,
+                    float system_volume,
+                    float volume_dbfs) override;
+  float* GetOutputBuffer() override;
+  int GetRingingTimeInFrames() override;
+  void UpdateParameters(const std::string& message) override;
+  void SetContentType(AudioContentType content_type) override;
+  void SetPlayoutChannel(int channel) override;
+  int NumOutputChannels() override;
+
+  std::unique_ptr<AudioPostProcessor> pp_;
+  int channels_;
+  float* output_buffer_;
+
+  DISALLOW_COPY_AND_ASSIGN(AudioPostProcessorWrapper);
+};
+
+}  // namespace media
+}  // namespace chromecast
+
+#endif  // CHROMECAST_MEDIA_CMA_BACKEND_POST_PROCESSORS_POST_PROCESSOR_WRAPPER_H_
diff --git a/chromecast/media/cma/backend/post_processors/saturated_gain_unittest.cc b/chromecast/media/cma/backend/post_processors/saturated_gain_unittest.cc
index 84534da..f8c7808 100644
--- a/chromecast/media/cma/backend/post_processors/saturated_gain_unittest.cc
+++ b/chromecast/media/cma/backend/post_processors/saturated_gain_unittest.cc
@@ -6,9 +6,9 @@
 #include <vector>
 
 #include "base/strings/stringprintf.h"
-#include "chromecast/media/cma/backend/post_processor_factory.h"
 #include "chromecast/media/cma/backend/post_processors/post_processor_benchmark.h"
 #include "chromecast/media/cma/backend/post_processors/post_processor_unittest.h"
+#include "chromecast/media/cma/backend/post_processors/saturated_gain.h"
 
 namespace chromecast {
 namespace media {
@@ -19,8 +19,6 @@
 const char kConfigTemplate[] =
     R"config({"gain_db": %f})config";
 
-const char kLibraryPath[] = "libcast_saturated_gain_1.0.so";
-
 std::string MakeConfigString(float gain_db) {
   return base::StringPrintf(kConfigTemplate, gain_db);
 }
@@ -29,33 +27,29 @@
 
 // Default tests from post_processor_test
 TEST_P(PostProcessorTest, SaturatedGainDelay) {
-  PostProcessorFactory factory;
   std::string config = MakeConfigString(0.0);
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<SaturatedGain>(config, kNumChannels);
   TestDelay(pp.get(), sample_rate_);
 }
 
 TEST_P(PostProcessorTest, SaturatedGainRinging) {
-  PostProcessorFactory factory;
   std::string config = MakeConfigString(0.0);
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<SaturatedGain>(config, kNumChannels);
   TestRingingTime(pp.get(), sample_rate_);
 }
 
 // Also tests clipping (by attempting to set gain way too high).
 TEST_P(PostProcessorTest, SaturatedGainPassthrough) {
-  PostProcessorFactory factory;
   std::string config = MakeConfigString(100.0);
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<SaturatedGain>(config, kNumChannels);
   TestPassthrough(pp.get(), sample_rate_);
 }
 
 TEST_P(PostProcessorTest, Gain) {
   const int kNumFrames = 256;
   const int kNumChannels = 2;
-  PostProcessorFactory factory;
   std::string config = MakeConfigString(20.0);  // Exactly 10x multiplier.
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<SaturatedGain>(config, kNumChannels);
   std::vector<float> data = GetSineData(256, 1000, sample_rate_);
   for (size_t i = 0; i < data.size(); ++i) {
     data[i] /= 100.0;
@@ -68,9 +62,8 @@
 }
 
 TEST_P(PostProcessorTest, SaturatedGainBenchmark) {
-  PostProcessorFactory factory;
   std::string config = MakeConfigString(20.0);
-  auto pp = factory.CreatePostProcessor(kLibraryPath, config, kNumChannels);
+  auto pp = std::make_unique<SaturatedGain>(config, kNumChannels);
   AudioProcessorBenchmark(pp.get(), sample_rate_);
 }
 
@@ -85,4 +78,4 @@
 ----------------------------------------------------
 SaturatedGainBenchmark   44100          0.0014%
 SaturatedGainBenchmark   48000          0.0016%
-*/
\ No newline at end of file
+*/
diff --git a/chromecast/media/cma/backend/stream_mixer.cc b/chromecast/media/cma/backend/stream_mixer.cc
index 377f1b91..32c2140 100644
--- a/chromecast/media/cma/backend/stream_mixer.cc
+++ b/chromecast/media/cma/backend/stream_mixer.cc
@@ -80,6 +80,7 @@
 
 std::unique_ptr<FilterGroup> CreateFilterGroup(
     FilterGroup::GroupType type,
+    int input_channels,
     bool mix_to_mono,
     const std::string& name,
     const base::ListValue* filter_list,
@@ -88,9 +89,9 @@
     std::unique_ptr<PostProcessingPipelineFactory>& ppp_factory) {
   DCHECK(ppp_factory);
   auto pipeline =
-      ppp_factory->CreatePipeline(name, filter_list, kNumInputChannels);
-  return std::make_unique<FilterGroup>(kNumInputChannels, type, mix_to_mono,
-                                       name, std::move(pipeline), device_ids,
+      ppp_factory->CreatePipeline(name, filter_list, input_channels);
+  return std::make_unique<FilterGroup>(input_channels, type, mix_to_mono, name,
+                                       std::move(pipeline), device_ids,
                                        mixed_inputs);
 }
 
@@ -148,8 +149,6 @@
 
   num_output_channels_ = GetSwitchValueNonNegativeInt(
       switches::kAudioOutputChannels, kNumInputChannels);
-  DCHECK(num_output_channels_ == kNumInputChannels ||
-         num_output_channels_ == 1);
 
   low_sample_rate_cutoff_ =
       GetSwitchValueBoolean(switches::kAlsaEnableUpsampling, false)
@@ -203,8 +202,9 @@
           << kCastAudioJsonFilePath << ".";
     }
     filter_groups_.push_back(CreateFilterGroup(
-        FilterGroup::GroupType::kStream, false /* mono_mixer */,
-        *device_ids.begin() /* name */, stream_pipeline.pipeline, device_ids,
+        FilterGroup::GroupType::kStream, kNumInputChannels,
+        false /* mono_mixer */, *device_ids.begin() /* name */,
+        stream_pipeline.pipeline, device_ids,
         std::vector<FilterGroup*>() /* mixed_inputs */,
         post_processing_pipeline_factory_));
     if (device_ids.find(::media::AudioDeviceDescription::kDefaultDeviceId) !=
@@ -213,41 +213,53 @@
     }
   }
 
-  // Always provide a default filter; OEM may only specify mix filter.
-  if (!default_filter_) {
+  bool enabled_mono_mixer = (num_output_channels_ == 1);
+  if (!filter_groups_.empty()) {
+    std::vector<FilterGroup*> filter_group_ptrs(filter_groups_.size());
+    int mix_group_input_channels = filter_groups_[0]->GetOutputChannelCount();
+    for (size_t i = 0; i < filter_groups_.size(); ++i) {
+      DCHECK_EQ(mix_group_input_channels,
+                filter_groups_[i]->GetOutputChannelCount())
+          << "All output stream mixers must have the same number of channels";
+      filter_group_ptrs[i] = filter_groups_[i].get();
+    }
+
+    // Enable Mono mixer in |mix_filter_| if necessary.
+    filter_groups_.push_back(CreateFilterGroup(
+        FilterGroup::GroupType::kFinalMix, mix_group_input_channels,
+        enabled_mono_mixer, "mix", pipeline_parser->GetMixPipeline(),
+        std::unordered_set<std::string>() /* device_ids */, filter_group_ptrs,
+        post_processing_pipeline_factory_));
+  } else {
+    // Mix group directly mixes all inputs.
     std::string kDefaultDeviceId =
         ::media::AudioDeviceDescription::kDefaultDeviceId;
     filter_groups_.push_back(CreateFilterGroup(
-        FilterGroup::GroupType::kStream, false /* mono_mixer */,
-        kDefaultDeviceId /* name */, nullptr,
+        FilterGroup::GroupType::kFinalMix, kNumInputChannels,
+        enabled_mono_mixer, "mix", pipeline_parser->GetMixPipeline(),
         std::unordered_set<std::string>({kDefaultDeviceId}),
         std::vector<FilterGroup*>() /* mixed_inputs */,
         post_processing_pipeline_factory_));
     default_filter_ = filter_groups_.back().get();
   }
 
-  std::vector<FilterGroup*> filter_group_ptrs(filter_groups_.size());
-  std::transform(
-      filter_groups_.begin(), filter_groups_.end(), filter_group_ptrs.begin(),
-      [](const std::unique_ptr<FilterGroup>& group) { return group.get(); });
-
-  // Enable Mono mixer in |mix_filter_| if necessary.
-  bool enabled_mono_mixer = (num_output_channels_ == 1);
-  filter_groups_.push_back(
-      CreateFilterGroup(FilterGroup::GroupType::kFinalMix, enabled_mono_mixer,
-                        "mix", pipeline_parser->GetMixPipeline(),
-                        std::unordered_set<std::string>() /* device_ids */,
-                        filter_group_ptrs, post_processing_pipeline_factory_));
-
   mix_filter_ = filter_groups_.back().get();
 
   filter_groups_.push_back(CreateFilterGroup(
-      FilterGroup::GroupType::kLinearize, false /* mono_mixer */, "linearize",
+      FilterGroup::GroupType::kLinearize, mix_filter_->GetOutputChannelCount(),
+      false /* mono_mixer */, "linearize",
       pipeline_parser->GetLinearizePipeline(),
       std::unordered_set<std::string>() /* device_ids */,
       std::vector<FilterGroup*>({mix_filter_}),
       post_processing_pipeline_factory_));
   linearize_filter_ = filter_groups_.back().get();
+
+  // StreamMixer can downmix N channels to 1 channel.
+  CHECK(num_output_channels_ == 1 ||
+        num_output_channels_ == linearize_filter_->GetOutputChannelCount())
+      << "PostProcessor configuration channel count does not match command line"
+      << " flag: " << linearize_filter_->GetOutputChannelCount() << " vs "
+      << num_output_channels_;
 }
 
 void StreamMixer::ResetTaskRunnerForTest() {
@@ -553,7 +565,7 @@
     return false;
   }
 
-  int chunk_size =
+  int num_frames =
       (output_samples_per_second_ * kMaxAudioWriteTimeMilliseconds / 1000) &
       ~(filter_frame_alignment_ - 1);
   for (auto&& filter_group : filter_groups_) {
@@ -565,7 +577,7 @@
     if (read_size > 0) {
       DCHECK(input->filter_group());
       input->filter_group()->AddActiveInput(input.get());
-      chunk_size = std::min(chunk_size, read_size);
+      num_frames = std::min(num_frames, read_size);
       is_silence = false;
     } else if (input->primary()) {
       base::TimeDelta time_until_underrun;
@@ -592,14 +604,14 @@
 
   if (is_silence) {
     // No inputs have any data to provide. Push silence to prevent underrun.
-    chunk_size = std::max(kPreventUnderrunChunkSize, filter_frame_alignment_);
+    num_frames = std::max(kPreventUnderrunChunkSize, filter_frame_alignment_);
   }
 
-  DCHECK_EQ(chunk_size % filter_frame_alignment_, 0);
+  DCHECK_EQ(num_frames % filter_frame_alignment_, 0);
   // Recursively mix and filter each group.
-  linearize_filter_->MixAndFilter(chunk_size);
+  linearize_filter_->MixAndFilter(num_frames);
 
-  WriteMixedPcm(chunk_size);
+  WriteMixedPcm(num_frames);
   return true;
 }
 
@@ -620,49 +632,47 @@
   // Downmix reference signal to mono to reduce CPU load.
   int mix_channel_count = mix_filter_->GetOutputChannelCount();
 
+  float* mixed_data = mix_filter_->GetOutputBuffer();
   if (num_output_channels_ == 1 && mix_channel_count != num_output_channels_) {
     for (int i = 0; i < frames; ++i) {
       float sum = 0;
       for (int c = 0; c < mix_channel_count; ++c) {
-        sum += mix_filter_->interleaved()[i * mix_channel_count + c];
+        sum += mixed_data[i * mix_channel_count + c];
       }
-      mix_filter_->interleaved()[i] = sum / mix_channel_count;
+      mixed_data[i] = sum / mix_channel_count;
     }
   }
 
   // Hard limit to [1.0, -1.0]
   for (int i = 0; i < frames * num_output_channels_; ++i) {
-    mix_filter_->interleaved()[i] =
-        std::min(1.0f, std::max(-1.0f, mix_filter_->interleaved()[i]));
+    mixed_data[i] = std::min(1.0f, std::max(-1.0f, mixed_data[i]));
   }
 
   for (CastMediaShlib::LoopbackAudioObserver* observer : loopback_observers_) {
     observer->OnLoopbackAudio(
         expected_playback_time, kSampleFormatF32, output_samples_per_second_,
-        num_output_channels_,
-        reinterpret_cast<uint8_t*>(mix_filter_->interleaved()),
+        num_output_channels_, reinterpret_cast<uint8_t*>(mixed_data),
         static_cast<size_t>(frames) * num_output_channels_ * sizeof(float));
   }
 
   // Drop extra channels from linearize filter if necessary.
+  float* linearized_data = linearize_filter_->GetOutputBuffer();
   int linearize_channel_count = linearize_filter_->GetOutputChannelCount();
   if (num_output_channels_ == 1 &&
       linearize_channel_count != num_output_channels_) {
     for (int i = 0; i < frames; ++i) {
-      linearize_filter_->interleaved()[i] =
-          linearize_filter_->interleaved()[i * linearize_channel_count];
+      linearized_data[i] = linearized_data[i * linearize_channel_count];
     }
   }
 
   // Hard limit to [1.0, -1.0].
   for (int i = 0; i < frames * num_output_channels_; ++i) {
-    linearize_filter_->interleaved()[i] =
-        std::min(1.0f, std::max(-1.0f, linearize_filter_->interleaved()[i]));
+    linearized_data[i] = std::min(1.0f, std::max(-1.0f, linearized_data[i]));
   }
 
   bool playback_interrupted = false;
-  output_->Write(linearize_filter_->interleaved(),
-                 frames * num_output_channels_, &playback_interrupted);
+  output_->Write(linearized_data, frames * num_output_channels_,
+                 &playback_interrupted);
 
   if (playback_interrupted) {
     for (auto* observer : loopback_observers_) {
diff --git a/chromecast/media/cma/backend/stream_mixer.h b/chromecast/media/cma/backend/stream_mixer.h
index 517ddaf..583e212 100644
--- a/chromecast/media/cma/backend/stream_mixer.h
+++ b/chromecast/media/cma/backend/stream_mixer.h
@@ -264,7 +264,7 @@
   bool TryWriteFrames();
   void WriteMixedPcm(int frames);
   void UpdateRenderingDelay(int newly_pushed_frames);
-  void ResizeBuffersIfNecessary(int chunk_size);
+  void ResizeBuffersIfNecessary(int num_frames);
 
   // Sets active channel in multichannel group.
   void UpdatePlayoutChannel();
diff --git a/chromecast/public/media/BUILD.gn b/chromecast/public/media/BUILD.gn
index 6e461bd..0e67c1f7 100644
--- a/chromecast/public/media/BUILD.gn
+++ b/chromecast/public/media/BUILD.gn
@@ -6,6 +6,7 @@
 
 cast_source_set("media") {
   sources = [
+    "audio_post_processor2_shlib.h",
     "audio_post_processor_shlib.h",
     "cast_decoder_buffer.h",
     "cast_decrypt_config.h",
diff --git a/chromecast/public/media/audio_post_processor2_shlib.h b/chromecast/public/media/audio_post_processor2_shlib.h
new file mode 100644
index 0000000..7e13e58
--- /dev/null
+++ b/chromecast/public/media/audio_post_processor2_shlib.h
@@ -0,0 +1,130 @@
+// 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 CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR2_SHLIB_H_
+#define CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR2_SHLIB_H_
+
+#include <string>
+#include <vector>
+
+#include "chromecast_export.h"
+#include "volume_control.h"
+
+// Plugin interface for audio DSP modules.
+// This is applicable only to audio CMA backends (Alsa, Fuscia).
+//
+// Please refer to
+// chromecast/media/cma/backend/post_processors/governor_shlib.cc
+// as an example for new code, but OEM's implementations should not have any
+// Chromium dependencies.
+//
+// Please refer to
+// chromecast/media/cma/backend/post_processors/post_processor_wrapper.h for an
+// example of how to port an existing AudioPostProcessor to AudioPostProcessor2
+//
+// Notes on PostProcessors that have a different number of in/out channels:
+//  * PostProcessor authors are free to define their channel order; Cast will
+//    simply pass this data to subsequent PostProcessors and MixerOutputStream.
+//  * Channel selection for stereo pairs will occur after the "mix" group, so
+//    devices that support stereo pairs should only change the number of
+//    in the "linearize" group of cast_audio.json.
+
+// Creates a PostProcessor
+// Called from StreamMixer when shared objects are listed in
+// /etc/cast_audio.json
+// AudioPostProcessors are created on startup and destroyed on shutdown.
+// libcast_FOOBAR_1.0.so should export a CREATE function as follows:
+// AUDIO_POST_PROCESSOR2_SHLIB_CREATE_FUNC(FOOBAR) { }
+#define AUDIO_POST_PROCESSOR2_SHLIB_CREATE_FUNC(type)                  \
+  extern "C" CHROMECAST_EXPORT chromecast::media::AudioPostProcessor2* \
+      AudioPostProcessor2##type##Create(const std::string& config,     \
+                                        int channels_in)
+
+namespace chromecast {
+namespace media {
+
+// Interface for AudioPostProcessors used for applying DSP in StreamMixer.
+class AudioPostProcessor2 {
+ public:
+  // The maximum amount of data that will ever be processed in one call.
+  static constexpr int kMaxAudioWriteTimeMilliseconds = 20;
+
+  virtual ~AudioPostProcessor2() = default;
+
+  // Updates the sample rate of the processor.
+  // Returns |false| if the processor cannot support |sample_rate|
+  // Returning false will result in crashing cast_shell.
+  virtual bool SetSampleRate(int sample_rate) = 0;
+
+  // Returns the number of output channels. This value should never change after
+  // construction.
+  virtual int NumOutputChannels() = 0;
+
+  // Processes audio frames from |data|.
+  // This will never be called before SetSampleRate().
+  // Output buffer should be made available via GetOutputBuffer().
+  // ProcessFrames may overwrite |data|, in which case GetOutputBuffer() should
+  // return |data|.
+  // |data| will be 32-bit interleaved float with |channels_in| channels.
+  // If |channels_out| is larger than |channels_in|, AudioPostProcessor2 must
+  // own a buffer of length at least |channels_out| * frames;
+  // |data| cannot be assumed to be larger than |channels_in| * frames.
+  // |frames| is the number of audio frames in data and is
+  // always non-zero and less than or equal to |kMaxAudioWriteTimeMilliseconds|.
+  // AudioPostProcessor must always provide |frames| frames of data back
+  // (may output 0’s).
+  // |system_volume| is the Cast Volume applied to the stream
+  // (normalized to 0-1). It is the same as the cast volume set via alsa.
+  // |volume_dbfs| is the actual attenuation in dBFS (-inf to 0), equivalent to
+  // VolumeMap::VolumeToDbFS(|volume|).
+  // AudioPostProcessor should assume that volume has already been applied.
+  // Returns the current rendering delay of the filter in frames.
+  virtual int ProcessFrames(float* data,
+                            int frames,
+                            float system_volume,
+                            float volume_dbfs) = 0;
+
+  // Returns the data buffer in which the last output from ProcessFrames() was
+  // stored.
+  // This will never be called before ProcessFrames().
+  // This data location should be valid until ProcessFrames() is called
+  // again.
+  // The data returned by GetOutputBuffer() should not be modified by this
+  // instance until the next call to ProcessFrames().
+  // If |channels_in| >= |channels_out|, this may return |data| from the
+  // last call to ProcessFrames().
+  // If |channels_in| < |channels_out|, this PostProcessor is responsible for
+  // allocating an output buffer.
+  // If this PostProcessor owns the outputbuffer, it must ensure that the memory
+  // is valid until the next call to ProcessFrames() or destruction.
+  virtual float* GetOutputBuffer() = 0;
+
+  // Returns the number of frames of silence it will take for the processor to
+  // come to rest after playing out audio.
+  // In the case of an FIR filter, this is the length of the FIR kernel.
+  // In the case of IIR filters, this should be calculated as the number of
+  // frames for the output to decay to 10% (5 time constants).
+  // When inputs are paused, at least |GetRingingTimeInFrames()| of
+  // silence will be passed through the processor. This will only be checked
+  // when SetSampleRate() is called.
+  virtual int GetRingingTimeInFrames() = 0;
+
+  // Sends a message to the PostProcessor. Implementations are responsible
+  // for the format and parsing of messages.
+  virtual void UpdateParameters(const std::string& message) {}
+
+  // Sets content type to the PostProcessor so it could change processing
+  // settings accordingly.
+  virtual void SetContentType(AudioContentType content_type) {}
+
+  // Called when device is playing as part of a stereo pair.
+  // |channel| is the playout channel on this device (0 for left, 1 for right).
+  // or -1 if the device is not part of a stereo pair.
+  virtual void SetPlayoutChannel(int channel) {}
+};
+
+}  // namespace media
+}  // namespace chromecast
+
+#endif  // CHROMECAST_PUBLIC_MEDIA_AUDIO_POST_PROCESSOR2_SHLIB_H_
diff --git a/chromeos/dbus/services/component_updater_service_provider.cc b/chromeos/dbus/services/component_updater_service_provider.cc
index de8a0f84..db455c3 100644
--- a/chromeos/dbus/services/component_updater_service_provider.cc
+++ b/chromeos/dbus/services/component_updater_service_provider.cc
@@ -58,9 +58,12 @@
     dbus::ExportedObject::ResponseSender response_sender) {
   dbus::MessageReader reader(method_call);
   std::string component_name;
+  // |mount| is an optional parameter, and by default is true.
+  bool mount = true;
   if (reader.PopString(&component_name)) {
+    reader.PopBool(&mount);
     delegate_->LoadComponent(
-        component_name,
+        component_name, mount,
         base::Bind(&ComponentUpdaterServiceProvider::OnLoadComponent,
                    weak_ptr_factory_.GetWeakPtr(), method_call,
                    response_sender));
@@ -68,7 +71,7 @@
     std::unique_ptr<dbus::ErrorResponse> error_response =
         dbus::ErrorResponse::FromMethodCall(
             method_call, kErrorInvalidArgs,
-            "Missing component name string argument.");
+            "Need a string and a boolean parameter.");
     response_sender.Run(std::move(error_response));
   }
 }
@@ -77,18 +80,11 @@
     dbus::MethodCall* method_call,
     dbus::ExportedObject::ResponseSender response_sender,
     const base::FilePath& result) {
-  if (!result.empty()) {
-    std::unique_ptr<dbus::Response> response =
-        dbus::Response::FromMethodCall(method_call);
-    dbus::MessageWriter writer(response.get());
-    writer.AppendString(result.value());
-    response_sender.Run(std::move(response));
-  } else {
-    std::unique_ptr<dbus::ErrorResponse> error_response =
-        dbus::ErrorResponse::FromMethodCall(method_call, kErrorInternalError,
-                                            "Failed to load component");
-    response_sender.Run(std::move(error_response));
-  }
+  std::unique_ptr<dbus::Response> response =
+      dbus::Response::FromMethodCall(method_call);
+  dbus::MessageWriter writer(response.get());
+  writer.AppendString(result.value());
+  response_sender.Run(std::move(response));
 }
 
 void ComponentUpdaterServiceProvider::UnloadComponent(
diff --git a/chromeos/dbus/services/component_updater_service_provider.h b/chromeos/dbus/services/component_updater_service_provider.h
index 7d82953..f4294ed 100644
--- a/chromeos/dbus/services/component_updater_service_provider.h
+++ b/chromeos/dbus/services/component_updater_service_provider.h
@@ -30,7 +30,7 @@
 //     --dest=org.chromium.ComponentUpdaterService
 //     /org/chromium/ComponentUpdaterService
 //     org.chromium.ComponentUpdaterService.LoadComponent
-//     "string:|component name|"
+//     "string:|component name|" "boolean:|mount|"
 //
 // % string "/run/imageloader/|component name|/|version|"
 //
@@ -49,12 +49,14 @@
   // ComponentUpdaterServiceProvider.
   class Delegate {
    public:
+    using LoadCallback = base::OnceCallback<void(const base::FilePath&)>;
+
     Delegate() {}
     virtual ~Delegate() {}
 
-    virtual void LoadComponent(
-        const std::string& name,
-        base::OnceCallback<void(const base::FilePath&)> load_callback) = 0;
+    virtual void LoadComponent(const std::string& name,
+                               bool mount,
+                               LoadCallback load_callback) = 0;
 
     virtual bool UnloadComponent(const std::string& name) = 0;
 
diff --git a/components/assist_ranker/predictor_config_definitions.cc b/components/assist_ranker/predictor_config_definitions.cc
index 978685d8..771593c 100644
--- a/components/assist_ranker/predictor_config_definitions.cc
+++ b/components/assist_ranker/predictor_config_definitions.cc
@@ -28,7 +28,7 @@
   return kContextualSearchRankerUrl;
 }
 
-// This list needs to be kept in sync with tools/metrics/ukm/ukm.xml.
+// NOTE: This list needs to be kept in sync with tools/metrics/ukm/ukm.xml!
 // Only features within this list will be logged to UKM.
 // TODO(chrome-ranker-team) Deprecate the whitelist once it is available through
 // the UKM generated API.
@@ -44,6 +44,8 @@
                                        "IsSecondTapOverride",
                                        "IsShortWord",
                                        "IsWordEdge",
+                                       "OutcomeRankerDidPredict",
+                                       "OutcomeRankerPrediction",
                                        "OutcomeWasCardsDataShown",
                                        "OutcomeWasPanelOpened",
                                        "OutcomeWasQuickActionClicked",
diff --git a/components/cronet/ios/test/cronet_performance_test.mm b/components/cronet/ios/test/cronet_performance_test.mm
index d75e1fc0..1177116 100644
--- a/components/cronet/ios/test/cronet_performance_test.mm
+++ b/components/cronet/ios/test/cronet_performance_test.mm
@@ -78,7 +78,7 @@
               entry.first.quic, entry.first.http2, entry.first.akd4,
               entry.first.cronet, entry.second.mean,
               entry.second.total ? 8 * entry.second.total_bytes_downloaded /
-                                       entry.second.total / 10e6
+                                       entry.second.total / 1e6
                                  : 0,
               entry.second.max, entry.second.failed_requests,
               entry.second.total_requests];
@@ -172,7 +172,7 @@
 TEST_P(PerfTest, NSURLSessionReceivesImageLoop) {
   int iterations = kTestIterations;
   int failed_iterations = 0;
-  int total_bytes_received = 0;
+  int64_t total_bytes_received = 0;
   NSTimeInterval elapsed_total = 0;
   NSTimeInterval elapsed_max = 0;
 
@@ -209,11 +209,13 @@
       [task cancel];
     }
 
+    success = success && IsResponseSuccessful(task);
+
     NSTimeInterval elapsed = -[start timeIntervalSinceNow];
 
     // Do not tolerate failures on internal server.
     if (!kUseExternalUrl) {
-      CHECK(success && ![delegate_ errorPerTask][task]);
+      CHECK(success);
     }
 
     if (kUseExternalUrl && success && !first_log) {
diff --git a/components/cronet/ios/test/cronet_pkp_test.mm b/components/cronet/ios/test/cronet_pkp_test.mm
index 844e973..4535515 100644
--- a/components/cronet/ios/test/cronet_pkp_test.mm
+++ b/components/cronet/ios/test/cronet_pkp_test.mm
@@ -67,10 +67,10 @@
         [url_session_ dataTaskWithURL:request_url_];
     StartDataTaskAndWaitForCompletion(dataTask);
     if (expected_success) {
-      ASSERT_TRUE(IsResponseSuccessful());
+      ASSERT_TRUE(IsResponseSuccessful(dataTask));
     } else {
-      ASSERT_FALSE(IsResponseSuccessful());
-      ASSERT_FALSE(IsResponseCanceled());
+      ASSERT_FALSE(IsResponseSuccessful(dataTask));
+      ASSERT_FALSE(IsResponseCanceled(dataTask));
     }
   }
 
diff --git a/components/cronet/ios/test/cronet_test_base.h b/components/cronet/ios/test/cronet_test_base.h
index 1942b6e..1d725d81 100644
--- a/components/cronet/ios/test/cronet_test_base.h
+++ b/components/cronet/ios/test/cronet_test_base.h
@@ -53,6 +53,11 @@
 // Contains metrics data.
 @property(readonly) NSURLSessionTaskMetrics* taskMetrics NS_AVAILABLE_IOS(10.0);
 
+// Contains NSHTTPURLResponses for the tasks.
+@property(readonly)
+    NSMutableDictionary<NSURLSessionDataTask*, NSHTTPURLResponse*>*
+        responsePerTask;
+
 // Resets the delegate, so it can be used again for another request.
 - (void)reset;
 
@@ -100,8 +105,8 @@
   void PostBlockToNetworkThread(const base::Location& from_here,
                                 BlockType block);
 
-  ::testing::AssertionResult IsResponseSuccessful();
-  ::testing::AssertionResult IsResponseCanceled();
+  ::testing::AssertionResult IsResponseSuccessful(NSURLSessionDataTask* task);
+  ::testing::AssertionResult IsResponseCanceled(NSURLSessionDataTask* task);
 
   TestDelegate* delegate_;
 
diff --git a/components/cronet/ios/test/cronet_test_base.mm b/components/cronet/ios/test/cronet_test_base.mm
index 77b6e6f0..712567a0 100644
--- a/components/cronet/ios/test/cronet_test_base.mm
+++ b/components/cronet/ios/test/cronet_test_base.mm
@@ -31,6 +31,7 @@
 @synthesize totalBytesReceivedPerTask = _totalBytesReceivedPerTask;
 @synthesize expectedContentLengthPerTask = _expectedContentLengthPerTask;
 @synthesize taskMetrics = _taskMetrics;
+@synthesize responsePerTask = _responsePerTask;
 
 - (id)init {
   if (self = [super init]) {
@@ -45,6 +46,7 @@
   _totalBytesReceivedPerTask = [NSMutableDictionary dictionaryWithCapacity:0];
   _expectedContentLengthPerTask =
       [NSMutableDictionary dictionaryWithCapacity:0];
+  _responsePerTask = [NSMutableDictionary dictionaryWithCapacity:0];
   _taskMetrics = nil;
 }
 
@@ -162,6 +164,7 @@
                            completionHandler {
   _expectedContentLengthPerTask[dataTask] =
       [NSNumber numberWithInt:[response expectedContentLength]];
+  _responsePerTask[dataTask] = static_cast<NSHTTPURLResponse*>(response);
   completionHandler(NSURLSessionResponseAllow);
 }
 
@@ -217,22 +220,35 @@
   return [delegate_ waitForDone:task withTimeout:deadline_ns];
 }
 
-::testing::AssertionResult CronetTestBase::IsResponseSuccessful() {
-  if ([delegate_ error]) {
+::testing::AssertionResult CronetTestBase::IsResponseSuccessful(
+    NSURLSessionDataTask* task) {
+  if ([delegate_ errorPerTask][task]) {
     return ::testing::AssertionFailure() << "error in response: " <<
            [[[delegate_ error] description]
                cStringUsingEncoding:NSUTF8StringEncoding];
   }
+
+  if (![delegate_ responsePerTask][task]) {
+    return ::testing::AssertionFailure() << " no response has been received";
+  }
+
+  NSInteger statusCode = [delegate_ responsePerTask][task].statusCode;
+  if (statusCode < 200 || statusCode > 299) {
+    return ::testing::AssertionFailure()
+           << " the response code was " << statusCode;
+  }
+
   return ::testing::AssertionSuccess() << "no errors in response";
 }
 
-::testing::AssertionResult CronetTestBase::IsResponseCanceled() {
-  if ([delegate_ error] && [[delegate_ error] code] == NSURLErrorCancelled)
+::testing::AssertionResult CronetTestBase::IsResponseCanceled(
+    NSURLSessionDataTask* task) {
+  NSError* error = [delegate_ errorPerTask][task];
+  if (error && [error code] == NSURLErrorCancelled)
     return ::testing::AssertionSuccess() << "the response is canceled";
   return ::testing::AssertionFailure() << "the response is not canceled."
                                        << " The response error is " <<
-         [[[delegate_ error] description]
-             cStringUsingEncoding:NSUTF8StringEncoding];
+         [[error description] cStringUsingEncoding:NSUTF8StringEncoding];
 }
 
 std::unique_ptr<net::MockCertVerifier> CronetTestBase::CreateMockCertVerifier(
diff --git a/components/ntp_snippets/BUILD.gn b/components/ntp_snippets/BUILD.gn
index 6cebb58..6129de9 100644
--- a/components/ntp_snippets/BUILD.gn
+++ b/components/ntp_snippets/BUILD.gn
@@ -250,6 +250,7 @@
     "//components/web_resource:web_resource",
     "//google_apis/gcm",
     "//net:test_support",
+    "//services/identity/public/cpp",
     "//testing/gtest",
     "//third_party/icu/",
     "//ui/gfx:test_support",
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.cc b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.cc
index 1150c058..d33d3f03 100644
--- a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.cc
@@ -15,9 +15,9 @@
 #include "components/ntp_snippets/category.h"
 #include "components/ntp_snippets/ntp_snippets_constants.h"
 #include "components/ntp_snippets/user_classifier.h"
-#include "components/signin/core/browser/signin_manager_base.h"
 #include "net/url_request/url_fetcher.h"
 #include "net/url_request/url_request_status.h"
+#include "services/identity/public/cpp/identity_manager.h"
 #include "services/identity/public/cpp/primary_account_access_token_fetcher.h"
 
 using language::UrlLanguageHistogram;
@@ -124,8 +124,7 @@
 }  // namespace
 
 RemoteSuggestionsFetcherImpl::RemoteSuggestionsFetcherImpl(
-    SigninManagerBase* signin_manager,
-    OAuth2TokenService* token_service,
+    identity::IdentityManager* identity_manager,
     scoped_refptr<URLRequestContextGetter> url_request_context_getter,
     PrefService* pref_service,
     UrlLanguageHistogram* language_histogram,
@@ -133,8 +132,7 @@
     const GURL& api_endpoint,
     const std::string& api_key,
     const UserClassifier* user_classifier)
-    : signin_manager_(signin_manager),
-      token_service_(token_service),
+    : identity_manager_(identity_manager),
       url_request_context_getter_(std::move(url_request_context_getter)),
       language_histogram_(language_histogram),
       parse_json_callback_(parse_json_callback),
@@ -179,7 +177,7 @@
       .SetUrlRequestContextGetter(url_request_context_getter_)
       .SetUserClassifier(*user_classifier_);
 
-  if (signin_manager_->IsAuthenticated()) {
+  if (identity_manager_->HasPrimaryAccount()) {
     // Signed-in: get OAuth token --> fetch suggestions.
     pending_requests_.emplace(std::move(builder), std::move(callback));
     StartTokenRequest();
@@ -211,7 +209,7 @@
     const std::string& oauth_access_token) {
   // TODO(jkrcal, treib): Add unit-tests for authenticated fetches.
   builder.SetUrl(fetch_url_)
-      .SetAuthentication(signin_manager_->GetAuthenticatedAccountId(),
+      .SetAuthentication(identity_manager_->GetPrimaryAccountInfo().account_id,
                          base::StringPrintf(kAuthorizationRequestHeaderFormat,
                                             oauth_access_token.c_str()));
   StartRequest(std::move(builder), std::move(callback));
@@ -234,8 +232,8 @@
   }
 
   OAuth2TokenService::ScopeSet scopes{kContentSuggestionsApiScope};
-  token_fetcher_ = std::make_unique<identity::PrimaryAccountAccessTokenFetcher>(
-      "ntp_snippets", signin_manager_, token_service_, scopes,
+  token_fetcher_ = identity_manager_->CreateAccessTokenFetcherForPrimaryAccount(
+      "ntp_snippets", scopes,
       base::BindOnce(&RemoteSuggestionsFetcherImpl::AccessTokenFetchFinished,
                      base::Unretained(this)),
       identity::PrimaryAccountAccessTokenFetcher::Mode::kWaitUntilAvailable);
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.h b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.h
index 0d95ca46..f5a33841 100644
--- a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.h
+++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl.h
@@ -20,15 +20,14 @@
 #include "components/ntp_snippets/remote/request_params.h"
 #include "net/url_request/url_request_context_getter.h"
 
-class OAuth2TokenService;
 class PrefService;
-class SigninManagerBase;
 
 namespace base {
 class Value;
 }  // namespace base
 
 namespace identity {
+class IdentityManager;
 class PrimaryAccountAccessTokenFetcher;
 }
 
@@ -43,8 +42,7 @@
 class RemoteSuggestionsFetcherImpl : public RemoteSuggestionsFetcher {
  public:
   RemoteSuggestionsFetcherImpl(
-      SigninManagerBase* signin_manager,
-      OAuth2TokenService* token_service,
+      identity::IdentityManager* identity_manager,
       scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
       PrefService* pref_service,
       language::UrlLanguageHistogram* language_histogram,
@@ -90,8 +88,7 @@
                      const std::string& error_details);
 
   // Authentication for signed-in users.
-  SigninManagerBase* signin_manager_;
-  OAuth2TokenService* token_service_;
+  identity::IdentityManager* identity_manager_;
 
   std::unique_ptr<identity::PrimaryAccountAccessTokenFetcher> token_fetcher_;
 
diff --git a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc
index dea3fd7..3df8a732 100644
--- a/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc
+++ b/components/ntp_snippets/remote/remote_suggestions_fetcher_impl_unittest.cc
@@ -10,6 +10,7 @@
 
 #include "base/containers/circular_deque.h"
 #include "base/json/json_reader.h"
+#include "base/message_loop/message_loop.h"
 #include "base/optional.h"
 #include "base/test/histogram_tester.h"
 #include "base/test/test_mock_time_task_runner.h"
@@ -34,6 +35,7 @@
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "net/url_request/test_url_fetcher_factory.h"
 #include "net/url_request/url_request_test_util.h"
+#include "services/identity/public/cpp/identity_manager.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -59,7 +61,7 @@
 const char kTestChromeContentSuggestionsSignedInUrl[] =
     "https://chromecontentsuggestions-pa.googleapis.com/v1/suggestions/fetch";
 
-const char kTestEmail[] = "foo@bar.com";
+const char kTestAccount[] = "foo@bar.com";
 
 // Artificial time delay for JSON parsing.
 const int64_t kTestJsonParsingLatencyMs = 20;
@@ -291,18 +293,25 @@
     scoped_refptr<net::TestURLRequestContextGetter> request_context_getter =
         new net::TestURLRequestContextGetter(mock_task_runner_.get());
 
-    if (fake_token_service_)
+    if (fake_token_service_) {
       fake_token_service_->RemoveDiagnosticsObserver(this);
+      identity_manager_.reset();
+    }
+
     fake_token_service_ = std::make_unique<FakeProfileOAuth2TokenService>(
         std::make_unique<FakeOAuth2TokenServiceDelegate>(
             request_context_getter.get()));
 
     fake_token_service_->AddDiagnosticsObserver(this);
 
+    // TODO(blundell): Convert this test to use IdentityTestEnvironment once
+    // that infrastructure lands in the codebase.
+    identity_manager_ = std::make_unique<identity::IdentityManager>(
+        utils_.fake_signin_manager(), fake_token_service_.get());
+
     fetcher_ = std::make_unique<RemoteSuggestionsFetcherImpl>(
-        utils_.fake_signin_manager(), fake_token_service_.get(),
-        std::move(request_context_getter), utils_.pref_service(), nullptr,
-        base::Bind(&ParseJsonDelayed),
+        identity_manager_.get(), std::move(request_context_getter),
+        utils_.pref_service(), nullptr, base::BindRepeating(&ParseJsonDelayed),
         GetFetchEndpoint(version_info::Channel::STABLE), api_key,
         user_classifier_.get());
 
@@ -311,26 +320,24 @@
   }
 
   void SignIn() {
-#if defined(OS_CHROMEOS)
-    utils_.fake_signin_manager()->SignIn(kTestEmail);
-#else
-    utils_.fake_signin_manager()->SignIn(kTestEmail, "user", "password");
-#endif
+    identity_manager_->SetPrimaryAccountSynchronouslyForTests(kTestAccount,
+                                                              kTestAccount, "");
   }
 
   void IssueRefreshToken() {
-    fake_token_service_->GetDelegate()->UpdateCredentials(kTestEmail, "token");
+    fake_token_service_->GetDelegate()->UpdateCredentials(kTestAccount,
+                                                          "token");
   }
 
   void IssueOAuth2Token() {
-    fake_token_service_->IssueAllTokensForAccount(kTestEmail, "access_token",
+    fake_token_service_->IssueAllTokensForAccount(kTestAccount, "access_token",
                                                   base::Time::Max());
   }
 
   void CancelOAuth2TokenRequests() {
     fake_token_service_->IssueErrorForAllPendingRequestsForAccount(
-        kTestEmail, GoogleServiceAuthError(
-                        GoogleServiceAuthError::State::REQUEST_CANCELED));
+        kTestAccount, GoogleServiceAuthError(
+                          GoogleServiceAuthError::State::REQUEST_CANCELED));
   }
 
   RemoteSuggestionsFetcher::SnippetsAvailableCallback
@@ -408,6 +415,7 @@
   // Initialized lazily in SetFakeResponse().
   std::unique_ptr<net::FakeURLFetcherFactory> fake_url_fetcher_factory_;
   std::unique_ptr<FakeProfileOAuth2TokenService> fake_token_service_;
+  std::unique_ptr<identity::IdentityManager> identity_manager_;
   std::unique_ptr<RemoteSuggestionsFetcherImpl> fetcher_;
   std::unique_ptr<UserClassifier> user_classifier_;
   MockSnippetsAvailableCallback mock_callback_;
diff --git a/components/os_crypt/key_storage_libsecret.cc b/components/os_crypt/key_storage_libsecret.cc
index 37fd8bb3..a1b5b97 100644
--- a/components/os_crypt/key_storage_libsecret.cc
+++ b/components/os_crypt/key_storage_libsecret.cc
@@ -45,7 +45,6 @@
   SecretItem* secret_item = static_cast<SecretItem*>(first->data);
   SecretValue* secret_value =
       LibsecretLoader::secret_item_get_secret(secret_item);
-  g_list_free(secret_items);
   return secret_value;
 }
 
@@ -73,20 +72,18 @@
 }
 
 std::string KeyStorageLibsecret::GetKeyImpl() {
-  GError* error = nullptr;
   LibsecretAttributesBuilder attrs;
   attrs.Append("application", kApplicationName);
-  GList* search_results = LibsecretLoader::secret_service_search_sync(
-      nullptr /* default secret service */, &kKeystoreSchemaV2, attrs.Get(),
-      static_cast<SecretSearchFlags>(SECRET_SEARCH_UNLOCK |
-                                     SECRET_SEARCH_LOAD_SECRETS),
-      nullptr, &error);
-  if (error) {
-    VLOG(1) << "Libsecret lookup failed: " << error->message;
-    g_error_free(error);
+
+  LibsecretLoader::SearchHelper helper;
+  helper.Search(&kKeystoreSchemaV2, attrs.Get(),
+                SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS);
+  if (!helper.success()) {
+    VLOG(1) << "Libsecret lookup failed: " << helper.error()->message;
     return std::string();
   }
-  SecretValue* password_libsecret = ToSingleSecret(search_results);
+
+  SecretValue* password_libsecret = ToSingleSecret(helper.results());
   if (!password_libsecret) {
     std::string password = Migrate();
     if (!password.empty())
@@ -107,21 +104,16 @@
 }
 
 std::string KeyStorageLibsecret::Migrate() {
-  GError* error = nullptr;
   LibsecretAttributesBuilder attrs;
 
   // Detect old entry.
-  GList* search_results = LibsecretLoader::secret_service_search_sync(
-      nullptr /* default secret service */, &kKeystoreSchemaV1, attrs.Get(),
-      static_cast<SecretSearchFlags>(SECRET_SEARCH_UNLOCK |
-                                     SECRET_SEARCH_LOAD_SECRETS),
-      nullptr, &error);
-  if (error) {
-    g_error_free(error);
-    g_list_free(search_results);
+  LibsecretLoader::SearchHelper helper;
+  helper.Search(&kKeystoreSchemaV1, attrs.Get(),
+                SECRET_SEARCH_UNLOCK | SECRET_SEARCH_LOAD_SECRETS);
+  if (!helper.success())
     return std::string();
-  }
-  SecretValue* password_libsecret = ToSingleSecret(search_results);
+
+  SecretValue* password_libsecret = ToSingleSecret(helper.results());
   if (!password_libsecret)
     return std::string();
 
@@ -131,6 +123,7 @@
   LibsecretLoader::secret_value_unref(password_libsecret);
 
   // Create new entry.
+  GError* error = nullptr;
   bool success = LibsecretLoader::secret_password_store_sync(
       &kKeystoreSchemaV2, nullptr, KeyStorageLinux::kKey, password.c_str(),
       nullptr, &error, "application", kApplicationName, nullptr);
diff --git a/components/os_crypt/key_storage_libsecret_unittest.cc b/components/os_crypt/key_storage_libsecret_unittest.cc
index 5d83d08cf..7479f7d 100644
--- a/components/os_crypt/key_storage_libsecret_unittest.cc
+++ b/components/os_crypt/key_storage_libsecret_unittest.cc
@@ -3,7 +3,9 @@
 // found in the LICENSE file.
 
 #include <string>
+#include <unordered_map>
 
+#include "base/lazy_instance.h"
 #include "base/logging.h"
 #include "base/macros.h"
 #include "components/os_crypt/key_storage_libsecret.h"
@@ -12,13 +14,6 @@
 
 namespace {
 
-// Mock functions expect MockSecretValue, where SecretValue appears, and cast it
-// to the mock type. We can reduce SecretValue to an std::string, because we
-// don't use anything else from it.
-using MockSecretValue = std::string;
-// Likewise, we only need a SecretValue from SecretItem.
-using MockSecretItem = MockSecretValue;
-
 const SecretSchema kKeystoreSchemaV1 = {
     "chrome_libsecret_os_crypt_password",
     SECRET_SCHEMA_NONE,
@@ -34,6 +29,80 @@
         {nullptr, SECRET_SCHEMA_ATTRIBUTE_STRING},
     }};
 
+// This test mocks C-functions used by Libsecret. In order to present a
+// consistent world view, we need a single backing instance that contains all
+// the relevant data.
+class MockPasswordStore {
+  // The functions that interact with the password store expect to return
+  // gobjects. These C-style objects are hard to work with. Rather than finagle
+  // with the type system, we always use objects with type G_TYPE_OBJECT. We
+  // then keep a local map from G_TYPE_OBJECT to std::string, and all relevant
+  // translation just look up entries in this map.
+ public:
+  void Reset() {
+    mapping_.clear();
+    ClearV1Password();
+    ClearV2Password();
+    for (GObject* o : objects_returned_to_caller_) {
+      ASSERT_EQ(o->ref_count, 1u);
+      g_object_unref(o);
+    }
+    objects_returned_to_caller_.clear();
+  }
+
+  void ClearV1Password() {
+    if (v1_password_) {
+      ASSERT_EQ(v1_password_->ref_count, 1u);
+      g_object_unref(v1_password_);
+      v1_password_ = nullptr;
+    }
+  }
+  void ClearV2Password() {
+    if (v2_password_) {
+      ASSERT_EQ(v2_password_->ref_count, 1u);
+      g_object_unref(v2_password_);
+      v2_password_ = nullptr;
+    }
+  }
+
+  void SetV1Password(const std::string& password) {
+    ASSERT_FALSE(v1_password_);
+    v1_password_ = static_cast<GObject*>(g_object_new(G_TYPE_OBJECT, nullptr));
+    mapping_[v1_password_] = password;
+  }
+
+  void SetV2Password(const std::string& password) {
+    ASSERT_FALSE(v2_password_);
+    v2_password_ = static_cast<GObject*>(g_object_new(G_TYPE_OBJECT, nullptr));
+    mapping_[v2_password_] = password;
+  }
+
+  GObject* MakeTempObject(const std::string& value) {
+    GObject* temp = static_cast<GObject*>(g_object_new(G_TYPE_OBJECT, nullptr));
+    // The returned object has a ref count of 2. This way, after the client
+    // deletes the object, it isn't destroyed, and we can check that all these
+    // objects have ref count of 1 at the end of the test.
+    g_object_ref(temp);
+    objects_returned_to_caller_.push_back(temp);
+    mapping_[temp] = value;
+    return temp;
+  }
+
+  const gchar* GetString(void* opaque_id) {
+    return mapping_[static_cast<GObject*>(opaque_id)].c_str();
+  }
+
+  GObject* v1_password() { return v1_password_; }
+  GObject* v2_password() { return v2_password_; }
+
+  std::unordered_map<GObject*, std::string> mapping_;
+  std::vector<GObject*> objects_returned_to_caller_;
+  GObject* v1_password_ = nullptr;
+  GObject* v2_password_ = nullptr;
+};
+base::LazyInstance<MockPasswordStore>::Leaky g_password_store =
+    LAZY_INSTANCE_INITIALIZER;
+
 // Replaces some of LibsecretLoader's methods with mocked ones.
 class MockLibsecretLoader : public LibsecretLoader {
  public:
@@ -47,10 +116,6 @@
   // Releases memory and restores LibsecretLoader to an uninitialized state.
   static void TearDown();
 
-  // Set whether there is an old password that needs to be migrated from the
-  // deprecated schema. Null means no such password. See crbug.com/639298
-  static void SetDeprecatedOSCryptPassword(const char* value);
-
  private:
   // These methods are used to redirect calls through LibsecretLoader
   static const gchar* mock_secret_value_get_text(SecretValue* value);
@@ -78,19 +143,11 @@
                                                   ...);
 
   static SecretValue* mock_secret_item_get_secret(SecretItem* item);
-
-  // MockLibsecretLoader owns these objects.
-  static MockSecretValue* stored_password_mock_ptr_;
-  static MockSecretValue* deprecated_password_mock_ptr_;
 };
 
-MockSecretValue* MockLibsecretLoader::stored_password_mock_ptr_ = nullptr;
-MockSecretValue* MockLibsecretLoader::deprecated_password_mock_ptr_ = nullptr;
-
 const gchar* MockLibsecretLoader::mock_secret_value_get_text(
     SecretValue* value) {
-  MockSecretValue* mock_value = reinterpret_cast<MockSecretValue*>(value);
-  return mock_value->c_str();
+  return g_password_store.Pointer()->GetString(value);
 }
 
 // static
@@ -107,13 +164,14 @@
     return true;
 
   EXPECT_STREQ(kKeystoreSchemaV2.name, schema->name);
-  delete stored_password_mock_ptr_;
-  stored_password_mock_ptr_ = new MockSecretValue(password);
+  g_password_store.Pointer()->SetV2Password(password);
   return true;
 }
 
 // static
-void MockLibsecretLoader::mock_secret_value_unref(gpointer value) {}
+void MockLibsecretLoader::mock_secret_value_unref(gpointer value) {
+  g_object_unref(value);
+}
 
 // static
 GList* MockLibsecretLoader::mock_secret_service_search_sync(
@@ -130,11 +188,21 @@
   EXPECT_TRUE(flags & SECRET_SEARCH_UNLOCK);
   EXPECT_TRUE(flags & SECRET_SEARCH_LOAD_SECRETS);
 
-  MockSecretItem* item = nullptr;
-  if (strcmp(schema->name, kKeystoreSchemaV2.name) == 0)
-    item = stored_password_mock_ptr_;
-  else if (strcmp(schema->name, kKeystoreSchemaV1.name) == 0)
-    item = deprecated_password_mock_ptr_;
+  GObject* item = nullptr;
+  MockPasswordStore* store = g_password_store.Pointer();
+  if (strcmp(schema->name, kKeystoreSchemaV2.name) == 0) {
+    GObject* password = store->v2_password();
+    if (password)
+      item = store->MakeTempObject(store->GetString(password));
+  } else if (strcmp(schema->name, kKeystoreSchemaV1.name) == 0) {
+    GObject* password = store->v1_password();
+    if (password)
+      item = store->MakeTempObject(store->GetString(password));
+  }
+
+  if (!item) {
+    return nullptr;
+  }
 
   GList* result = nullptr;
   result = g_list_append(result, item);
@@ -150,17 +218,15 @@
     ...) {
   // We would only delete entries in the deprecated schema.
   EXPECT_STREQ(kKeystoreSchemaV1.name, schema->name);
-  delete deprecated_password_mock_ptr_;
-  deprecated_password_mock_ptr_ = nullptr;
+  g_password_store.Pointer()->ClearV1Password();
   return true;
 }
 
 // static
 SecretValue* MockLibsecretLoader::mock_secret_item_get_secret(
     SecretItem* item) {
-  static_assert(std::is_same<MockSecretValue, MockSecretItem>::value,
-                "mock_secret_item_get_secret() assumes that the only thing we "
-                "need from MockSercetItem is the MockSecretValue");
+  // Add a ref to make sure that the caller unrefs with secret_value_unref.
+  g_object_ref(item);
   return reinterpret_cast<SecretValue*>(item);
 }
 
@@ -178,29 +244,15 @@
   secret_password_clear_sync =
       &MockLibsecretLoader::mock_secret_password_clear_sync;
 
-  delete stored_password_mock_ptr_;
-  stored_password_mock_ptr_ = nullptr;
+  g_password_store.Pointer()->Reset();
   libsecret_loaded_ = true;
 
   return true;
 }
 
 // static
-void MockLibsecretLoader::SetOSCryptPassword(const char* value) {
-  delete stored_password_mock_ptr_;
-  stored_password_mock_ptr_ = new MockSecretValue(value);
-}
-
-// static
-void MockLibsecretLoader::SetDeprecatedOSCryptPassword(const char* value) {
-  delete deprecated_password_mock_ptr_;
-  deprecated_password_mock_ptr_ = new MockSecretValue(value);
-}
-
-// static
 void MockLibsecretLoader::TearDown() {
-  delete stored_password_mock_ptr_;
-  stored_password_mock_ptr_ = nullptr;
+  g_password_store.Pointer()->Reset();
   libsecret_loaded_ =
       false;  // Function pointers will be restored when loading.
 }
@@ -221,6 +273,7 @@
 TEST_F(LibsecretTest, LibsecretRepeats) {
   KeyStorageLibsecret libsecret;
   MockLibsecretLoader::ResetForOSCrypt();
+  g_password_store.Pointer()->SetV2Password("initial password");
   std::string password = libsecret.GetKey();
   EXPECT_FALSE(password.empty());
   std::string password_repeat = libsecret.GetKey();
@@ -239,7 +292,8 @@
 TEST_F(LibsecretTest, LibsecretMigratesFromSchemaV1ToV2) {
   KeyStorageLibsecret libsecret;
   MockLibsecretLoader::ResetForOSCrypt();
-  MockLibsecretLoader::SetDeprecatedOSCryptPassword("swallow");
+  g_password_store.Pointer()->SetV1Password("swallow");
+  g_password_store.Pointer()->ClearV2Password();
   std::string password = libsecret.GetKey();
   EXPECT_EQ("swallow", password);
 }
diff --git a/components/os_crypt/libsecret_util_linux.cc b/components/os_crypt/libsecret_util_linux.cc
index b14bbb2e..6288334 100644
--- a/components/os_crypt/libsecret_util_linux.cc
+++ b/components/os_crypt/libsecret_util_linux.cc
@@ -63,6 +63,25 @@
     {"secret_value_unref", reinterpret_cast<void**>(&secret_value_unref)},
 };
 
+LibsecretLoader::SearchHelper::SearchHelper() = default;
+LibsecretLoader::SearchHelper::~SearchHelper() {
+  if (error_)
+    g_error_free(error_);
+  if (results_)
+    g_list_free_full(results_, &g_object_unref);
+}
+
+void LibsecretLoader::SearchHelper::Search(const SecretSchema* schema,
+                                           GHashTable* attrs,
+                                           int flags) {
+  DCHECK(!results_);
+  results_ = LibsecretLoader::secret_service_search_sync(
+      nullptr,  // default secret service
+      schema, attrs, static_cast<SecretSearchFlags>(flags),
+      nullptr,  // no cancellable object
+      &error_);
+}
+
 // static
 bool LibsecretLoader::EnsureLibsecretLoaded() {
   return LoadLibsecret() && LibsecretIsAvailable();
@@ -114,20 +133,10 @@
       {{"application", SECRET_SCHEMA_ATTRIBUTE_STRING},
        {nullptr, SECRET_SCHEMA_ATTRIBUTE_STRING}}};
 
-  GError* error = nullptr;
-  GList* found = secret_service_search_sync(
-      nullptr,  // default secret service
-      &kDummySchema, attrs.Get(),
-      static_cast<SecretSearchFlags>(SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK),
-      nullptr,  // no cancellable ojbect
-      &error);
-  bool success = (error == nullptr);
-  if (error)
-    g_error_free(error);
-  if (found)
-    g_list_free(found);
-
-  return success;
+  SearchHelper helper;
+  helper.Search(&kDummySchema, attrs.Get(),
+                SECRET_SEARCH_ALL | SECRET_SEARCH_UNLOCK);
+  return helper.success();
 }
 
 // TODO(crbug.com/660005) This is needed to properly unlock the default keyring.
diff --git a/components/os_crypt/libsecret_util_linux.h b/components/os_crypt/libsecret_util_linux.h
index 96f6b17d..6711340d0 100644
--- a/components/os_crypt/libsecret_util_linux.h
+++ b/components/os_crypt/libsecret_util_linux.h
@@ -24,6 +24,29 @@
   static decltype(&::secret_value_get_text) secret_value_get_text;
   static decltype(&::secret_value_unref) secret_value_unref;
 
+  // Wrapper for secret_service_search_sync that prevents common leaks. See
+  // https://crbug.com/393395.
+  class SearchHelper {
+   public:
+    SearchHelper();
+    ~SearchHelper();
+
+    // Search must be called exactly once for success() and results() to be
+    // populated.
+    void Search(const SecretSchema* schema, GHashTable* attrs, int flags);
+
+    bool success() { return !error_; }
+
+    GList* results() { return results_; }
+    GError* error() { return error_; }
+
+   private:
+    // |results_| and |error_| are C-style objects owned by this instance.
+    GList* results_ = nullptr;
+    GError* error_ = nullptr;
+    DISALLOW_COPY_AND_ASSIGN(SearchHelper);
+  };
+
   // Loads the libsecret library and checks that it responds to queries.
   // Returns false if either step fails.
   // Repeated calls check the responsiveness every time, but do not load the
diff --git a/components/password_manager/content/common/credential_manager_struct_traits.cc b/components/password_manager/content/common/credential_manager_struct_traits.cc
index de1bdac..dceec2a 100644
--- a/components/password_manager/content/common/credential_manager_struct_traits.cc
+++ b/components/password_manager/content/common/credential_manager_struct_traits.cc
@@ -87,7 +87,10 @@
           password_manager::CredentialManagerError::PASSWORDSTOREUNAVAILABLE;
       return true;
     case password_manager::mojom::CredentialManagerError::NOT_ALLOWED:
+    case password_manager::mojom::CredentialManagerError::TIMED_OUT:
     case password_manager::mojom::CredentialManagerError::NOT_SUPPORTED:
+    case password_manager::mojom::CredentialManagerError::INVALID_DOMAIN:
+    case password_manager::mojom::CredentialManagerError::NOT_IMPLEMENTED:
     case password_manager::mojom::CredentialManagerError::UNKNOWN:
       *output = password_manager::CredentialManagerError::UNKNOWN;
       return true;
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc
index 45793e3..18b678f 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -56,12 +56,6 @@
                            base::SPLIT_WANT_ALL);
 }
 
-// Return false iff the strings are neither empty nor equal.
-bool AreStringsEqualOrEmpty(const base::string16& s1,
-                            const base::string16& s2) {
-  return s1.empty() || s2.empty() || s1 == s2;
-}
-
 bool DoesStringContainOnlyDigits(const base::string16& s) {
   for (auto c : s) {
     if (!base::IsAsciiDigit(c))
@@ -612,7 +606,6 @@
     size_t filtered_count) {
   blacklisted_matches_.clear();
   new_blacklisted_.reset();
-  blacklisted_origin_found_ = false;
 
   std::unique_ptr<BrowserSavePasswordProgressLogger> logger;
   if (password_manager_util::IsLoggingActive(client_)) {
@@ -629,15 +622,6 @@
                [this](const PasswordForm* form) { return IsMatch(*form); });
   ScoreMatches(matches);
 
-  auto find_blacklisted_match_it = std::find_if(
-      non_federated.begin(), non_federated.end(),
-      [this](const PasswordForm* form) {
-        return form->blacklisted_by_user &&
-               form->origin.GetOrigin() == observed_form_.origin.GetOrigin();
-      });
-  blacklisted_origin_found_ =
-      (find_blacklisted_match_it != non_federated.end());
-
   // Copy out blacklisted matches.
   blacklisted_matches_.resize(std::count_if(
       non_federated.begin(), non_federated.end(),
@@ -689,7 +673,7 @@
   if (!driver)
     return;
 
-  if (blacklisted_origin_found_)
+  if (IsBlacklisted())
     driver->MatchingBlacklistedFormFound();
 
   driver->AllowPasswordGenerationForForm(observed_form_);
@@ -1271,25 +1255,11 @@
 
 bool PasswordFormManager::IsBlacklistMatch(
     const autofill::PasswordForm& blacklisted_form) const {
-  if (!blacklisted_form.blacklisted_by_user ||
-      blacklisted_form.is_public_suffix_match ||
-      blacklisted_form.scheme != observed_form_.scheme ||
-      blacklisted_form.origin.GetOrigin() !=
-          observed_form_.origin.GetOrigin()) {
-    return false;
-  }
-
-  if (observed_form_.scheme == PasswordForm::SCHEME_HTML) {
-    return (blacklisted_form.origin.path_piece() ==
-            observed_form_.origin.path_piece()) ||
-           (AreStringsEqualOrEmpty(blacklisted_form.submit_element,
-                                   observed_form_.submit_element) &&
-            AreStringsEqualOrEmpty(blacklisted_form.password_element,
-                                   observed_form_.password_element) &&
-            AreStringsEqualOrEmpty(blacklisted_form.username_element,
-                                   observed_form_.username_element));
-  }
-  return true;
+  return blacklisted_form.blacklisted_by_user &&
+         !blacklisted_form.is_public_suffix_match &&
+         blacklisted_form.scheme == observed_form_.scheme &&
+         blacklisted_form.origin.GetOrigin() ==
+             observed_form_.origin.GetOrigin();
 }
 
 const PasswordForm* PasswordFormManager::FindBestMatchForUpdatePassword(
diff --git a/components/password_manager/core/browser/password_form_manager.h b/components/password_manager/core/browser/password_form_manager.h
index f5e7109a..ea76f0b 100644
--- a/components/password_manager/core/browser/password_form_manager.h
+++ b/components/password_manager/core/browser/password_form_manager.h
@@ -601,10 +601,6 @@
   // the value of another field of the observed form.
   bool has_username_edited_vote_ = false;
 
-  // Tracks if a form with same origin as |observed_form_| found in blacklisted
-  // forms.
-  bool blacklisted_origin_found_ = false;
-
   // If Chrome has already autofilled a few times, it is probable that autofill
   // is triggered by programmatic changes in the page. We set a maximum number
   // of times that Chrome will autofill to avoid being stuck in an infinite
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc
index 48a8ca09..b062d64 100644
--- a/components/password_manager/core/browser/password_form_manager_unittest.cc
+++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -993,63 +993,35 @@
 // Test that stored blacklisted forms are correctly evaluated for whether they
 // apply to the observed form.
 TEST_F(PasswordFormManagerTest, TestBlacklistMatching) {
-  observed_form()->origin = GURL("http://accounts.google.com/a/LoginAuth");
-  observed_form()->action = GURL("http://accounts.google.com/a/Login");
-  observed_form()->signon_realm = "http://accounts.google.com";
-  FakeFormFetcher fetcher;
-  fetcher.Fetch();
-  PasswordFormManager form_manager(password_manager(), client(),
-                                   client()->driver(), *observed_form(),
-                                   std::make_unique<MockFormSaver>(), &fetcher);
-  form_manager.Init(nullptr);
-
   // Doesn't apply because it is just a PSL match of the observed form.
   PasswordForm blacklisted_psl = *observed_form();
   blacklisted_psl.signon_realm = "http://m.accounts.google.com";
   blacklisted_psl.is_public_suffix_match = true;
   blacklisted_psl.blacklisted_by_user = true;
 
-  // Doesn't apply because of different origin.
-  PasswordForm blacklisted_not_match = *observed_form();
-  blacklisted_not_match.origin = GURL("http://google.com/a/LoginAuth");
-  blacklisted_not_match.blacklisted_by_user = true;
-
-  // Doesn't apply because of different username element and different page.
-  PasswordForm blacklisted_not_match2 = *observed_form();
-  blacklisted_not_match2.origin = GURL("http://accounts.google.com/a/Login123");
-  blacklisted_not_match2.username_element = ASCIIToUTF16("Element");
-  blacklisted_not_match2.blacklisted_by_user = true;
-
   // Doesn't apply because of different PasswordForm::Scheme.
-  PasswordForm blacklisted_not_match3 = *observed_form();
-  blacklisted_not_match3.scheme = PasswordForm::SCHEME_BASIC;
+  PasswordForm blacklisted_not_match = *observed_form();
+  blacklisted_not_match.scheme = PasswordForm::SCHEME_BASIC;
 
-  // Applies because of same element names, despite different page
+  // Applies despite different element names and path.
   PasswordForm blacklisted_match = *observed_form();
   blacklisted_match.origin = GURL("http://accounts.google.com/a/LoginAuth1234");
+  blacklisted_match.username_element = ASCIIToUTF16("Element1");
+  blacklisted_match.password_element = ASCIIToUTF16("Element2");
+  blacklisted_match.submit_element = ASCIIToUTF16("Element3");
   blacklisted_match.blacklisted_by_user = true;
 
-  // Applies because of same page, despite different element names
-  PasswordForm blacklisted_match2 = *observed_form();
-  blacklisted_match2.origin = GURL("http://accounts.google.com/a/LoginAuth");
-  blacklisted_match2.username_element = ASCIIToUTF16("Element");
-  blacklisted_match2.blacklisted_by_user = true;
-
   std::vector<const PasswordForm*> matches = {&blacklisted_psl,
                                               &blacklisted_not_match,
-                                              &blacklisted_not_match2,
-                                              &blacklisted_not_match3,
                                               &blacklisted_match,
-                                              &blacklisted_match2,
                                               saved_match()};
-  fetcher.SetNonFederated(matches, 0u);
+  fake_form_fetcher()->SetNonFederated(matches, 0u);
 
-  EXPECT_TRUE(form_manager.IsBlacklisted());
-  EXPECT_THAT(form_manager.blacklisted_matches(),
-              UnorderedElementsAre(Pointee(blacklisted_match),
-                                   Pointee(blacklisted_match2)));
-  EXPECT_EQ(1u, form_manager.best_matches().size());
-  EXPECT_EQ(*saved_match(), *form_manager.preferred_match());
+  EXPECT_TRUE(form_manager()->IsBlacklisted());
+  EXPECT_THAT(form_manager()->blacklisted_matches(),
+              ElementsAre(Pointee(blacklisted_match)));
+  EXPECT_EQ(1u, form_manager()->best_matches().size());
+  EXPECT_EQ(*saved_match(), *form_manager()->preferred_match());
 }
 
 // Test that even in the presence of blacklisted matches, the non-blacklisted
@@ -3461,8 +3433,7 @@
 // Sanity check for calling ProcessMatches with empty vector. Should not crash
 // or make sanitizers scream.
 TEST_F(PasswordFormManagerTest, ProcessMatches_Empty) {
-  static_cast<FormFetcher::Consumer*>(form_manager())
-      ->ProcessMatches(std::vector<const PasswordForm*>(), 0u);
+  fake_form_fetcher()->SetNonFederated({}, 0u);
 }
 
 // For all combinations of PasswordForm schemes, test that ProcessMatches
@@ -3498,16 +3469,14 @@
       non_match.scheme = kWrongScheme;
 
       // First try putting the correct scheme first in returned matches.
-      static_cast<FormFetcher::Consumer*>(&form_manager)
-          ->ProcessMatches({&match, &non_match}, 0u);
+      fetcher.SetNonFederated({&match, &non_match}, 0);
 
       EXPECT_EQ(1u, form_manager.best_matches().size());
       EXPECT_EQ(kCorrectScheme,
                 form_manager.best_matches().begin()->second->scheme);
 
       // Now try putting the correct scheme last in returned matches.
-      static_cast<FormFetcher::Consumer*>(&form_manager)
-          ->ProcessMatches({&non_match, &match}, 0u);
+      fetcher.SetNonFederated({&non_match, &match}, 0);
 
       EXPECT_EQ(1u, form_manager.best_matches().size());
       EXPECT_EQ(kCorrectScheme,
diff --git a/components/payments/content/payment_request_display_manager.cc b/components/payments/content/payment_request_display_manager.cc
index 0fe8e22d9..22283b2 100644
--- a/components/payments/content/payment_request_display_manager.cc
+++ b/components/payments/content/payment_request_display_manager.cc
@@ -33,7 +33,7 @@
 
 void PaymentRequestDisplayManager::DisplayHandle::DisplayPaymentHandlerWindow(
     const GURL& url,
-    base::OnceCallback<void(bool)> callback) {
+    PaymentHandlerOpenWindowCallback callback) {
   DCHECK(delegate_);
   delegate_->EmbedPaymentHandlerWindow(url, std::move(callback));
 }
@@ -56,11 +56,11 @@
 
 void PaymentRequestDisplayManager::ShowPaymentHandlerWindow(
     const GURL& url,
-    base::OnceCallback<void(bool)> callback) {
+    PaymentHandlerOpenWindowCallback callback) {
   if (current_handle_) {
     current_handle_->DisplayPaymentHandlerWindow(url, std::move(callback));
   } else {
-    std::move(callback).Run(false);
+    std::move(callback).Run(false, 0, 0);
   }
 }
 
diff --git a/components/payments/content/payment_request_display_manager.h b/components/payments/content/payment_request_display_manager.h
index 2c64ffb..222556b 100644
--- a/components/payments/content/payment_request_display_manager.h
+++ b/components/payments/content/payment_request_display_manager.h
@@ -21,7 +21,9 @@
 // when a window was/failed to open following an openWindow call. The parameter
 // indicates whether the call was successful or not.
 using PaymentHandlerOpenWindowCallback =
-    base::OnceCallback<void(bool /* success */)>;
+    base::OnceCallback<void(bool /* success */,
+                            int /* render_process_id */,
+                            int /* render_frame_id */)>;
 
 // This KeyedService is responsible for displaying and hiding Payment Request
 // UI. It ensures that only one Payment Request is showing per profile.
@@ -37,7 +39,7 @@
     // |callback| after navigation is completed, passing true/false to indicate
     // success/failure.
     void DisplayPaymentHandlerWindow(const GURL& url,
-                                     base::OnceCallback<void(bool)> callback);
+                                     PaymentHandlerOpenWindowCallback callback);
 
    private:
     PaymentRequestDisplayManager* display_manager_;
diff --git a/components/policy/core/browser/browser_policy_connector.cc b/components/policy/core/browser/browser_policy_connector.cc
index b8e2c06..ad84361e 100644
--- a/components/policy/core/browser/browser_policy_connector.cc
+++ b/components/policy/core/browser/browser_policy_connector.cc
@@ -116,8 +116,6 @@
       base::Bind(&GetChromePolicyDetails), GetChromeSchema(),
       GetPolicyService(), local_state, base::ThreadTaskRunnerHandle::Get()));
   policy_statistics_collector_->Initialize();
-
-  InitPolicyProviders();
 }
 
 void BrowserPolicyConnector::Shutdown() {
@@ -168,5 +166,4 @@
       CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs);
 }
 
-
 }  // namespace policy
diff --git a/components/policy/core/browser/browser_policy_connector_base.cc b/components/policy/core/browser/browser_policy_connector_base.cc
index 04ec3d0f..4cab3f4 100644
--- a/components/policy/core/browser/browser_policy_connector_base.cc
+++ b/components/policy/core/browser/browser_policy_connector_base.cc
@@ -26,12 +26,12 @@
 
 BrowserPolicyConnectorBase::BrowserPolicyConnectorBase(
     const HandlerListFactory& handler_list_factory)
-    : is_initialized_(false), platform_policy_provider_(nullptr) {
+    : is_initialized_(false) {
   // GetPolicyService() must be ready after the constructor is done.
   // The connector is created very early during startup, when the browser
   // threads aren't running yet; initialize components that need local_state,
   // the system request context or other threads (e.g. FILE) at
-  // InitPolicyProviders().
+  // SetPolicyProviders().
 
   // Initialize the SchemaRegistry with the Chrome schema before creating any
   // of the policy providers in subclasses.
@@ -44,34 +44,21 @@
 BrowserPolicyConnectorBase::~BrowserPolicyConnectorBase() {
   if (is_initialized()) {
     // Shutdown() wasn't invoked by our owner after having called
-    // InitPolicyProviders(). This usually means it's an early shutdown and
+    // SetPolicyProviders(). This usually means it's an early shutdown and
     // BrowserProcessImpl::StartTearDown() wasn't invoked.
     // Cleanup properly in those cases and avoid crashing the ToastCrasher test.
     Shutdown();
   }
 }
 
-void BrowserPolicyConnectorBase::InitPolicyProviders() {
-  DCHECK(!is_initialized());
-
-  if (g_testing_provider)
-    g_testing_provider->Init(GetSchemaRegistry());
-
-  for (const auto& provider : policy_providers_)
-    provider->Init(GetSchemaRegistry());
-
-  is_initialized_ = true;
-}
-
 void BrowserPolicyConnectorBase::Shutdown() {
   is_initialized_ = false;
   if (g_testing_provider)
     g_testing_provider->Shutdown();
-  for (const auto& provider : policy_providers_)
-    provider->Shutdown();
-  // Drop g_testing_provider so that tests executed with --single_process can
-  // call SetPolicyProviderForTesting() again. It is still owned by the test.
-  g_testing_provider = nullptr;
+  if (policy_providers_) {
+    for (const auto& provider : *policy_providers_)
+      provider->Shutdown();
+  }
   g_created_policy_service = false;
 }
 
@@ -86,26 +73,13 @@
 PolicyService* BrowserPolicyConnectorBase::GetPolicyService() {
   if (!policy_service_) {
     g_created_policy_service = true;
-    std::vector<ConfigurationPolicyProvider*> providers;
-    if (g_testing_provider) {
-      providers.push_back(g_testing_provider);
-    } else {
-      providers.reserve(policy_providers_.size());
-      for (const auto& policy : policy_providers_) {
-        providers.push_back(policy.get());
-      }
-    }
-    policy_service_.reset(new PolicyServiceImpl(providers));
+    policy_service_ = std::make_unique<PolicyServiceImpl>();
+    if (policy_providers_ || g_testing_provider)
+      policy_service_->SetProviders(GetProvidersForPolicyService());
   }
   return policy_service_.get();
 }
 
-ConfigurationPolicyProvider* BrowserPolicyConnectorBase::GetPlatformProvider() {
-  if (g_testing_provider)
-    return g_testing_provider;
-  return platform_policy_provider_;
-}
-
 const ConfigurationPolicyHandlerList*
 BrowserPolicyConnectorBase::GetHandlerList() const {
   return handler_list_.get();
@@ -121,16 +95,49 @@
   g_testing_provider = provider;
 }
 
-void BrowserPolicyConnectorBase::AddPolicyProvider(
-    std::unique_ptr<ConfigurationPolicyProvider> provider) {
-  policy_providers_.push_back(std::move(provider));
+// static
+ConfigurationPolicyProvider*
+BrowserPolicyConnectorBase::GetPolicyProviderForTesting() {
+  return g_testing_provider;
 }
 
-void BrowserPolicyConnectorBase::SetPlatformPolicyProvider(
-    std::unique_ptr<ConfigurationPolicyProvider> provider) {
-  CHECK(!platform_policy_provider_);
-  platform_policy_provider_ = provider.get();
-  AddPolicyProvider(std::move(provider));
+void BrowserPolicyConnectorBase::SetPolicyProviders(
+    std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers) {
+  // SetPolicyProviders() should only called once.
+  DCHECK(!is_initialized_);
+  policy_providers_ = std::move(providers);
+
+  if (g_testing_provider)
+    g_testing_provider->Init(GetSchemaRegistry());
+
+  for (const auto& provider : *policy_providers_)
+    provider->Init(GetSchemaRegistry());
+
+  is_initialized_ = true;
+
+  if (policy_service_) {
+    if (!policy_service_->has_providers()) {
+      policy_service_->SetProviders(GetProvidersForPolicyService());
+    } else {
+      // GetPolicyService() triggers calling SetProviders() if
+      // |g_testing_provider| has been set. That's the only way that should
+      // result in ending up in this branch.
+      DCHECK(g_testing_provider);
+    }
+  }
+}
+
+std::vector<ConfigurationPolicyProvider*>
+BrowserPolicyConnectorBase::GetProvidersForPolicyService() {
+  std::vector<ConfigurationPolicyProvider*> providers;
+  if (g_testing_provider) {
+    providers.push_back(g_testing_provider);
+    return providers;
+  }
+  providers.reserve(policy_providers_->size());
+  for (const auto& policy : *policy_providers_)
+    providers.push_back(policy.get());
+  return providers;
 }
 
 }  // namespace policy
diff --git a/components/policy/core/browser/browser_policy_connector_base.h b/components/policy/core/browser/browser_policy_connector_base.h
index 56b4bc5..dbe1af9 100644
--- a/components/policy/core/browser/browser_policy_connector_base.h
+++ b/components/policy/core/browser/browser_policy_connector_base.h
@@ -6,8 +6,10 @@
 #define COMPONENTS_POLICY_CORE_BROWSER_BROWSER_POLICY_CONNECTOR_BASE_H_
 
 #include <memory>
+#include <vector>
 
 #include "base/macros.h"
+#include "base/optional.h"
 #include "components/policy/core/browser/configuration_policy_handler_list.h"
 #include "components/policy/core/common/schema.h"
 #include "components/policy/core/common/schema_registry.h"
@@ -17,6 +19,7 @@
 
 class ConfigurationPolicyProvider;
 class PolicyService;
+class PolicyServiceImpl;
 
 // The BrowserPolicyConnectorBase keeps and initializes some core elements of
 // the policy component, mainly the PolicyProviders and the PolicyService.
@@ -32,7 +35,7 @@
   // and should call the parent method.
   virtual void Shutdown();
 
-  // Returns true if InitPolicyProviders() has been called but Shutdown() hasn't
+  // Returns true if SetPolicyProviders() has been called but Shutdown() hasn't
   // been yet.
   bool is_initialized() const { return is_initialized_; }
 
@@ -48,9 +51,6 @@
   // whole browser.
   PolicyService* GetPolicyService();
 
-  // Returns the platform-specific policy provider, if there is one.
-  ConfigurationPolicyProvider* GetPlatformProvider();
-
   const ConfigurationPolicyHandlerList* GetHandlerList() const;
 
   // Sets a |provider| that will be included in PolicyServices returned by
@@ -61,30 +61,26 @@
   // down.
   static void SetPolicyProviderForTesting(
       ConfigurationPolicyProvider* provider);
+  ConfigurationPolicyProvider* GetPolicyProviderForTesting();
 
  protected:
-  // Builds an uninitialized BrowserPolicyConnectorBase. InitPolicyProviders()
+  // Builds an uninitialized BrowserPolicyConnectorBase. SetPolicyProviders()
   // should be called to create and start the policy components.
   explicit BrowserPolicyConnectorBase(
       const HandlerListFactory& handler_list_factory);
 
-  // Finalizes the initialization of the connector. Must be called by
-  // subclasses. This call can be skipped on tests that don't require the full
-  // policy system running.
-  void InitPolicyProviders();
-
-  // Adds |provider| to the list of |policy_providers_|. Providers should
-  // be added in decreasing order of priority.
-  void AddPolicyProvider(std::unique_ptr<ConfigurationPolicyProvider> provider);
-
-  // Same as AddPolicyProvider(), but |provider| becomes the platform provider
-  // which can be retrieved by GetPlatformProvider(). This can be called at
-  // most once, and uses the same priority order as AddPolicyProvider().
-  void SetPlatformPolicyProvider(
-      std::unique_ptr<ConfigurationPolicyProvider> provider);
+  // Sets the set of providers, in decreasing order of priority. May only be
+  // called once.
+  void SetPolicyProviders(
+      std::vector<std::unique_ptr<ConfigurationPolicyProvider>> providers);
 
  private:
-  // Whether InitPolicyProviders() but not Shutdown() has been invoked.
+  // Returns the providers to pass to the PolicyService. Generally this is the
+  // same as |policy_providers_|, unless SetPolicyProviderForTesting() has been
+  // called.
+  std::vector<ConfigurationPolicyProvider*> GetProvidersForPolicyService();
+
+  // Whether SetPolicyProviders() but not Shutdown() has been invoked.
   bool is_initialized_;
 
   // Used to convert policies to preferences. The providers declared below
@@ -101,11 +97,11 @@
   CombinedSchemaRegistry schema_registry_;
 
   // The browser-global policy providers, in decreasing order of priority.
-  std::vector<std::unique_ptr<ConfigurationPolicyProvider>> policy_providers_;
-  ConfigurationPolicyProvider* platform_policy_provider_;
+  base::Optional<std::vector<std::unique_ptr<ConfigurationPolicyProvider>>>
+      policy_providers_;
 
   // Must be deleted before all the policy providers.
-  std::unique_ptr<PolicyService> policy_service_;
+  std::unique_ptr<PolicyServiceImpl> policy_service_;
 
   DISALLOW_COPY_AND_ASSIGN(BrowserPolicyConnectorBase);
 };
diff --git a/components/policy/core/browser/configuration_policy_pref_store_test.cc b/components/policy/core/browser/configuration_policy_pref_store_test.cc
index 904a853..6a9bfac2 100644
--- a/components/policy/core/browser/configuration_policy_pref_store_test.cc
+++ b/components/policy/core/browser/configuration_policy_pref_store_test.cc
@@ -30,7 +30,8 @@
       .WillRepeatedly(Return(false));
   provider_.Init();
   providers_.push_back(&provider_);
-  policy_service_.reset(new PolicyServiceImpl(providers_));
+  policy_service_ = std::make_unique<PolicyServiceImpl>();
+  policy_service_->SetProviders(providers_);
   store_ = new ConfigurationPolicyPrefStore(
       policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY);
 }
diff --git a/components/policy/core/browser/configuration_policy_pref_store_test.h b/components/policy/core/browser/configuration_policy_pref_store_test.h
index cbe2803d..3799f0c 100644
--- a/components/policy/core/browser/configuration_policy_pref_store_test.h
+++ b/components/policy/core/browser/configuration_policy_pref_store_test.h
@@ -19,7 +19,6 @@
 
 struct PolicyHandlerParameters;
 class PolicyMap;
-class PolicyService;
 class ConfigurationPolicyPrefStore;
 
 class ConfigurationPolicyPrefStoreTest : public testing::Test {
@@ -37,7 +36,7 @@
   PolicyServiceImpl::Providers providers_;
   ConfigurationPolicyHandlerList handler_list_;
   MockConfigurationPolicyProvider provider_;
-  std::unique_ptr<PolicyService> policy_service_;
+  std::unique_ptr<PolicyServiceImpl> policy_service_;
   scoped_refptr<ConfigurationPolicyPrefStore> store_;
   base::MessageLoop loop_;
 
diff --git a/components/policy/core/browser/proxy_policy_handler_unittest.cc b/components/policy/core/browser/proxy_policy_handler_unittest.cc
index c77184d..4095533 100644
--- a/components/policy/core/browser/proxy_policy_handler_unittest.cc
+++ b/components/policy/core/browser/proxy_policy_handler_unittest.cc
@@ -32,7 +32,8 @@
     // preprocessor. The previous store must be nulled out first so that it
     // removes itself from the service's observer list.
     store_ = nullptr;
-    policy_service_.reset(new PolicyServiceImpl(providers_));
+    policy_service_ = std::make_unique<PolicyServiceImpl>();
+    policy_service_->SetProviders(providers_);
     store_ = new ConfigurationPolicyPrefStore(
         policy_service_.get(), &handler_list_, POLICY_LEVEL_MANDATORY);
   }
diff --git a/components/policy/core/common/policy_service_impl.cc b/components/policy/core/common/policy_service_impl.cc
index 29c09af3..42b6138c 100644
--- a/components/policy/core/common/policy_service_impl.cc
+++ b/components/policy/core/common/policy_service_impl.cc
@@ -72,12 +72,25 @@
 
 }  // namespace
 
-PolicyServiceImpl::PolicyServiceImpl(const Providers& providers)
-    : update_task_ptr_factory_(this) {
+PolicyServiceImpl::PolicyServiceImpl() : update_task_ptr_factory_(this) {
+  for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain)
+    initialization_complete_[domain] = false;
+}
+
+PolicyServiceImpl::~PolicyServiceImpl() {
+  DCHECK(thread_checker_.CalledOnValidThread());
+  if (providers_) {
+    for (auto* provider : *providers_)
+      provider->RemoveObserver(this);
+  }
+}
+
+void PolicyServiceImpl::SetProviders(Providers providers) {
+  DCHECK(!providers_);
+  providers_ = std::move(providers);
   for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain)
     initialization_complete_[domain] = true;
-  providers_ = providers;
-  for (auto* provider : providers) {
+  for (auto* provider : *providers_) {
     provider->AddObserver(this);
     for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) {
       initialization_complete_[domain] &=
@@ -89,12 +102,6 @@
   MergeAndTriggerUpdates();
 }
 
-PolicyServiceImpl::~PolicyServiceImpl() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  for (auto* provider : providers_)
-    provider->RemoveObserver(this);
-}
-
 void PolicyServiceImpl::AddObserver(PolicyDomain domain,
                                     PolicyService::Observer* observer) {
   DCHECK(thread_checker_.CalledOnValidThread());
@@ -136,7 +143,7 @@
   if (!callback.is_null())
     refresh_callbacks_.push_back(callback);
 
-  if (providers_.empty()) {
+  if (!providers_ || providers_->empty()) {
     // Refresh is immediately complete if there are no providers. See the note
     // on OnUpdatePolicy() about why this is a posted task.
     update_task_ptr_factory_.InvalidateWeakPtrs();
@@ -146,15 +153,15 @@
   } else {
     // Some providers might invoke OnUpdatePolicy synchronously while handling
     // RefreshPolicies. Mark all as pending before refreshing.
-    for (auto* provider : providers_)
+    for (auto* provider : *providers_)
       refresh_pending_.insert(provider);
-    for (auto* provider : providers_)
+    for (auto* provider : *providers_)
       provider->RefreshPolicies();
   }
 }
 
 void PolicyServiceImpl::OnUpdatePolicy(ConfigurationPolicyProvider* provider) {
-  DCHECK_EQ(1, std::count(providers_.begin(), providers_.end(), provider));
+  DCHECK_EQ(1, std::count(providers_->begin(), providers_->end(), provider));
   refresh_pending_.erase(provider);
 
   // Note: a policy change may trigger further policy changes in some providers.
@@ -187,11 +194,13 @@
   // Merge from each provider in their order of priority.
   const PolicyNamespace chrome_namespace(POLICY_DOMAIN_CHROME, std::string());
   PolicyBundle bundle;
-  for (auto* provider : providers_) {
-    PolicyBundle provided_bundle;
-    provided_bundle.CopyFrom(provider->policies());
-    RemapProxyPolicies(&provided_bundle.Get(chrome_namespace));
-    bundle.MergeFrom(provided_bundle);
+  if (providers_) {
+    for (auto* provider : *providers_) {
+      PolicyBundle provided_bundle;
+      provided_bundle.CopyFrom(provider->policies());
+      RemapProxyPolicies(&provided_bundle.Get(chrome_namespace));
+      bundle.MergeFrom(provided_bundle);
+    }
   }
 
   // Swap first, so that observers that call GetPolicies() see the current
@@ -238,6 +247,9 @@
 void PolicyServiceImpl::CheckInitializationComplete() {
   DCHECK(thread_checker_.CalledOnValidThread());
 
+  if (!providers_)
+    return;
+
   // Check if all the providers just became initialized for each domain; if so,
   // notify that domain's observers.
   for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) {
@@ -247,7 +259,7 @@
     PolicyDomain policy_domain = static_cast<PolicyDomain>(domain);
 
     bool all_complete = true;
-    for (auto* provider : providers_) {
+    for (auto* provider : *providers_) {
       if (!provider->IsInitializationComplete(policy_domain)) {
         all_complete = false;
         break;
diff --git a/components/policy/core/common/policy_service_impl.h b/components/policy/core/common/policy_service_impl.h
index c75c7b7..0e6003e 100644
--- a/components/policy/core/common/policy_service_impl.h
+++ b/components/policy/core/common/policy_service_impl.h
@@ -15,6 +15,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "base/observer_list.h"
+#include "base/optional.h"
 #include "base/threading/thread_checker.h"
 #include "components/policy/core/common/configuration_policy_provider.h"
 #include "components/policy/core/common/policy_bundle.h"
@@ -31,14 +32,18 @@
  public:
   using Providers = std::vector<ConfigurationPolicyProvider*>;
 
-  // The PolicyServiceImpl will merge policies from |providers|. |providers|
-  // must be sorted in decreasing order of priority; the first provider will
-  // have the highest priority. The PolicyServiceImpl does not take ownership of
-  // the providers, and they must outlive the PolicyServiceImpl.
-  explicit PolicyServiceImpl(const Providers& providers);
+  // Creates a new PolicyServiceImpl, it is expected SetProviders() is called
+  // once to complete initialization.
+  PolicyServiceImpl();
 
   ~PolicyServiceImpl() override;
 
+  // Sets the providers; see description of constructor for details.
+  void SetProviders(Providers providers);
+
+  // Returns true if SetProviders() was called.
+  bool has_providers() const { return providers_.has_value(); }
+
   // PolicyService overrides:
   void AddObserver(PolicyDomain domain,
                    PolicyService::Observer* observer) override;
@@ -71,8 +76,8 @@
   // Invokes all the refresh callbacks if there are no more refreshes pending.
   void CheckRefreshComplete();
 
-  // The providers passed in the constructor, in order of decreasing priority.
-  Providers providers_;
+  // The providers set via SetProviders(), in order of decreasing priority.
+  base::Optional<Providers> providers_;
 
   // Maps each policy namespace to its current policies.
   PolicyBundle policy_bundle_;
diff --git a/components/policy/core/common/policy_service_impl_unittest.cc b/components/policy/core/common/policy_service_impl_unittest.cc
index dd2d2da..857e382 100644
--- a/components/policy/core/common/policy_service_impl_unittest.cc
+++ b/components/policy/core/common/policy_service_impl_unittest.cc
@@ -120,7 +120,8 @@
     providers.push_back(&provider0_);
     providers.push_back(&provider1_);
     providers.push_back(&provider2_);
-    policy_service_.reset(new PolicyServiceImpl(providers));
+    policy_service_ = std::make_unique<PolicyServiceImpl>();
+    policy_service_->SetProviders(providers);
   }
 
   void TearDown() override {
@@ -560,7 +561,8 @@
   providers.push_back(&provider0_);
   providers.push_back(&provider1_);
   providers.push_back(&provider2_);
-  policy_service_.reset(new PolicyServiceImpl(providers));
+  policy_service_ = std::make_unique<PolicyServiceImpl>();
+  policy_service_->SetProviders(providers);
   EXPECT_FALSE(policy_service_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
   EXPECT_FALSE(
       policy_service_->IsInitializationComplete(POLICY_DOMAIN_EXTENSIONS));
diff --git a/components/security_interstitials/core/common/resources/interstitial_common.js b/components/security_interstitials/core/common/resources/interstitial_common.js
index 4742aa2..4fe41098 100644
--- a/components/security_interstitials/core/common/resources/interstitial_common.js
+++ b/components/security_interstitials/core/common/resources/interstitial_common.js
@@ -34,6 +34,50 @@
  * @param {string} cmd  The command to send.
  */
 function sendCommand(cmd) {
+  if (window.certificateErrorPageController) {
+    switch (cmd) {
+      case SecurityInterstitialCommandId.CMD_DONT_PROCEED:
+        certificateErrorPageController.dontProceed();
+        break;
+      case SecurityInterstitialCommandId.CMD_PROCEED:
+        certificateErrorPageController.proceed();
+        break;
+      case SecurityInterstitialCommandId.CMD_SHOW_MORE_SECTION:
+        certificateErrorPageController.showMoreSection();
+        break;
+      case SecurityInterstitialCommandId.CMD_OPEN_HELP_CENTER:
+        certificateErrorPageController.openHelpCenter();
+        break;
+      case SecurityInterstitialCommandId.CMD_OPEN_DIAGNOSTIC:
+        certificateErrorPageController.openDiagnostic();
+        break;
+      case SecurityInterstitialCommandId.CMD_RELOAD:
+        certificateErrorPageController.reload();
+        break;
+      case SecurityInterstitialCommandId.CMD_OPEN_DATE_SETTINGS:
+        certificateErrorPageController.openDateSettings();
+        break;
+      case SecurityInterstitialCommandId.CMD_OPEN_LOGIN:
+        certificateErrorPageController.openLogin();
+        break;
+      case SecurityInterstitialCommandId.CMD_DO_REPORT:
+        certificateErrorPageController.doReport();
+        break;
+      case SecurityInterstitialCommandId.CMD_DONT_REPORT:
+        certificateErrorPageController.dontReport();
+        break;
+      case SecurityInterstitialCommandId.CMD_OPEN_REPORTING_PRIVACY:
+        certificateErrorPageController.openReportingPrivacy();
+        break;
+      case SecurityInterstitialCommandId.CMD_OPEN_WHITEPAPER:
+        certificateErrorPageController.openWhitepaper();
+        break;
+      case SecurityInterstitialCommandId.CMD_REPORT_PHISHING_ERROR:
+        certificateErrorPageController.reportPhishingError();
+        break;
+    }
+    return;
+  }
 // <if expr="not is_ios">
   window.domAutomationController.send(cmd);
 // </if>
diff --git a/components/signin/core/browser/resources/signin_index.html b/components/signin/core/browser/resources/signin_index.html
index 1682494b..4bc9c10d 100644
--- a/components/signin/core/browser/resources/signin_index.html
+++ b/components/signin/core/browser/resources/signin_index.html
@@ -2,9 +2,11 @@
 <html dir="$i18n{textdirection}" lang="$i18n{language}">
 <head>
   <meta charset="utf-8">
-  <link rel="import" href="chrome://resources/html/polymer.html">
-  <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
-  <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
+  <if expr="not is_android and not is_ios">
+    <link rel="import" href="chrome://resources/html/polymer.html">
+    <link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
+    <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html">
+  </if>
   <title>Signin Internals</title>
   <script src="chrome://resources/js/cr.js"></script>
   <script src="chrome://resources/js/util.js"></script>
diff --git a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc
index ee575c7..8333029 100644
--- a/components/viz/service/frame_sinks/surface_synchronization_unittest.cc
+++ b/components/viz/service/frame_sinks/surface_synchronization_unittest.cc
@@ -1915,6 +1915,7 @@
   const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
   const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 2);
   const SurfaceId child_id3 = MakeSurfaceId(kChildFrameSink1, 2, 2);
+  const SurfaceId child_id4 = MakeSurfaceId(kChildFrameSink1, 2, 3);
 
   child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
                                          MakeDefaultCompositorFrame());
@@ -1974,14 +1975,14 @@
   // GetLatestInFlightSurface will not return child_id2's surface because it
   // does not yet have an owner.
   EXPECT_EQ(GetSurfaceForId(child_id1),
-            GetLatestInFlightSurface(child_id2, child_id1));
+            GetLatestInFlightSurface(child_id3, child_id1));
 
   // Now that the owner of |child_id2| is known, GetLatestInFlightSurface will
   // return it as a possible fallback.
   frame_sink_manager().surface_manager()->AssignTemporaryReference(
       child_id2, parent_id.frame_sink_id());
   EXPECT_EQ(GetSurfaceForId(child_id2),
-            GetLatestInFlightSurface(child_id2, child_id1));
+            GetLatestInFlightSurface(child_id3, child_id1));
 
   // If the primary surface is old, then we shouldn't return an in-flight
   // surface that is newer than the primary.
@@ -1999,7 +2000,7 @@
   // GetLatestInFlightSurface will not return child_id3's surface because it
   // does not yet have an owner.
   EXPECT_EQ(GetSurfaceForId(child_id2),
-            GetLatestInFlightSurface(child_id3, child_id1));
+            GetLatestInFlightSurface(child_id4, child_id1));
   EXPECT_THAT(GetChildReferences(parent_id), UnorderedElementsAre(child_id1));
 
   // Now that the owner of |child_id3| is known, GetLatestInFlightSurface will
@@ -2007,12 +2008,12 @@
   frame_sink_manager().surface_manager()->AssignTemporaryReference(
       child_id3, parent_id.frame_sink_id());
   EXPECT_EQ(GetSurfaceForId(child_id3),
-            GetLatestInFlightSurface(child_id3, child_id1));
+            GetLatestInFlightSurface(child_id4, child_id1));
 
   // If the primary surface is old, then we shouldn't return an in-flight
   // surface that is newer than the primary.
   EXPECT_EQ(GetSurfaceForId(child_id2),
-            GetLatestInFlightSurface(child_id2, child_id1));
+            GetLatestInFlightSurface(child_id3, child_id1));
 }
 
 // This test verifies that GetLatestInFlightSurface will return nullptr
@@ -2077,6 +2078,53 @@
             GetLatestInFlightSurface(child_id2, child_id1));
 }
 
+// This test verifies that GetLatestInFlightSurface will never return the
+// primary surface ID even if it is in the temporary reference queue.
+TEST_F(SurfaceSynchronizationTest, LatestInFlightSurfaceSkipPrimary) {
+  const SurfaceId parent_id = MakeSurfaceId(kParentFrameSink, 1);
+  const SurfaceId child_id1 = MakeSurfaceId(kChildFrameSink1, 1);
+  const SurfaceId child_id2 = MakeSurfaceId(kChildFrameSink1, 2);
+  const SurfaceId child_id3 = MakeSurfaceId(kChildFrameSink1, 3);
+
+  // Don't automatically assign temporary references.
+  DisableAssignTemporaryReferences();
+
+  child_support1().SubmitCompositorFrame(child_id1.local_surface_id(),
+                                         MakeDefaultCompositorFrame());
+
+  // Create a reference from |parent_id| to |child_id|.
+  parent_support().SubmitCompositorFrame(
+      parent_id.local_surface_id(),
+      MakeCompositorFrame(empty_surface_ids(), {child_id1},
+                          std::vector<TransferableResource>()));
+
+  child_support1().SubmitCompositorFrame(child_id2.local_surface_id(),
+                                         MakeDefaultCompositorFrame());
+
+  // |child_id2| will not be returned until its temporary reference is
+  // assigned.
+  EXPECT_EQ(GetSurfaceForId(child_id1),
+            GetLatestInFlightSurface(child_id3, child_id1));
+
+  // Verify that there is a temporary reference for |child_id2|.
+  EXPECT_TRUE(HasTemporaryReference(child_id2));
+  frame_sink_manager().surface_manager()->AssignTemporaryReference(
+      child_id2, parent_id.frame_sink_id());
+
+  EXPECT_EQ(GetSurfaceForId(child_id2),
+            GetLatestInFlightSurface(child_id3, child_id1));
+
+  child_support1().SubmitCompositorFrame(child_id3.local_surface_id(),
+                                         MakeDefaultCompositorFrame());
+  frame_sink_manager().surface_manager()->AssignTemporaryReference(
+      child_id3, parent_id.frame_sink_id());
+
+  // Even though there is a valid temporary reference with an owner for
+  // the primary, we never pick the primary.
+  EXPECT_EQ(GetSurfaceForId(child_id2),
+            GetLatestInFlightSurface(child_id3, child_id1));
+}
+
 // This test verifies that if a child submits a LocalSurfaceId newer that the
 // parent's dependency, then the parent will drop its dependency and activate
 // if possible.
diff --git a/components/viz/service/surfaces/surface_manager.cc b/components/viz/service/surfaces/surface_manager.cc
index 4e54264a..f8f667e 100644
--- a/components/viz/service/surfaces/surface_manager.cc
+++ b/components/viz/service/surfaces/surface_manager.cc
@@ -508,8 +508,9 @@
 
   const std::vector<LocalSurfaceId>& temp_surfaces = it->second;
   for (const LocalSurfaceId& local_surface_id : base::Reversed(temp_surfaces)) {
-    // The in-flight surface cannot be newer than the primary surface ID.
-    if (local_surface_id.parent_sequence_number() >
+    // The in-flight surface must be older than the primary surface ID.
+    if (local_surface_id == primary_surface_id.local_surface_id() ||
+        local_surface_id.parent_sequence_number() >
             primary_surface_id.local_surface_id().parent_sequence_number() ||
         local_surface_id.child_sequence_number() >
             primary_surface_id.local_surface_id().child_sequence_number()) {
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 090857e..61d3802 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -445,12 +445,7 @@
 
 class ContentMainRunnerImpl : public ContentMainRunner {
  public:
-  ContentMainRunnerImpl()
-      : is_initialized_(false),
-        is_shutdown_(false),
-        completed_basic_startup_(false),
-        delegate_(nullptr),
-        ui_task_(nullptr) {
+  ContentMainRunnerImpl() {
 #if defined(OS_WIN)
     memset(&sandbox_info_, 0, sizeof(sandbox_info_));
 #endif
@@ -471,6 +466,7 @@
 
   int Initialize(const ContentMainParams& params) override {
     ui_task_ = params.ui_task;
+    created_main_parts_closure_ = params.created_main_parts_closure;
 
     create_discardable_memory_ = params.create_discardable_memory;
 
@@ -707,6 +703,7 @@
 
     MainFunctionParams main_params(command_line);
     main_params.ui_task = ui_task_;
+    main_params.created_main_parts_closure = created_main_parts_closure_;
 #if defined(OS_WIN)
     main_params.sandbox_info = &sandbox_info_;
 #elif defined(OS_MACOSX)
@@ -747,19 +744,19 @@
 
  private:
   // True if the runner has been initialized.
-  bool is_initialized_;
+  bool is_initialized_ = false;
 
   // True if the runner has been shut down.
-  bool is_shutdown_;
+  bool is_shutdown_ = false;
 
   // True if basic startup was completed.
-  bool completed_basic_startup_;
+  bool completed_basic_startup_ = false;
 
   // Used if the embedder doesn't set one.
   ContentClient empty_content_client_;
 
   // The delegate will outlive this object.
-  ContentMainDelegate* delegate_;
+  ContentMainDelegate* delegate_ = nullptr;
 
   std::unique_ptr<base::AtExitManager> exit_manager_;
 #if defined(OS_WIN)
@@ -768,7 +765,9 @@
   base::mac::ScopedNSAutoreleasePool* autorelease_pool_ = nullptr;
 #endif
 
-  base::Closure* ui_task_;
+  base::Closure* ui_task_ = nullptr;
+
+  CreatedMainPartsClosure* created_main_parts_closure_ = nullptr;
 
 #if defined(USE_AURA)
   aura::Env::Mode env_mode_ = aura::Env::Mode::LOCAL;
diff --git a/content/browser/appcache/appcache_frontend_proxy.cc b/content/browser/appcache/appcache_frontend_proxy.cc
index dca1513..47b80b9a 100644
--- a/content/browser/appcache/appcache_frontend_proxy.cc
+++ b/content/browser/appcache/appcache_frontend_proxy.cc
@@ -78,7 +78,7 @@
 
 void AppCacheFrontendProxy::OnSetSubresourceFactory(
     int host_id,
-    mojom::URLLoaderFactoryPtr url_loader_factory) {
+    network::mojom::URLLoaderFactoryPtr url_loader_factory) {
   GetAppCacheFrontend()->SetSubresourceFactory(host_id,
                                                std::move(url_loader_factory));
 }
diff --git a/content/browser/appcache/appcache_frontend_proxy.h b/content/browser/appcache/appcache_frontend_proxy.h
index c194f44..1c53ef0 100644
--- a/content/browser/appcache/appcache_frontend_proxy.h
+++ b/content/browser/appcache/appcache_frontend_proxy.h
@@ -37,7 +37,7 @@
   void OnContentBlocked(int host_id, const GURL& manifest_url) override;
   void OnSetSubresourceFactory(
       int host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) override;
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override;
 
  private:
   mojom::AppCacheFrontend* GetAppCacheFrontend();
diff --git a/content/browser/appcache/appcache_group_unittest.cc b/content/browser/appcache/appcache_group_unittest.cc
index f59a935..2e0fa23 100644
--- a/content/browser/appcache/appcache_group_unittest.cc
+++ b/content/browser/appcache/appcache_group_unittest.cc
@@ -54,7 +54,7 @@
 
   void OnSetSubresourceFactory(
       int host_id,
-      content::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
 
   int last_host_id_;
   int64_t last_cache_id_;
diff --git a/content/browser/appcache/appcache_host.cc b/content/browser/appcache/appcache_host.cc
index e74eb980..b79c46243 100644
--- a/content/browser/appcache/appcache_host.cc
+++ b/content/browser/appcache/appcache_host.cc
@@ -15,8 +15,8 @@
 #include "content/browser/appcache/appcache_request_handler.h"
 #include "content/browser/appcache/appcache_subresource_url_factory.h"
 #include "content/public/common/content_features.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/url_request/url_request.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "storage/browser/quota/quota_manager_proxy.h"
 
 namespace content {
@@ -535,7 +535,7 @@
   if (subresource_url_factory_.get())
     return;
 
-  mojom::URLLoaderFactoryPtr factory_ptr = nullptr;
+  network::mojom::URLLoaderFactoryPtr factory_ptr = nullptr;
 
   AppCacheSubresourceURLFactory::CreateURLLoaderFactory(
       service()->url_loader_factory_getter(), GetWeakPtr(), &factory_ptr);
diff --git a/content/browser/appcache/appcache_host_unittest.cc b/content/browser/appcache/appcache_host_unittest.cc
index 3411a4f..247188e5 100644
--- a/content/browser/appcache/appcache_host_unittest.cc
+++ b/content/browser/appcache/appcache_host_unittest.cc
@@ -77,7 +77,7 @@
 
     void OnSetSubresourceFactory(
         int host_id,
-        mojom::URLLoaderFactoryPtr url_loader_factory) override {}
+        network::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
 
     int last_host_id_;
     int64_t last_cache_id_;
diff --git a/content/browser/appcache/appcache_navigation_handle_core.cc b/content/browser/appcache/appcache_navigation_handle_core.cc
index cc1f465..1121e409 100644
--- a/content/browser/appcache/appcache_navigation_handle_core.cc
+++ b/content/browser/appcache/appcache_navigation_handle_core.cc
@@ -125,7 +125,7 @@
 
 void AppCacheNavigationHandleCore::OnSetSubresourceFactory(
     int host_id,
-    mojom::URLLoaderFactoryPtr url_loader_factory) {
+    network::mojom::URLLoaderFactoryPtr url_loader_factory) {
   // Should never be called.
   DCHECK(false);
 }
diff --git a/content/browser/appcache/appcache_navigation_handle_core.h b/content/browser/appcache/appcache_navigation_handle_core.h
index 85c44dc..93561916 100644
--- a/content/browser/appcache/appcache_navigation_handle_core.h
+++ b/content/browser/appcache/appcache_navigation_handle_core.h
@@ -67,7 +67,7 @@
   void OnContentBlocked(int host_id, const GURL& manifest_url) override;
   void OnSetSubresourceFactory(
       int host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) override;
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override;
 
  private:
   std::unique_ptr<AppCacheHost> precreated_host_;
diff --git a/content/browser/appcache/appcache_request_handler.cc b/content/browser/appcache/appcache_request_handler.cc
index 19fa369..620b1d5 100644
--- a/content/browser/appcache/appcache_request_handler.cc
+++ b/content/browser/appcache/appcache_request_handler.cc
@@ -599,19 +599,19 @@
 
 bool AppCacheRequestHandler::MaybeCreateLoaderForResponse(
     const network::ResourceResponseHead& response,
-    mojom::URLLoaderPtr* loader,
-    mojom::URLLoaderClientRequest* client_request) {
+    network::mojom::URLLoaderPtr* loader,
+    network::mojom::URLLoaderClientRequest* client_request) {
   // The sync interface of this method is inherited from the
   // URLLoaderRequestHandler class. The LoaderCallback created here is invoked
   // synchronously in fallback cases, and only when there really is a loader
   // to start.
   bool was_called = false;
   loader_callback_ = base::BindOnce(
-      [](mojom::URLLoaderPtr* loader,
-         mojom::URLLoaderClientRequest* client_request, bool* was_called,
-         StartLoaderCallback start_function) {
+      [](network::mojom::URLLoaderPtr* loader,
+         network::mojom::URLLoaderClientRequest* client_request,
+         bool* was_called, StartLoaderCallback start_function) {
         *was_called = true;
-        mojom::URLLoaderClientPtr client;
+        network::mojom::URLLoaderClientPtr client;
         *client_request = mojo::MakeRequest(&client);
         std::move(start_function)
             .Run(mojo::MakeRequest(loader), std::move(client));
@@ -633,7 +633,7 @@
     return base::nullopt;
 
   // The factory is destroyed when the renderer drops the connection.
-  mojom::URLLoaderFactoryPtr factory_ptr;
+  network::mojom::URLLoaderFactoryPtr factory_ptr;
   AppCacheSubresourceURLFactory::CreateURLLoaderFactory(
       network_url_loader_factory_getter_.get(), appcache_host_, &factory_ptr);
 
diff --git a/content/browser/appcache/appcache_request_handler.h b/content/browser/appcache/appcache_request_handler.h
index fb13c70..e59bb24 100644
--- a/content/browser/appcache/appcache_request_handler.h
+++ b/content/browser/appcache/appcache_request_handler.h
@@ -92,8 +92,8 @@
   // MaybeCreateLoaderForResponse always returns synchronously.
   bool MaybeCreateLoaderForResponse(
       const network::ResourceResponseHead& response,
-      mojom::URLLoaderPtr* loader,
-      mojom::URLLoaderClientRequest* client_request) override;
+      network::mojom::URLLoaderPtr* loader,
+      network::mojom::URLLoaderClientRequest* client_request) override;
   base::Optional<SubresourceLoaderParams> MaybeCreateSubresourceLoaderParams()
       override;
 
diff --git a/content/browser/appcache/appcache_request_handler_unittest.cc b/content/browser/appcache/appcache_request_handler_unittest.cc
index 81f24f2..8d419286 100644
--- a/content/browser/appcache/appcache_request_handler_unittest.cc
+++ b/content/browser/appcache/appcache_request_handler_unittest.cc
@@ -93,7 +93,7 @@
 
     void OnSetSubresourceFactory(
         int host_id,
-        mojom::URLLoaderFactoryPtr url_loader_factory) override {}
+        network::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
   };
 
   // Helper callback to run a test on our io_thread. The io_thread is spun up
diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc
index 6731729..3621b0d 100644
--- a/content/browser/appcache/appcache_storage_impl_unittest.cc
+++ b/content/browser/appcache/appcache_storage_impl_unittest.cc
@@ -1673,7 +1673,7 @@
     void OnContentBlocked(int host_id, const GURL& manifest_url) override {}
     void OnSetSubresourceFactory(
         int host_id,
-        mojom::URLLoaderFactoryPtr url_loader_factory) override {}
+        network::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
 
     bool error_event_was_raised_;
   };
diff --git a/content/browser/appcache/appcache_subresource_url_factory.cc b/content/browser/appcache/appcache_subresource_url_factory.cc
index 9183541a..7d251e9 100644
--- a/content/browser/appcache/appcache_subresource_url_factory.cc
+++ b/content/browser/appcache/appcache_subresource_url_factory.cc
@@ -12,7 +12,6 @@
 #include "content/browser/appcache/appcache_url_loader_request.h"
 #include "content/browser/url_loader_factory_getter.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
@@ -20,6 +19,7 @@
 #include "net/url_request/url_request.h"
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -34,15 +34,15 @@
 //
 // This class owns and scopes the lifetime of the AppCacheRequestHandler
 // for the duration of a subresource load.
-class SubresourceLoader : public mojom::URLLoader,
-                          public mojom::URLLoaderClient {
+class SubresourceLoader : public network::mojom::URLLoader,
+                          public network::mojom::URLLoaderClient {
  public:
-  SubresourceLoader(mojom::URLLoaderRequest url_loader_request,
+  SubresourceLoader(network::mojom::URLLoaderRequest url_loader_request,
                     int32_t routing_id,
                     int32_t request_id,
                     uint32_t options,
                     const network::ResourceRequest& request,
-                    mojom::URLLoaderClientPtr client,
+                    network::mojom::URLLoaderClientPtr client,
                     const net::MutableNetworkTrafficAnnotationTag& annotation,
                     base::WeakPtr<AppCacheHost> appcache_host,
                     scoped_refptr<URLLoaderFactoryGetter> net_factory_getter)
@@ -104,7 +104,7 @@
     local_client_binding_.Close();
     network_loader_ = nullptr;
 
-    mojom::URLLoaderClientPtr client_ptr;
+    network::mojom::URLLoaderClientPtr client_ptr;
     local_client_binding_.Bind(mojo::MakeRequest(&client_ptr));
     std::move(start_function)
         .Run(mojo::MakeRequest(&appcache_loader_), std::move(client_ptr));
@@ -112,7 +112,7 @@
 
   void CreateAndStartNetworkLoader() {
     DCHECK(!appcache_loader_);
-    mojom::URLLoaderClientPtr client_ptr;
+    network::mojom::URLLoaderClientPtr client_ptr;
     local_client_binding_.Bind(mojo::MakeRequest(&client_ptr));
     network_loader_factory_->GetNetworkFactory()->CreateLoaderAndStart(
         mojo::MakeRequest(&network_loader_), routing_id_, request_id_, options_,
@@ -123,7 +123,7 @@
       network_loader_->PauseReadingBodyFromNet();
   }
 
-  // mojom::URLLoader implementation
+  // network::mojom::URLLoader implementation
   // Called by the remote client in the renderer.
   void FollowRedirect() override {
     if (!handler_) {
@@ -138,7 +138,7 @@
                        weak_factory_.GetWeakPtr()));
   }
 
-  // mojom::URLLoader implementation
+  // network::mojom::URLLoader implementation
   void ProceedWithResponse() override { NOTREACHED(); }
 
   void ContinueFollowRedirect(StartLoaderCallback start_function) {
@@ -169,12 +169,12 @@
       network_loader_->ResumeReadingBodyFromNet();
   }
 
-  // mojom::URLLoaderClient implementation
+  // network::mojom::URLLoaderClient implementation
   // Called by either the appcache or network loader, whichever is in use.
   void OnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     // Don't MaybeFallback for appcache produced responses.
     if (appcache_loader_ || !handler_) {
       remote_client_->OnReceiveResponse(response_head, ssl_info,
@@ -193,7 +193,7 @@
   void ContinueOnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file,
+      network::mojom::DownloadedTempFilePtr downloaded_file,
       StartLoaderCallback start_function) {
     if (start_function) {
       CreateAndStartAppCacheLoader(std::move(start_function));
@@ -277,8 +277,8 @@
   }
 
   // The binding and client pointer associated with the renderer.
-  mojo::Binding<mojom::URLLoader> remote_binding_;
-  mojom::URLLoaderClientPtr remote_client_;
+  mojo::Binding<network::mojom::URLLoader> remote_binding_;
+  network::mojom::URLLoaderClientPtr remote_client_;
 
   network::ResourceRequest request_;
   int32_t routing_id_;
@@ -299,9 +299,9 @@
 
   // The local binding to either our network or appcache loader,
   // we only use one of them at any given time.
-  mojo::Binding<mojom::URLLoaderClient> local_client_binding_;
-  mojom::URLLoaderPtr network_loader_;
-  mojom::URLLoaderPtr appcache_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> local_client_binding_;
+  network::mojom::URLLoaderPtr network_loader_;
+  network::mojom::URLLoaderPtr appcache_loader_;
 
   base::WeakPtr<AppCacheHost> host_;
 
@@ -329,7 +329,7 @@
 void AppCacheSubresourceURLFactory::CreateURLLoaderFactory(
     URLLoaderFactoryGetter* default_url_loader_factory_getter,
     base::WeakPtr<AppCacheHost> host,
-    mojom::URLLoaderFactoryPtr* loader_factory) {
+    network::mojom::URLLoaderFactoryPtr* loader_factory) {
   DCHECK(host.get());
   // This instance is effectively reference counted by the number of pipes open
   // to it and will get deleted when all clients drop their connections.
@@ -344,12 +344,12 @@
 }
 
 void AppCacheSubresourceURLFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest url_loader_request,
+    network::mojom::URLLoaderRequest url_loader_request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   new SubresourceLoader(std::move(url_loader_request), routing_id, request_id,
@@ -358,7 +358,7 @@
 }
 
 void AppCacheSubresourceURLFactory::Clone(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
diff --git a/content/browser/appcache/appcache_subresource_url_factory.h b/content/browser/appcache/appcache_subresource_url_factory.h
index 74de209..b6c862e 100644
--- a/content/browser/appcache/appcache_subresource_url_factory.h
+++ b/content/browser/appcache/appcache_subresource_url_factory.h
@@ -8,9 +8,9 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "url/gurl.h"
 
 namespace content {
@@ -23,7 +23,7 @@
 
 // Implements the URLLoaderFactory mojom for AppCache subresource requests.
 class CONTENT_EXPORT AppCacheSubresourceURLFactory
-    : public mojom::URLLoaderFactory {
+    : public network::mojom::URLLoaderFactory {
  public:
   ~AppCacheSubresourceURLFactory() override;
 
@@ -36,18 +36,18 @@
   static void CreateURLLoaderFactory(
       URLLoaderFactoryGetter* factory_getter,
       base::WeakPtr<AppCacheHost> host,
-      mojom::URLLoaderFactoryPtr* loader_factory);
+      network::mojom::URLLoaderFactoryPtr* loader_factory);
 
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest url_loader_request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest url_loader_request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
   base::WeakPtr<AppCacheSubresourceURLFactory> GetWeakPtr();
 
@@ -60,7 +60,7 @@
                                 base::WeakPtr<AppCacheHost> host);
   void OnConnectionError();
 
-  mojo::BindingSet<mojom::URLLoaderFactory> bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
   scoped_refptr<URLLoaderFactoryGetter> default_url_loader_factory_getter_;
   base::WeakPtr<AppCacheHost> appcache_host_;
   base::WeakPtrFactory<AppCacheSubresourceURLFactory> weak_factory_;
diff --git a/content/browser/appcache/appcache_unittest.cc b/content/browser/appcache/appcache_unittest.cc
index 45dca338..5fb6ea92 100644
--- a/content/browser/appcache/appcache_unittest.cc
+++ b/content/browser/appcache/appcache_unittest.cc
@@ -34,7 +34,7 @@
   void OnContentBlocked(int host_id, const GURL& manifest_url) override {}
   void OnSetSubresourceFactory(
       int host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) override {}
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
 };
 
 }  // namespace
diff --git a/content/browser/appcache/appcache_update_job_unittest.cc b/content/browser/appcache/appcache_update_job_unittest.cc
index 8c80c96..7f7d3af 100644
--- a/content/browser/appcache/appcache_update_job_unittest.cc
+++ b/content/browser/appcache/appcache_update_job_unittest.cc
@@ -29,8 +29,6 @@
 #include "content/browser/appcache/mock_appcache_service.h"
 #include "content/browser/url_loader_factory_getter.h"
 #include "content/public/common/content_features.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
@@ -42,6 +40,8 @@
 #include "net/url_request/url_request_job_factory_impl.h"
 #include "net/url_request/url_request_test_job.h"
 #include "net/url_request/url_request_test_util.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace content {
@@ -316,7 +316,7 @@
 
   void OnSetSubresourceFactory(
       int host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) override {}
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override {}
 
   void AddExpectedEvent(const std::vector<int>& host_ids,
       AppCacheEventID event_id) {
@@ -589,17 +589,17 @@
 // MockHttpServer and RetryRequestTestJob classes.
 // TODO(ananta/michaeln). Remove dependencies on URLRequest based
 // classes by refactoring the response headers/data into a common class.
-class MockURLLoaderFactory : public mojom::URLLoaderFactory {
+class MockURLLoaderFactory : public network::mojom::URLLoaderFactory {
  public:
   MockURLLoaderFactory() {}
 
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     if (url_request.url.host() == "failme" ||
@@ -636,7 +636,9 @@
     client->OnStartLoadingResponseBody(std::move(data_pipe.consumer_handle));
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest factory) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest factory) override {
+    NOTREACHED();
+  }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockURLLoaderFactory);
diff --git a/content/browser/appcache/appcache_update_url_loader_request.cc b/content/browser/appcache/appcache_update_url_loader_request.cc
index 60b124c..814400fb 100644
--- a/content/browser/appcache/appcache_update_url_loader_request.cc
+++ b/content/browser/appcache/appcache_update_url_loader_request.cc
@@ -18,13 +18,13 @@
   if (AppCacheRequestHandler::IsRunningInTests())
     return;
 
-  mojom::URLLoaderClientPtr client;
+  network::mojom::URLLoaderClientPtr client;
   client_binding_.Bind(mojo::MakeRequest(&client));
 
   DCHECK(loader_factory_getter_->GetNetworkFactory());
   loader_factory_getter_->GetNetworkFactory()->CreateLoaderAndStart(
-      mojo::MakeRequest(&url_loader_), -1, -1, mojom::kURLLoadOptionNone,
-      request_, std::move(client),
+      mojo::MakeRequest(&url_loader_), -1, -1,
+      network::mojom::kURLLoadOptionNone, request_, std::move(client),
       net::MutableNetworkTrafficAnnotationTag(GetTrafficAnnotation()));
 }
 
@@ -97,7 +97,7 @@
 void AppCacheUpdateJob::UpdateURLLoaderRequest::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   response_ = response_head;
 
   // TODO(ananta/michaeln)
diff --git a/content/browser/appcache/appcache_update_url_loader_request.h b/content/browser/appcache/appcache_update_url_loader_request.h
index bfdc0ad..54c267aa3 100644
--- a/content/browser/appcache/appcache_update_url_loader_request.h
+++ b/content/browser/appcache/appcache_update_url_loader_request.h
@@ -11,13 +11,13 @@
 
 #include "base/macros.h"
 #include "content/browser/appcache/appcache_update_request_base.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/simple_watcher.h"
 #include "net/base/io_buffer.h"
 #include "services/network/public/cpp/net_adapters.h"
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace net {
 class HttpResponseInfo;
@@ -32,7 +32,7 @@
 // network URL loader.
 class AppCacheUpdateJob::UpdateURLLoaderRequest
     : public AppCacheUpdateJob::UpdateRequestBase,
-      public mojom::URLLoaderClient {
+      public network::mojom::URLLoaderClient {
  public:
   ~UpdateURLLoaderRequest() override;
 
@@ -51,11 +51,12 @@
   void Read() override;
   int Cancel() override;
 
-  // mojom::URLLoaderClient implementation.
+  // network::mojom::URLLoaderClient implementation.
   // These methods are called by the network loader.
-  void OnReceiveResponse(const network::ResourceResponseHead& response_head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& response_head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(
       const net::RedirectInfo& redirect_info,
       const network::ResourceResponseHead& response_head) override;
@@ -96,9 +97,9 @@
   // Response details.
   std::unique_ptr<net::HttpResponseInfo> http_response_info_;
   // Binds the URLLoaderClient interface to the channel.
-  mojo::Binding<mojom::URLLoaderClient> client_binding_;
+  mojo::Binding<network::mojom::URLLoaderClient> client_binding_;
   // The network URL loader.
-  mojom::URLLoaderPtr url_loader_;
+  network::mojom::URLLoaderPtr url_loader_;
   // Caller buffer size.
   int buffer_size_;
   // The mojo data pipe.
diff --git a/content/browser/appcache/appcache_url_loader_job.cc b/content/browser/appcache/appcache_url_loader_job.cc
index b32b355..312c1c6 100644
--- a/content/browser/appcache/appcache_url_loader_job.cc
+++ b/content/browser/appcache/appcache_url_loader_job.cc
@@ -126,8 +126,8 @@
   delete this;
 }
 
-void AppCacheURLLoaderJob::Start(mojom::URLLoaderRequest request,
-                                 mojom::URLLoaderClientPtr client) {
+void AppCacheURLLoaderJob::Start(network::mojom::URLLoaderRequest request,
+                                 network::mojom::URLLoaderClientPtr client) {
   DCHECK(!binding_.is_bound());
   binding_.Bind(std::move(request));
   client_ = std::move(client);
@@ -284,7 +284,7 @@
   response_head.load_timing = load_timing_info_;
 
   client_->OnReceiveResponse(response_head, http_info->ssl_info,
-                             mojom::DownloadedTempFilePtr());
+                             network::mojom::DownloadedTempFilePtr());
   client_->OnStartLoadingResponseBody(std::move(data_pipe_.consumer_handle));
 }
 
diff --git a/content/browser/appcache/appcache_url_loader_job.h b/content/browser/appcache/appcache_url_loader_job.h
index 71d5d406..66f0747 100644
--- a/content/browser/appcache/appcache_url_loader_job.h
+++ b/content/browser/appcache/appcache_url_loader_job.h
@@ -17,9 +17,9 @@
 #include "content/browser/appcache/appcache_storage.h"
 #include "content/browser/loader/url_loader_request_handler.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace network {
 class NetToMojoPendingBuffer;
@@ -30,16 +30,17 @@
 class AppCacheRequest;
 class AppCacheURLLoaderRequest;
 
-// AppCacheJob wrapper for a mojom::URLLoader implementation which returns
-// responses stored in the AppCache.
+// AppCacheJob wrapper for a network::mojom::URLLoader implementation which
+// returns responses stored in the AppCache.
 class CONTENT_EXPORT AppCacheURLLoaderJob : public AppCacheJob,
                                             public AppCacheStorage::Delegate,
-                                            public mojom::URLLoader {
+                                            public network::mojom::URLLoader {
  public:
   ~AppCacheURLLoaderJob() override;
 
   // Sets up the bindings.
-  void Start(mojom::URLLoaderRequest request, mojom::URLLoaderClientPtr client);
+  void Start(network::mojom::URLLoaderRequest request,
+             network::mojom::URLLoaderClientPtr client);
 
   // AppCacheJob overrides.
   bool IsStarted() const override;
@@ -53,7 +54,7 @@
   base::WeakPtr<AppCacheJob> GetWeakPtr() override;
   base::WeakPtr<AppCacheURLLoaderJob> GetDerivedWeakPtr();
 
-  // mojom::URLLoader implementation:
+  // network::mojom::URLLoader implementation:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -106,11 +107,11 @@
   bool is_fallback_;
 
   // Binds the URLLoaderClient with us.
-  mojo::Binding<mojom::URLLoader> binding_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
 
   // The URLLoaderClient pointer. We call this interface with notifications
   // about the URL load
-  mojom::URLLoaderClientPtr client_;
+  network::mojom::URLLoaderClientPtr client_;
 
   // The data pipe used to transfer AppCache data to the client.
   mojo::DataPipe data_pipe_;
diff --git a/content/browser/bad_message.h b/content/browser/bad_message.h
index 4d08e3f..8cd32b4 100644
--- a/content/browser/bad_message.h
+++ b/content/browser/bad_message.h
@@ -219,6 +219,8 @@
   RDH_NULL_CLIENT = 192,
   RVH_WEB_UI_BINDINGS_MISMATCH = 193,
   WCI_NEW_WIDGET_PROCESS_MISMATCH = 194,
+  AUTH_INVALID_EFFECTIVE_DOMAIN = 195,
+  AUTH_INVALID_RELYING_PARTY = 196,
 
   // Please add new elements here. The naming convention is abbreviated class
   // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the
diff --git a/content/browser/blob_storage/blob_internals_url_loader.cc b/content/browser/blob_storage/blob_internals_url_loader.cc
index 8100336d..3068afd 100644
--- a/content/browser/blob_storage/blob_internals_url_loader.cc
+++ b/content/browser/blob_storage/blob_internals_url_loader.cc
@@ -12,7 +12,7 @@
 
 void StartBlobInternalsURLLoader(
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtrInfo client_info,
+    network::mojom::URLLoaderClientPtrInfo client_info,
     ChromeBlobStorageContext* blob_storage_context) {
   scoped_refptr<net::HttpResponseHeaders> headers(
       new net::HttpResponseHeaders("HTTP/1.1 200 OK"));
@@ -20,7 +20,7 @@
   resource_response.headers = headers;
   resource_response.mime_type = "text/html";
 
-  mojom::URLLoaderClientPtr client;
+  network::mojom::URLLoaderClientPtr client;
   client.Bind(std::move(client_info));
   client->OnReceiveResponse(resource_response, base::nullopt, nullptr);
 
diff --git a/content/browser/blob_storage/blob_internals_url_loader.h b/content/browser/blob_storage/blob_internals_url_loader.h
index e41bc5f2..903f567e 100644
--- a/content/browser/blob_storage/blob_internals_url_loader.h
+++ b/content/browser/blob_storage/blob_internals_url_loader.h
@@ -5,14 +5,14 @@
 #ifndef CONTENT_BROWSER_BLOB_STORAGE_BLOB_INTERNALS_URL_LOADER_H_
 #define CONTENT_BROWSER_BLOB_STORAGE_BLOB_INTERNALS_URL_LOADER_H_
 
-#include "content/public/common/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 class ChromeBlobStorageContext;
 
 void StartBlobInternalsURLLoader(
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtrInfo client_info,
+    network::mojom::URLLoaderClientPtrInfo client_info,
     ChromeBlobStorageContext* blob_storage_context);
 }  // namespace content
 
diff --git a/content/browser/blob_storage/blob_url_loader_factory.cc b/content/browser/blob_storage/blob_url_loader_factory.cc
index 01ad2f46..e3f67683 100644
--- a/content/browser/blob_storage/blob_url_loader_factory.cc
+++ b/content/browser/blob_storage/blob_url_loader_factory.cc
@@ -15,7 +15,6 @@
 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
 #include "content/browser/storage_partition_impl.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/system/simple_watcher.h"
 #include "net/base/io_buffer.h"
 #include "net/http/http_byte_range.h"
@@ -23,6 +22,7 @@
 #include "net/http/http_response_headers.h"
 #include "net/http/http_status_code.h"
 #include "net/http/http_util.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "storage/browser/blob/blob_data_handle.h"
 #include "storage/browser/blob/blob_reader.h"
 #include "storage/browser/blob/blob_storage_context.h"
@@ -39,11 +39,11 @@
 // method) when it has finished responding.
 // Note: some of this code is duplicated from storage::BlobURLRequestJob.
 class BlobURLLoader : public storage::MojoBlobReader::Delegate,
-                      public mojom::URLLoader {
+                      public network::mojom::URLLoader {
  public:
-  BlobURLLoader(mojom::URLLoaderRequest url_loader_request,
+  BlobURLLoader(network::mojom::URLLoaderRequest url_loader_request,
                 const network::ResourceRequest& request,
-                mojom::URLLoaderClientPtr client,
+                network::mojom::URLLoaderClientPtr client,
                 std::unique_ptr<storage::BlobDataHandle> blob_handle)
       : binding_(this, std::move(url_loader_request)),
         client_(std::move(client)),
@@ -96,7 +96,7 @@
                                     base::WrapUnique(this));
   }
 
-  // mojom::URLLoader implementation:
+  // network::mojom::URLLoader implementation:
   void FollowRedirect() override { NOTREACHED(); }
   void ProceedWithResponse() override { NOTREACHED(); }
 
@@ -194,8 +194,8 @@
     client_->OnComplete(status);
   }
 
-  mojo::Binding<mojom::URLLoader> binding_;
-  mojom::URLLoaderClientPtr client_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
+  network::mojom::URLLoaderClientPtr client_;
 
   bool byte_range_set_ = false;
   net::HttpByteRange byte_range_;
@@ -226,7 +226,7 @@
 }
 
 void BlobURLLoaderFactory::HandleRequest(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
                           base::BindOnce(&BlobURLLoaderFactory::BindOnIO, this,
@@ -242,7 +242,8 @@
   blob_storage_context_ = std::move(blob_storage_context_getter).Run();
 }
 
-void BlobURLLoaderFactory::BindOnIO(mojom::URLLoaderFactoryRequest request) {
+void BlobURLLoaderFactory::BindOnIO(
+    network::mojom::URLLoaderFactoryRequest request) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
   loader_factory_bindings_.AddBinding(this, std::move(request));
@@ -250,21 +251,21 @@
 
 // static
 void BlobURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderRequest loader,
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     std::unique_ptr<storage::BlobDataHandle> blob_handle) {
   new BlobURLLoader(std::move(loader), request, std::move(client),
                     std::move(blob_handle));
 }
 
 void BlobURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderRequest loader,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   std::unique_ptr<storage::BlobDataHandle> blob_handle;
@@ -275,7 +276,8 @@
                        std::move(blob_handle));
 }
 
-void BlobURLLoaderFactory::Clone(mojom::URLLoaderFactoryRequest request) {
+void BlobURLLoaderFactory::Clone(
+    network::mojom::URLLoaderFactoryRequest request) {
   loader_factory_bindings_.AddBinding(this, std::move(request));
 }
 
diff --git a/content/browser/blob_storage/blob_url_loader_factory.h b/content/browser/blob_storage/blob_url_loader_factory.h
index 3be06ed8..0b2bda9 100644
--- a/content/browser/blob_storage/blob_url_loader_factory.h
+++ b/content/browser/blob_storage/blob_url_loader_factory.h
@@ -10,8 +10,8 @@
 #include "base/memory/ref_counted.h"
 #include "content/common/content_export.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace storage {
 class BlobDataHandle;
@@ -25,7 +25,7 @@
 class BlobURLLoaderFactory
     : public base::RefCountedThreadSafe<BlobURLLoaderFactory,
                                         BrowserThread::DeleteOnIOThread>,
-      public mojom::URLLoaderFactory {
+      public network::mojom::URLLoaderFactory {
  public:
   using BlobContextGetter =
       base::OnceCallback<base::WeakPtr<storage::BlobStorageContext>()>;
@@ -35,28 +35,28 @@
 
   // Creates a URLLoaderFactory interface pointer for serving blob requests.
   // Called on the UI thread.
-  void HandleRequest(mojom::URLLoaderFactoryRequest request);
+  void HandleRequest(network::mojom::URLLoaderFactoryRequest request);
 
   // Creates a URLLoader for given Blob UUID. This method is supposed to
   // be called on the IO thread.
   // Note that given |request|'s URL is not referenced, but only method and
   // range headers are used.
   static void CreateLoaderAndStart(
-      mojom::URLLoaderRequest url_loader_request,
+      network::mojom::URLLoaderRequest url_loader_request,
       const network::ResourceRequest& request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       std::unique_ptr<storage::BlobDataHandle> blob_handle);
 
-  // mojom::URLLoaderFactory implementation:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest loader,
+  // network::mojom::URLLoaderFactory implementation:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest loader,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
  private:
   friend class base::DeleteHelper<BlobURLLoaderFactory>;
@@ -68,12 +68,12 @@
   ~BlobURLLoaderFactory() override;
 
   void InitializeOnIO(BlobContextGetter blob_storage_context_getter);
-  void BindOnIO(mojom::URLLoaderFactoryRequest request);
+  void BindOnIO(network::mojom::URLLoaderFactoryRequest request);
 
   base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
 
   // Used on the IO thread.
-  mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> loader_factory_bindings_;
 
   DISALLOW_COPY_AND_ASSIGN(BlobURLLoaderFactory);
 };
diff --git a/content/browser/blob_storage/blob_url_unittest.cc b/content/browser/blob_storage/blob_url_unittest.cc
index 94987e6..f0ae816 100644
--- a/content/browser/blob_storage/blob_url_unittest.cc
+++ b/content/browser/blob_storage/blob_url_unittest.cc
@@ -278,7 +278,7 @@
       request.method = method;
       request.headers = extra_headers;
 
-      mojom::URLLoaderPtr url_loader;
+      network::mojom::URLLoaderPtr url_loader;
       TestURLLoaderClient url_loader_client;
       scoped_refptr<BlobURLLoaderFactory> factory =
           BlobURLLoaderFactory::Create(
@@ -286,7 +286,7 @@
                              base::Unretained(this)));
       base::RunLoop().RunUntilIdle();
       factory->CreateLoaderAndStart(mojo::MakeRequest(&url_loader), 0, 0,
-                                    mojom::kURLLoadOptionNone, request,
+                                    network::mojom::kURLLoadOptionNone, request,
                                     url_loader_client.CreateInterfacePtr(),
                                     net::MutableNetworkTrafficAnnotationTag(
                                         TRAFFIC_ANNOTATION_FOR_TESTS));
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 7e4ae9f..7060093 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -935,7 +935,7 @@
   policy->AddIsolatedOrigins(SiteIsolationPolicy::GetIsolatedOrigins());
 
   // Record metrics about which site isolation flags have been turned on.
-  SiteIsolationPolicy::RecordSiteIsolationFlagUsage();
+  SiteIsolationPolicy::StartRecordingSiteIsolationFlagUsage();
 
   return result_code_;
 }
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h
index 8e61835..436c293e 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -228,6 +228,8 @@
   }
 #endif
 
+  BrowserMainParts* parts() { return parts_.get(); }
+
  private:
   FRIEND_TEST_ALL_PREFIXES(BrowserMainLoopTest, CreateThreadsInSingleProcess);
 
diff --git a/content/browser/browser_main_runner.cc b/content/browser/browser_main_runner.cc
index ab517fa..c59eecf 100644
--- a/content/browser/browser_main_runner.cc
+++ b/content/browser/browser_main_runner.cc
@@ -95,6 +95,11 @@
 
       main_loop_->Init();
 
+      if (parameters.created_main_parts_closure) {
+        parameters.created_main_parts_closure->Run(main_loop_->parts());
+        delete parameters.created_main_parts_closure;
+      }
+
       const int early_init_error_code = main_loop_->EarlyInitialization();
       if (early_init_error_code > 0)
         return early_init_error_code;
diff --git a/content/browser/browser_side_navigation_browsertest.cc b/content/browser/browser_side_navigation_browsertest.cc
index 9416f4c51..8dc7b80 100644
--- a/content/browser/browser_side_navigation_browsertest.cc
+++ b/content/browser/browser_side_navigation_browsertest.cc
@@ -209,8 +209,7 @@
   // Now navigate to an unreachable url.
   {
     TestNavigationObserver observer(shell()->web_contents());
-    GURL error_url(
-        net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_RESET));
+    GURL error_url(embedded_test_server()->GetURL("/close-socket"));
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         base::BindOnce(&net::URLRequestFailedJob::AddUrlHandler));
@@ -765,8 +764,7 @@
   // Now navigate to an unreachable url.
   {
     TestNavigationObserver observer(shell()->web_contents());
-    GURL error_url(
-        net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_RESET));
+    GURL error_url(embedded_test_server()->GetURL("/close-socket"));
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         base::BindOnce(&net::URLRequestFailedJob::AddUrlHandler));
diff --git a/content/browser/browsing_data/browsing_data_remover_impl_browsertest.cc b/content/browser/browsing_data/browsing_data_remover_impl_browsertest.cc
index f8209613..17499c5 100644
--- a/content/browser/browsing_data/browsing_data_remover_impl_browsertest.cc
+++ b/content/browser/browsing_data/browsing_data_remover_impl_browsertest.cc
@@ -128,7 +128,7 @@
     return false;
   }
 
-  mojom::URLLoaderFactory* url_loader_factory() {
+  network::mojom::URLLoaderFactory* url_loader_factory() {
     return BrowserContext::GetDefaultStoragePartition(
                shell()->web_contents()->GetBrowserContext())
         ->GetURLLoaderFactoryForBrowserProcess();
diff --git a/content/browser/devtools/devtools_agent_host_impl.h b/content/browser/devtools/devtools_agent_host_impl.h
index fdfe6a5..6105f50b 100644
--- a/content/browser/devtools/devtools_agent_host_impl.h
+++ b/content/browser/devtools/devtools_agent_host_impl.h
@@ -14,7 +14,6 @@
 #include "base/containers/flat_set.h"
 #include "content/browser/devtools/devtools_io_context.h"
 #include "content/common/content_export.h"
-#include "content/common/devtools_messages.h"
 #include "content/public/browser/certificate_request_result_type.h"
 #include "content/public/browser/devtools_agent_host.h"
 #include "third_party/WebKit/public/web/devtools_agent.mojom.h"
diff --git a/content/browser/devtools/devtools_session.cc b/content/browser/devtools/devtools_session.cc
index 6024975..85350239 100644
--- a/content/browser/devtools/devtools_session.cc
+++ b/content/browser/devtools/devtools_session.cc
@@ -143,38 +143,6 @@
     session_ptr_->InspectElement(point);
 }
 
-void DevToolsSession::ReceiveMessageChunk(const DevToolsMessageChunk& chunk) {
-  if (chunk.is_first) {
-    if (response_message_buffer_size_ != 0)
-      return;
-    if (chunk.is_last) {
-      response_message_buffer_size_ = chunk.data.size();
-    } else {
-      response_message_buffer_size_ = chunk.message_size;
-      response_message_buffer_.reserve(chunk.message_size);
-    }
-  }
-
-  if (response_message_buffer_.size() + chunk.data.size() >
-      response_message_buffer_size_)
-    return;
-  response_message_buffer_.append(chunk.data);
-
-  if (!chunk.is_last)
-    return;
-  if (response_message_buffer_.size() != response_message_buffer_size_)
-    return;
-
-  if (!chunk.post_state.empty())
-    state_cookie_ = chunk.post_state;
-  waiting_for_response_messages_.erase(chunk.call_id);
-  response_message_buffer_size_ = 0;
-  std::string message;
-  message.swap(response_message_buffer_);
-  client_->DispatchProtocolMessage(agent_host_, message);
-  // |this| may be deleted at this point.
-}
-
 void DevToolsSession::sendProtocolResponse(
     int call_id,
     std::unique_ptr<protocol::Serializable> message) {
diff --git a/content/browser/devtools/devtools_session.h b/content/browser/devtools/devtools_session.h
index 07aa4ea..5e1a9e2 100644
--- a/content/browser/devtools/devtools_session.h
+++ b/content/browser/devtools/devtools_session.h
@@ -52,7 +52,6 @@
                                       const std::string& method,
                                       const std::string& message);
   void InspectElement(const gfx::Point& point);
-  void ReceiveMessageChunk(const DevToolsMessageChunk& chunk);
 
   template <typename Handler>
   static std::vector<Handler*> HandlersForAgentHost(
@@ -102,7 +101,6 @@
   // any of the waiting for response messages have been handled.
   std::string state_cookie_;
   std::string response_message_buffer_;
-  uint32_t response_message_buffer_size_ = 0;
 
   base::WeakPtrFactory<DevToolsSession> weak_factory_;
 };
diff --git a/content/browser/devtools/shared_worker_devtools_agent_host.cc b/content/browser/devtools/shared_worker_devtools_agent_host.cc
index da465ba5..976ad36 100644
--- a/content/browser/devtools/shared_worker_devtools_agent_host.cc
+++ b/content/browser/devtools/shared_worker_devtools_agent_host.cc
@@ -143,7 +143,7 @@
   DCHECK_EQ(WORKER_READY, state_);
   DCHECK(worker_host_);
   if (!agent_ptr_)
-    worker_host_->GetDevToolsAgent(mojo::MakeRequest(&agent_ptr_));
+    worker_host_->BindDevToolsAgent(mojo::MakeRequest(&agent_ptr_));
   return agent_ptr_;
 }
 
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index a0898ce..11eb1d3 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -785,7 +785,7 @@
     std::vector<GURL> url_chain,
     const base::Optional<std::string>& suggested_filename,
     scoped_refptr<network::ResourceResponse> response,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     net::CertStatus cert_status,
     int frame_tree_node_id) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -1021,7 +1021,7 @@
     const base::Optional<std::string>& suggested_filename,
     scoped_refptr<network::ResourceResponse> response,
     net::CertStatus cert_status,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     bool is_download_allowed) {
   if (!is_download_allowed)
     return;
@@ -1045,7 +1045,7 @@
     const base::Optional<std::string>& suggested_filename,
     scoped_refptr<network::ResourceResponse> response,
     net::CertStatus cert_status,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
   std::unique_ptr<ResourceDownloader> resource_downloader =
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index da09a68..a4b9830a 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -30,6 +30,7 @@
 #include "content/public/browser/download_url_parameters.h"
 #include "content/public/browser/ssl_status.h"
 #include "services/metrics/public/cpp/ukm_source_id.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 class DownloadFileFactory;
@@ -147,7 +148,7 @@
       std::vector<GURL> url_chain,
       const base::Optional<std::string>& suggested_filename,
       scoped_refptr<network::ResourceResponse> response,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       net::CertStatus cert_status,
       int frame_tree_node_id);
 
@@ -223,7 +224,7 @@
       const base::Optional<std::string>& suggested_filename,
       scoped_refptr<network::ResourceResponse> response,
       net::CertStatus cert_status,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       bool is_download_allowed);
 
   // Called when a navigation turns to be a download. Create a new
@@ -237,7 +238,7 @@
       const base::Optional<std::string>& suggested_filename,
       scoped_refptr<network::ResourceResponse> response,
       net::CertStatus cert_status,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
 
   // Factory for creation of downloads items.
   std::unique_ptr<DownloadItemFactory> item_factory_;
diff --git a/content/browser/download/download_response_handler.cc b/content/browser/download/download_response_handler.cc
index 533b690..d2d198a 100644
--- a/content/browser/download/download_response_handler.cc
+++ b/content/browser/download/download_response_handler.cc
@@ -79,7 +79,7 @@
 void DownloadResponseHandler::OnReceiveResponse(
     const network::ResourceResponseHead& head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   create_info_ = CreateDownloadCreateInfo(head);
 
   if (ssl_info)
diff --git a/content/browser/download/download_response_handler.h b/content/browser/download/download_response_handler.h
index 73360c03..7f608bc8 100644
--- a/content/browser/download/download_response_handler.h
+++ b/content/browser/download/download_response_handler.h
@@ -11,9 +11,9 @@
 #include "content/public/browser/download_source.h"
 #include "content/public/common/download_stream.mojom.h"
 #include "content/public/common/referrer.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "net/cert/cert_status_flags.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
@@ -24,7 +24,7 @@
 // It passes the DataPipeConsumerHandle and completion status to the download
 // sink. The class is common to both navigation triggered downloads and
 // context menu downloads
-class DownloadResponseHandler : public mojom::URLLoaderClient {
+class DownloadResponseHandler : public network::mojom::URLLoaderClient {
  public:
   // Class for handling the stream once response starts.
   class Delegate {
@@ -45,10 +45,11 @@
                           std::vector<GURL> url_chain);
   ~DownloadResponseHandler() override;
 
-  // mojom::URLLoaderClient
-  void OnReceiveResponse(const network::ResourceResponseHead& head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  // network::mojom::URLLoaderClient
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
                          const network::ResourceResponseHead& head) override;
   void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override;
diff --git a/content/browser/download/resource_downloader.cc b/content/browser/download/resource_downloader.cc
index 443dd26..b3a28d9 100644
--- a/content/browser/download/resource_downloader.cc
+++ b/content/browser/download/resource_downloader.cc
@@ -21,18 +21,18 @@
 
 // This object monitors the URLLoaderCompletionStatus change when
 // ResourceDownloader is asking |delegate_| whether download can proceed.
-class URLLoaderStatusMonitor : public mojom::URLLoaderClient {
+class URLLoaderStatusMonitor : public network::mojom::URLLoaderClient {
  public:
   using URLLoaderStatusChangeCallback =
       base::OnceCallback<void(const network::URLLoaderCompletionStatus&)>;
   explicit URLLoaderStatusMonitor(URLLoaderStatusChangeCallback callback);
   ~URLLoaderStatusMonitor() override = default;
 
-  // mojom::URLLoaderClient
+  // network::mojom::URLLoaderClient
   void OnReceiveResponse(
       const network::ResourceResponseHead& head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {}
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {}
   void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
                          const network::ResourceResponseHead& head) override {}
   void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override {}
@@ -115,7 +115,7 @@
     const base::Optional<std::string>& suggested_filename,
     const scoped_refptr<network::ResourceResponse>& response,
     net::CertStatus cert_status,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
   auto downloader = std::make_unique<ResourceDownloader>(
       delegate, std::move(resource_request), web_contents_getter, GURL(),
       GURL(), GURL(), DownloadItem::kInvalidId);
@@ -161,13 +161,14 @@
       download_url_parameters->fetch_error_body(),
       download_url_parameters->download_source(),
       std::vector<GURL>(1, resource_request_->url));
-  mojom::URLLoaderClientPtr url_loader_client_ptr;
+  network::mojom::URLLoaderClientPtr url_loader_client_ptr;
   url_loader_client_binding_ =
-      std::make_unique<mojo::Binding<mojom::URLLoaderClient>>(
+      std::make_unique<mojo::Binding<network::mojom::URLLoaderClient>>(
           url_loader_client_.get(), mojo::MakeRequest(&url_loader_client_ptr));
 
   // Set up the URLLoader
-  mojom::URLLoaderRequest url_loader_request = mojo::MakeRequest(&url_loader_);
+  network::mojom::URLLoaderRequest url_loader_request =
+      mojo::MakeRequest(&url_loader_);
   if (download_url_parameters->url().SchemeIs(url::kBlobScheme)) {
     BlobURLLoaderFactory::CreateLoaderAndStart(
         std::move(url_loader_request), *(resource_request_.get()),
@@ -178,7 +179,7 @@
         std::move(url_loader_request),
         0,  // routing_id
         0,  // request_id
-        mojom::kURLLoadOptionSendSSLInfoWithResponse,
+        network::mojom::kURLLoadOptionSendSSLInfoWithResponse,
         *(resource_request_.get()), std::move(url_loader_client_ptr),
         net::MutableNetworkTrafficAnnotationTag(
             download_url_parameters->GetNetworkTrafficAnnotation()));
@@ -192,7 +193,7 @@
     std::vector<GURL> url_chain,
     const base::Optional<std::string>& suggested_filename,
     net::CertStatus cert_status,
-    mojom::URLLoaderClientEndpointsPtr endpoints) {
+    network::mojom::URLLoaderClientEndpointsPtr endpoints) {
   // Set the URLLoader.
   url_loader_.Bind(std::move(endpoints->url_loader));
 
@@ -207,13 +208,13 @@
   // Simulate on the new URLLoaderClient calls that happened on the old client.
   net::SSLInfo info;
   info.cert_status = cert_status;
-  url_loader_client_->OnReceiveResponse(response->head,
-                                        base::Optional<net::SSLInfo>(info),
-                                        mojom::DownloadedTempFilePtr());
+  url_loader_client_->OnReceiveResponse(
+      response->head, base::Optional<net::SSLInfo>(info),
+      network::mojom::DownloadedTempFilePtr());
 
   // Bind the new client.
   url_loader_client_binding_ =
-      std::make_unique<mojo::Binding<mojom::URLLoaderClient>>(
+      std::make_unique<mojo::Binding<network::mojom::URLLoaderClient>>(
           url_loader_client_.get(), std::move(endpoints->url_loader_client));
 }
 
diff --git a/content/browser/download/resource_downloader.h b/content/browser/download/resource_downloader.h
index 0adfb461..62f4202 100644
--- a/content/browser/download/resource_downloader.h
+++ b/content/browser/download/resource_downloader.h
@@ -10,9 +10,9 @@
 #include "content/browser/url_loader_factory_getter.h"
 #include "content/public/browser/resource_request_info.h"
 #include "content/public/browser/ssl_status.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace storage {
 class FileSystemContext;
@@ -49,7 +49,7 @@
       const base::Optional<std::string>& suggested_filename,
       const scoped_refptr<network::ResourceResponse>& response,
       net::CertStatus cert_status,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
 
   ResourceDownloader(
       base::WeakPtr<UrlDownloadHandler::Delegate> delegate,
@@ -80,7 +80,7 @@
       std::vector<GURL> url_chain,
       const base::Optional<std::string>& suggested_filename,
       net::CertStatus cert_status,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
 
   base::WeakPtr<UrlDownloadHandler::Delegate> delegate_;
 
@@ -88,14 +88,14 @@
   std::unique_ptr<network::ResourceRequest> resource_request_;
 
   // Object that will handle the response.
-  std::unique_ptr<mojom::URLLoaderClient> url_loader_client_;
+  std::unique_ptr<network::mojom::URLLoaderClient> url_loader_client_;
 
   // URLLoaderClient binding. It sends any requests to the |url_loader_client_|.
-  std::unique_ptr<mojo::Binding<mojom::URLLoaderClient>>
+  std::unique_ptr<mojo::Binding<network::mojom::URLLoaderClient>>
       url_loader_client_binding_;
 
   // URLLoader for sending out the request.
-  mojom::URLLoaderPtr url_loader_;
+  network::mojom::URLLoaderPtr url_loader_;
 
   // ID of the download, or DownloadItem::kInvalidId if this is a new
   // download.
diff --git a/content/browser/file_url_loader_factory.cc b/content/browser/file_url_loader_factory.cc
index e9d81d9..7632bc5 100644
--- a/content/browser/file_url_loader_factory.cc
+++ b/content/browser/file_url_loader_factory.cc
@@ -23,7 +23,6 @@
 #include "build/build_config.h"
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/file_url_loader.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "mojo/public/cpp/system/file_data_pipe_producer.h"
@@ -38,6 +37,7 @@
 #include "net/http/http_util.h"
 #include "net/url_request/redirect_info.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "storage/common/fileapi/file_system_util.h"
 #include "url/gurl.h"
 
@@ -85,13 +85,13 @@
 };
 
 class FileURLDirectoryLoader
-    : public mojom::URLLoader,
+    : public network::mojom::URLLoader,
       public net::DirectoryLister::DirectoryListerDelegate {
  public:
   static void CreateAndStart(const base::FilePath& profile_path,
                              const network::ResourceRequest& request,
-                             mojom::URLLoaderRequest loader,
-                             mojom::URLLoaderClientPtrInfo client_info,
+                             network::mojom::URLLoaderRequest loader,
+                             network::mojom::URLLoaderClientPtrInfo client_info,
                              std::unique_ptr<FileURLLoaderObserver> observer) {
     // Owns itself. Will live as long as its URLLoader and URLLoaderClientPtr
     // bindings are alive - essentially until either the client gives up or all
@@ -101,7 +101,7 @@
                            std::move(client_info), std::move(observer));
   }
 
-  // mojom::URLLoader:
+  // network::mojom::URLLoader:
   void FollowRedirect() override {}
   void ProceedWithResponse() override { NOTREACHED(); }
   void SetPriority(net::RequestPriority priority,
@@ -115,14 +115,14 @@
 
   void Start(const base::FilePath& profile_path,
              const network::ResourceRequest& request,
-             mojom::URLLoaderRequest loader,
-             mojom::URLLoaderClientPtrInfo client_info,
+             network::mojom::URLLoaderRequest loader,
+             network::mojom::URLLoaderClientPtrInfo client_info,
              std::unique_ptr<content::FileURLLoaderObserver> observer) {
     binding_.Bind(std::move(loader));
     binding_.set_connection_error_handler(base::BindOnce(
         &FileURLDirectoryLoader::OnConnectionError, base::Unretained(this)));
 
-    mojom::URLLoaderClientPtr client;
+    network::mojom::URLLoaderClientPtr client;
     client.Bind(std::move(client_info));
 
     if (!net::FileURLToFilePath(request.url, &path_)) {
@@ -274,8 +274,8 @@
   bool wrote_header_ = false;
   int listing_result_;
 
-  mojo::Binding<mojom::URLLoader> binding_;
-  mojom::URLLoaderClientPtr client_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
+  network::mojom::URLLoaderClientPtr client_;
 
   std::unique_ptr<mojo::StringDataPipeProducer> data_producer_;
   std::string pending_data_;
@@ -284,12 +284,12 @@
   DISALLOW_COPY_AND_ASSIGN(FileURLDirectoryLoader);
 };
 
-class FileURLLoader : public mojom::URLLoader {
+class FileURLLoader : public network::mojom::URLLoader {
  public:
   static void CreateAndStart(const base::FilePath& profile_path,
                              const network::ResourceRequest& request,
-                             mojom::URLLoaderRequest loader,
-                             mojom::URLLoaderClientPtrInfo client_info,
+                             network::mojom::URLLoaderRequest loader,
+                             network::mojom::URLLoaderClientPtrInfo client_info,
                              DirectoryLoadingPolicy directory_loading_policy,
                              FileAccessPolicy file_access_policy,
                              LinkFollowingPolicy link_following_policy,
@@ -304,7 +304,7 @@
                            std::move(observer));
   }
 
-  // mojom::URLLoader:
+  // network::mojom::URLLoader:
   void FollowRedirect() override {}
   void ProceedWithResponse() override {}
   void SetPriority(net::RequestPriority priority,
@@ -318,8 +318,8 @@
 
   void Start(const base::FilePath& profile_path,
              const network::ResourceRequest& request,
-             mojom::URLLoaderRequest loader,
-             mojom::URLLoaderClientPtrInfo client_info,
+             network::mojom::URLLoaderRequest loader,
+             network::mojom::URLLoaderClientPtrInfo client_info,
              DirectoryLoadingPolicy directory_loading_policy,
              FileAccessPolicy file_access_policy,
              LinkFollowingPolicy link_following_policy,
@@ -331,7 +331,7 @@
     binding_.set_connection_error_handler(base::BindOnce(
         &FileURLLoader::OnConnectionError, base::Unretained(this)));
 
-    mojom::URLLoaderClientPtr client;
+    network::mojom::URLLoaderClientPtr client;
     client.Bind(std::move(client_info));
 
     base::FilePath path;
@@ -578,8 +578,8 @@
   }
 
   std::unique_ptr<mojo::FileDataPipeProducer> data_producer_;
-  mojo::Binding<mojom::URLLoader> binding_;
-  mojom::URLLoaderClientPtr client_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
+  network::mojom::URLLoaderClientPtr client_;
 
   DISALLOW_COPY_AND_ASSIGN(FileURLLoader);
 };
@@ -594,12 +594,12 @@
 FileURLLoaderFactory::~FileURLLoaderFactory() = default;
 
 void FileURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderRequest loader,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   base::FilePath file_path;
   const bool is_file = net::FileURLToFilePath(request.url, &file_path);
@@ -621,13 +621,14 @@
   }
 }
 
-void FileURLLoaderFactory::Clone(mojom::URLLoaderFactoryRequest loader) {
+void FileURLLoaderFactory::Clone(
+    network::mojom::URLLoaderFactoryRequest loader) {
   bindings_.AddBinding(this, std::move(loader));
 }
 
 void CreateFileURLLoader(const network::ResourceRequest& request,
-                         mojom::URLLoaderRequest loader,
-                         mojom::URLLoaderClientPtr client,
+                         network::mojom::URLLoaderRequest loader,
+                         network::mojom::URLLoaderClientPtr client,
                          std::unique_ptr<FileURLLoaderObserver> observer) {
   auto task_runner = base::CreateSequencedTaskRunnerWithTraits(
       {base::MayBlock(), base::TaskPriority::BACKGROUND,
diff --git a/content/browser/file_url_loader_factory.h b/content/browser/file_url_loader_factory.h
index 65065cd..bf90783 100644
--- a/content/browser/file_url_loader_factory.h
+++ b/content/browser/file_url_loader_factory.h
@@ -10,14 +10,15 @@
 #include "base/memory/ref_counted.h"
 #include "base/sequenced_task_runner.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
 // A URLLoaderFactory used for the file:// scheme used when Network Service is
 // enabled.
-class CONTENT_EXPORT FileURLLoaderFactory : public mojom::URLLoaderFactory {
+class CONTENT_EXPORT FileURLLoaderFactory
+    : public network::mojom::URLLoaderFactory {
  public:
   // SequencedTaskRunner must be allowed to block and should have background
   // priority since it will be used to schedule synchronous file I/O tasks.
@@ -26,20 +27,20 @@
   ~FileURLLoaderFactory() override;
 
  private:
-  // mojom::URLLoaderFactory:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest loader,
+  // network::mojom::URLLoaderFactory:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest loader,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest loader) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest loader) override;
 
   const base::FilePath profile_path_;
   const scoped_refptr<base::SequencedTaskRunner> task_runner_;
-  mojo::BindingSet<mojom::URLLoaderFactory> bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
 
   DISALLOW_COPY_AND_ASSIGN(FileURLLoaderFactory);
 };
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index 2bcb7df..f820882 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -975,8 +975,7 @@
 IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
                        ErrorPageReplacement) {
   NavigationController& controller = shell()->web_contents()->GetController();
-  GURL error_url(
-      net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_RESET));
+  GURL error_url = embedded_test_server()->GetURL("/close-socket");
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
       base::BindOnce(&net::URLRequestFailedJob::AddUrlHandler));
diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc
index 94300b5..c95328e 100644
--- a/content/browser/frame_host/navigation_entry_impl.cc
+++ b/content/browser/frame_host/navigation_entry_impl.cc
@@ -709,7 +709,6 @@
     const std::string& original_method,
     bool is_history_navigation_in_new_child,
     const std::map<std::string, bool>& subframe_unique_names,
-    bool has_committed_real_load,
     bool intended_as_new_entry,
     int pending_history_list_offset,
     int current_history_list_offset,
@@ -737,9 +736,8 @@
       GetIsOverridingUserAgent(), redirects, original_url, original_method,
       GetCanLoadLocalResources(), frame_entry.page_state(), GetUniqueID(),
       is_history_navigation_in_new_child, subframe_unique_names,
-      has_committed_real_load, intended_as_new_entry, pending_offset_to_send,
-      current_offset_to_send, current_length_to_send, IsViewSourceMode(),
-      should_clear_history_list());
+      intended_as_new_entry, pending_offset_to_send, current_offset_to_send,
+      current_length_to_send, IsViewSourceMode(), should_clear_history_list());
 #if defined(OS_ANDROID)
   if (GetDataURLAsString() &&
       GetDataURLAsString()->size() <= kMaxLengthOfDataURLString) {
diff --git a/content/browser/frame_host/navigation_entry_impl.h b/content/browser/frame_host/navigation_entry_impl.h
index a37aa00..cece16c 100644
--- a/content/browser/frame_host/navigation_entry_impl.h
+++ b/content/browser/frame_host/navigation_entry_impl.h
@@ -192,7 +192,6 @@
       const std::string& original_method,
       bool is_history_navigation_in_new_child,
       const std::map<std::string, bool>& subframe_unique_names,
-      bool has_committed_real_load,
       bool intended_as_new_entry,
       int pending_offset_to_send,
       int current_offset_to_send,
diff --git a/content/browser/frame_host/navigation_handle_impl_browsertest.cc b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
index 1e14bfc..b3f66516fe 100644
--- a/content/browser/frame_host/navigation_handle_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_handle_impl_browsertest.cc
@@ -1726,8 +1726,7 @@
   ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL start_url(embedded_test_server()->GetURL("foo.com", "/title1.html"));
-  GURL error_url(
-      net::URLRequestFailedJob::GetMockHttpUrl(net::ERR_CONNECTION_RESET));
+  GURL error_url(embedded_test_server()->GetURL("/close-socket"));
   EXPECT_NE(start_url.host(), error_url.host());
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
index 1e76568..ac20cab5b 100644
--- a/content/browser/frame_host/navigation_request.cc
+++ b/content/browser/frame_host/navigation_request.cc
@@ -255,7 +255,6 @@
           frame_entry, common_params.url, common_params.method,
           is_history_navigation_in_new_child,
           entry.GetSubframeUniqueNames(frame_tree_node),
-          frame_tree_node->has_committed_real_load(),
           controller->GetPendingEntryIndex() == -1,
           controller->GetIndexOfEntry(&entry),
           controller->GetLastCommittedEntryIndex(),
@@ -310,7 +309,6 @@
       0,                              // nav_entry_id
       false,                          // is_history_navigation_in_new_child
       std::map<std::string, bool>(),  // subframe_unique_names
-      frame_tree_node->has_committed_real_load(),
       false,  // intended_as_new_entry
       -1,     // |pending_history_list_offset| is set to -1 because
               // history-navigations do not use this path. See comments above.
@@ -735,7 +733,7 @@
 
 void NavigationRequest::OnResponseStarted(
     const scoped_refptr<network::ResourceResponse>& response,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     std::unique_ptr<StreamHandle> body,
     const net::SSLInfo& ssl_info,
     std::unique_ptr<NavigationData> navigation_data,
@@ -1195,7 +1193,7 @@
         // |url_loader_client_endpoints_| is always valid, except in some tests
         // where the TestNavigationLoader is used.
         if (url_loader_client_endpoints_) {
-          mojom::URLLoaderPtr url_loader(
+          network::mojom::URLLoaderPtr url_loader(
               std::move(url_loader_client_endpoints_->url_loader));
           url_loader->ProceedWithResponse();
           url_loader_client_endpoints_->url_loader = url_loader.PassInterface();
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h
index 2fa830c..f0a832b 100644
--- a/content/browser/frame_host/navigation_request.h
+++ b/content/browser/frame_host/navigation_request.h
@@ -226,7 +226,7 @@
       const scoped_refptr<network::ResourceResponse>& response) override;
   void OnResponseStarted(
       const scoped_refptr<network::ResourceResponse>& response,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       std::unique_ptr<StreamHandle> body,
       const net::SSLInfo& ssl_info,
       std::unique_ptr<NavigationData> navigation_data,
@@ -357,7 +357,7 @@
   // NavigationMojoResponse is enabled. Otherwise the StreamHandle is used.
   scoped_refptr<network::ResourceResponse> response_;
   std::unique_ptr<StreamHandle> body_;
-  mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints_;
+  network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints_;
   net::SSLInfo ssl_info_;
   bool is_download_;
 
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc
index c5c23067..e327ed6 100644
--- a/content/browser/frame_host/navigator_impl.cc
+++ b/content/browser/frame_host/navigator_impl.cc
@@ -41,10 +41,10 @@
 #include "content/public/common/bindings_policy.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_constants.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/common/url_utils.h"
 #include "net/base/net_errors.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "url/gurl.h"
 #include "url/url_util.h"
 
@@ -1043,7 +1043,7 @@
         render_frame_host);
     render_frame_host->CommitNavigation(
         nullptr,  // response
-        mojom::URLLoaderClientEndpointsPtr(),
+        network::mojom::URLLoaderClientEndpointsPtr(),
         nullptr,  // body
         scoped_request->common_params(), scoped_request->request_params(),
         scoped_request->is_view_source(), base::nullopt,
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 96cc54a..f576c78 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -921,6 +921,8 @@
     IPC_MESSAGE_HANDLER(FrameHostMsg_DidBlockFramebust, OnDidBlockFramebust)
     IPC_MESSAGE_HANDLER(FrameHostMsg_AbortNavigation, OnAbortNavigation)
     IPC_MESSAGE_HANDLER(FrameHostMsg_DispatchLoad, OnDispatchLoad)
+    IPC_MESSAGE_HANDLER(FrameHostMsg_ForwardResourceTimingToParent,
+                        OnForwardResourceTimingToParent)
     IPC_MESSAGE_HANDLER(FrameHostMsg_TextSurroundingSelectionResponse,
                         OnTextSurroundingSelectionResponse)
     IPC_MESSAGE_HANDLER(AccessibilityHostMsg_Events, OnAccessibilityEvents)
@@ -1180,6 +1182,9 @@
   params->frame_owner_properties =
       FrameOwnerProperties(frame_tree_node()->frame_owner_properties());
 
+  params->has_committed_real_load =
+      frame_tree_node()->has_committed_real_load();
+
   params->widget_params = mojom::CreateFrameWidgetParams::New();
   if (render_widget_host_) {
     params->widget_params->routing_id = render_widget_host_->GetRoutingID();
@@ -2393,13 +2398,32 @@
   frame_tree_node()->navigator()->OnAbortNavigation(frame_tree_node());
 }
 
+void RenderFrameHostImpl::OnForwardResourceTimingToParent(
+    const ResourceTimingInfo& resource_timing) {
+  // Don't forward the resource timing if this RFH is pending deletion. This can
+  // happen in a race where this RenderFrameHost finishes loading just after
+  // the frame navigates away. See https://crbug.com/626802.
+  if (!is_active())
+    return;
+
+  RenderFrameProxyHost* proxy =
+      frame_tree_node()->render_manager()->GetProxyToParent();
+  if (!proxy) {
+    bad_message::ReceivedBadMessage(GetProcess(),
+                                    bad_message::RFH_NO_PROXY_TO_PARENT);
+    return;
+  }
+  proxy->Send(new FrameMsg_ForwardResourceTimingToParent(proxy->GetRoutingID(),
+                                                         resource_timing));
+}
+
 void RenderFrameHostImpl::OnDispatchLoad() {
   TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnDispatchLoad",
                "frame_tree_node", frame_tree_node_->frame_tree_node_id());
 
-  // Don't forward the load event if this RFH is pending deletion.  This can
+  // Don't forward the load event if this RFH is pending deletion. This can
   // happen in a race where this RenderFrameHost finishes loading just after
-  // the frame navigates away.  See https://crbug.com/626802.
+  // the frame navigates away. See https://crbug.com/626802.
   if (!is_active())
     return;
 
@@ -3282,7 +3306,7 @@
       base::Optional<SourceLocation>(),
       CSPDisposition::CHECK /* should_check_main_world_csp */,
       false /* started_from_context_menu */, false /* has_user_gesture */);
-  CommitNavigation(nullptr, mojom::URLLoaderClientEndpointsPtr(),
+  CommitNavigation(nullptr, network::mojom::URLLoaderClientEndpointsPtr(),
                    std::unique_ptr<StreamHandle>(), common_params,
                    RequestNavigationParams(), false, base::nullopt,
                    base::UnguessableToken::Create() /* not traced */);
@@ -3427,7 +3451,7 @@
 
 void RenderFrameHostImpl::CommitNavigation(
     network::ResourceResponse* response,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     std::unique_ptr<StreamHandle> body,
     const CommonNavigationParams& common_params,
     const RequestNavigationParams& request_params,
@@ -3456,7 +3480,7 @@
     DCHECK(!url_loader_client_endpoints && !body);
     GetNavigationControl()->CommitNavigation(
         network::ResourceResponseHead(), GURL(), common_params, request_params,
-        mojom::URLLoaderClientEndpointsPtr(),
+        network::mojom::URLLoaderClientEndpointsPtr(),
         /*subresource_loader_factories=*/base::nullopt,
         /*controller_service_worker=*/nullptr, devtools_navigation_token);
     return;
@@ -3490,7 +3514,7 @@
     // given everything it will need to load any accessible subresources. We
     // however only do this for cross-document navigations, because the
     // alternative would be redundant effort.
-    mojom::URLLoaderFactoryPtr default_factory;
+    network::mojom::URLLoaderFactoryPtr default_factory;
     StoragePartitionImpl* storage_partition =
         static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
             GetSiteInstance()->GetBrowserContext(), GetSiteInstance()));
@@ -3504,7 +3528,7 @@
       std::string scheme = common_params.url.scheme();
       const auto& schemes = URLDataManagerBackend::GetWebUISchemes();
       if (std::find(schemes.begin(), schemes.end(), scheme) != schemes.end()) {
-        mojom::URLLoaderFactoryPtr factory_for_webui =
+        network::mojom::URLLoaderFactoryPtr factory_for_webui =
             CreateWebUIURLLoader(this, scheme);
         if (enabled_bindings_ & BINDINGS_POLICY_WEB_UI) {
           // If the renderer has webui bindings, then don't give it access to
@@ -3526,7 +3550,7 @@
         storage_partition->GetNetworkContext()->CreateURLLoaderFactory(
             mojo::MakeRequest(&default_factory), GetProcess()->GetID());
       } else {
-        mojom::URLLoaderFactoryPtr original_factory;
+        network::mojom::URLLoaderFactoryPtr original_factory;
         storage_partition->GetNetworkContext()->CreateURLLoaderFactory(
             mojo::MakeRequest(&original_factory), GetProcess()->GetID());
         g_url_loader_factory_callback_for_test.Get().Run(
@@ -3539,7 +3563,7 @@
     subresource_loader_factories->SetDefaultFactory(std::move(default_factory));
 
     // Everyone gets a blob loader.
-    mojom::URLLoaderFactoryPtr blob_factory;
+    network::mojom::URLLoaderFactoryPtr blob_factory;
     storage_partition->GetBlobURLLoaderFactory()->HandleRequest(
         mojo::MakeRequest(&blob_factory));
     subresource_loader_factories->RegisterFactory(url::kBlobScheme,
@@ -3564,7 +3588,7 @@
             this, common_params.url, &non_network_url_loader_factories_);
 
     for (auto& factory : non_network_url_loader_factories_) {
-      mojom::URLLoaderFactoryPtr factory_proxy;
+      network::mojom::URLLoaderFactoryPtr factory_proxy;
       factory.second->Clone(mojo::MakeRequest(&factory_proxy));
       subresource_loader_factories->RegisterFactory(factory.first,
                                                     std::move(factory_proxy));
@@ -3632,12 +3656,12 @@
       static_cast<StoragePartitionImpl*>(BrowserContext::GetStoragePartition(
           GetSiteInstance()->GetBrowserContext(), GetSiteInstance()));
 
-  mojom::URLLoaderFactoryPtr default_factory;
+  network::mojom::URLLoaderFactoryPtr default_factory;
   if (g_url_loader_factory_callback_for_test.Get().is_null()) {
     storage_partition->GetNetworkContext()->CreateURLLoaderFactory(
         mojo::MakeRequest(&default_factory), GetProcess()->GetID());
   } else {
-    mojom::URLLoaderFactoryPtr original_factory;
+    network::mojom::URLLoaderFactoryPtr original_factory;
     storage_partition->GetNetworkContext()->CreateURLLoaderFactory(
         mojo::MakeRequest(&original_factory), GetProcess()->GetID());
     g_url_loader_factory_callback_for_test.Get().Run(
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index 7ab45fca3..fee62ff 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -137,6 +137,7 @@
 struct FileChooserParams;
 struct FrameOwnerProperties;
 struct RequestNavigationParams;
+struct ResourceTimingInfo;
 struct SubresourceLoaderParams;
 
 class CONTENT_EXPORT RenderFrameHostImpl
@@ -167,10 +168,10 @@
   // Passing a null callback will restore the default behavior.
   // This method must be called either on the UI thread or before threads start.
   // This callback is run on the UI thread.
-  using CreateNetworkFactoryCallback =
-      base::Callback<void(mojom::URLLoaderFactoryRequest request,
-                          int process_id,
-                          mojom::URLLoaderFactoryPtrInfo original_factory)>;
+  using CreateNetworkFactoryCallback = base::Callback<void(
+      network::mojom::URLLoaderFactoryRequest request,
+      int process_id,
+      network::mojom::URLLoaderFactoryPtrInfo original_factory)>;
   static void SetNetworkFactoryForTesting(
       const CreateNetworkFactoryCallback& url_loader_factory_callback);
 
@@ -540,7 +541,7 @@
   // process, e.g. by AppCache etc.
   void CommitNavigation(
       network::ResourceResponse* response,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       std::unique_ptr<StreamHandle> body,
       const CommonNavigationParams& common_params,
       const RequestNavigationParams& request_params,
@@ -781,6 +782,8 @@
                      blink::WebTextDirection title_direction);
   void OnDidBlockFramebust(const GURL& url);
   void OnAbortNavigation();
+  void OnForwardResourceTimingToParent(
+      const ResourceTimingInfo& resource_timing);
   void OnDispatchLoad();
   void OnAccessibilityEvents(
       const std::vector<AccessibilityHostMsg_EventParams>& params,
diff --git a/content/browser/histogram_internals_url_loader.cc b/content/browser/histogram_internals_url_loader.cc
index fed50f3..fa8e3a0 100644
--- a/content/browser/histogram_internals_url_loader.cc
+++ b/content/browser/histogram_internals_url_loader.cc
@@ -11,8 +11,9 @@
 
 namespace content {
 
-void StartHistogramInternalsURLLoader(const network::ResourceRequest& request,
-                                      mojom::URLLoaderClientPtr client) {
+void StartHistogramInternalsURLLoader(
+    const network::ResourceRequest& request,
+    network::mojom::URLLoaderClientPtr client) {
   scoped_refptr<net::HttpResponseHeaders> headers(
       new net::HttpResponseHeaders("HTTP/1.1 200 OK"));
   network::ResourceResponseHead resource_response;
diff --git a/content/browser/histogram_internals_url_loader.h b/content/browser/histogram_internals_url_loader.h
index e868191..3691b88 100644
--- a/content/browser/histogram_internals_url_loader.h
+++ b/content/browser/histogram_internals_url_loader.h
@@ -5,13 +5,14 @@
 #ifndef CONTENT_BROWSER_HISTOGRAM_INTERNALS_URL_LOADER_H_
 #define CONTENT_BROWSER_HISTOGRAM_INTERNALS_URL_LOADER_H_
 
-#include "content/public/common/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
 // Creates the data for chrome://histograms.
-void StartHistogramInternalsURLLoader(const network::ResourceRequest& request,
-                                      mojom::URLLoaderClientPtr client);
+void StartHistogramInternalsURLLoader(
+    const network::ResourceRequest& request,
+    network::mojom::URLLoaderClientPtr client);
 }  // namespace content
 
 #endif  // CONTENT_BROWSER_HISTOGRAM_INTERNALS_URL_LOADER_H_
diff --git a/content/browser/loader/downloaded_temp_file_impl.cc b/content/browser/loader/downloaded_temp_file_impl.cc
index 7bbb539..759bd05 100644
--- a/content/browser/loader/downloaded_temp_file_impl.cc
+++ b/content/browser/loader/downloaded_temp_file_impl.cc
@@ -11,9 +11,10 @@
 namespace content {
 
 // static
-mojom::DownloadedTempFilePtr DownloadedTempFileImpl::Create(int child_id,
-                                                            int request_id) {
-  mojo::InterfacePtr<mojom::DownloadedTempFile> ptr;
+network::mojom::DownloadedTempFilePtr DownloadedTempFileImpl::Create(
+    int child_id,
+    int request_id) {
+  mojo::InterfacePtr<network::mojom::DownloadedTempFile> ptr;
   mojo::MakeStrongBinding(
       std::make_unique<DownloadedTempFileImpl>(child_id, request_id),
       mojo::MakeRequest(&ptr));
diff --git a/content/browser/loader/downloaded_temp_file_impl.h b/content/browser/loader/downloaded_temp_file_impl.h
index 0ef0231..2535a20 100644
--- a/content/browser/loader/downloaded_temp_file_impl.h
+++ b/content/browser/loader/downloaded_temp_file_impl.h
@@ -7,7 +7,7 @@
 
 #include "base/macros.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -15,14 +15,15 @@
 // loading. The instance is held by the client and lives until the client
 // destroys the interface, slightly after the URLLoader is destroyed.
 class CONTENT_EXPORT DownloadedTempFileImpl final
-    : public mojom::DownloadedTempFile {
+    : public network::mojom::DownloadedTempFile {
  public:
   // Creates a DownloadedTempFileImpl, binds it as a strong interface, and
   // returns the interface ptr to be passed to the client.
   // That means:
   //  * The DownloadedTempFile object created here is essentially owned by the
   //    client. It keeps alive until the client destroys the other endpoint.
-  static mojom::DownloadedTempFilePtr Create(int child_id, int request_id);
+  static network::mojom::DownloadedTempFilePtr Create(int child_id,
+                                                      int request_id);
 
   DownloadedTempFileImpl(int child_id, int request_id);
   ~DownloadedTempFileImpl() override;
diff --git a/content/browser/loader/mojo_async_resource_handler.cc b/content/browser/loader/mojo_async_resource_handler.cc
index bf6157e..5ef8e7a 100644
--- a/content/browser/loader/mojo_async_resource_handler.cc
+++ b/content/browser/loader/mojo_async_resource_handler.cc
@@ -40,8 +40,8 @@
 
 constexpr size_t kMaxChunkSize = 32 * 1024;
 
-void NotReached(mojom::URLLoaderRequest mojo_request,
-                mojom::URLLoaderClientPtr url_loader_client) {
+void NotReached(network::mojom::URLLoaderRequest mojo_request,
+                network::mojom::URLLoaderClientPtr url_loader_client) {
   NOTREACHED();
 }
 
@@ -95,8 +95,8 @@
 MojoAsyncResourceHandler::MojoAsyncResourceHandler(
     net::URLRequest* request,
     ResourceDispatcherHostImpl* rdh,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
     ResourceType resource_type,
     uint32_t url_loader_options)
     : ResourceHandler(request),
@@ -107,10 +107,11 @@
       url_loader_client_(std::move(url_loader_client)),
       weak_factory_(this) {
   DCHECK(IsResourceTypeFrame(resource_type) ||
-         !(url_loader_options_ & mojom::kURLLoadOptionSendSSLInfoWithResponse));
+         !(url_loader_options_ &
+           network::mojom::kURLLoadOptionSendSSLInfoWithResponse));
   DCHECK(resource_type == RESOURCE_TYPE_MAIN_FRAME ||
          !(url_loader_options_ &
-           mojom::kURLLoadOptionSendSSLInfoForCertificateError));
+           network::mojom::kURLLoadOptionSendSSLInfoForCertificateError));
   DCHECK(url_loader_client_);
   InitializeResourceBufferConstants();
   // This unretained pointer is safe, because |binding_| is owned by |this| and
@@ -181,7 +182,7 @@
   response->head.response_start = base::TimeTicks::Now();
   sent_received_response_message_ = true;
 
-  mojom::DownloadedTempFilePtr downloaded_file_ptr;
+  network::mojom::DownloadedTempFilePtr downloaded_file_ptr;
   if (!response->head.download_file_path.empty()) {
     downloaded_file_ptr = DownloadedTempFileImpl::Create(info->GetChildID(),
                                                          info->GetRequestID());
@@ -190,7 +191,8 @@
   }
 
   base::Optional<net::SSLInfo> ssl_info;
-  if (url_loader_options_ & mojom::kURLLoadOptionSendSSLInfoWithResponse)
+  if (url_loader_options_ &
+      network::mojom::kURLLoadOptionSendSSLInfoWithResponse)
     ssl_info = request()->ssl_info();
 
   url_loader_client_->OnReceiveResponse(response->head, std::move(ssl_info),
@@ -204,7 +206,8 @@
         std::vector<uint8_t>(data, data + metadata->size()));
   }
 
-  if (url_loader_options_ & mojom::kURLLoadOptionPauseOnResponseStarted) {
+  if (url_loader_options_ &
+      network::mojom::kURLLoadOptionPauseOnResponseStarted) {
     did_defer_on_response_started_ = true;
     DCHECK(!has_controller());
     request()->LogBlockedBy("MojoAsyncResourceHandler");
@@ -480,7 +483,7 @@
       GetRequestInfo()->blocked_cross_site_document();
 
   if ((url_loader_options_ &
-       mojom::kURLLoadOptionSendSSLInfoForCertificateError) &&
+       network::mojom::kURLLoadOptionSendSSLInfoForCertificateError) &&
       net::IsCertStatusError(request()->ssl_info().cert_status) &&
       !net::IsCertStatusMinorError(request()->ssl_info().cert_status)) {
     loader_status.ssl_info = request()->ssl_info();
@@ -611,8 +614,8 @@
 }
 
 void MojoAsyncResourceHandler::OnTransfer(
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client) {
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client) {
   binding_.Unbind();
   binding_.Bind(std::move(mojo_request));
   binding_.set_connection_error_handler(base::BindOnce(
diff --git a/content/browser/loader/mojo_async_resource_handler.h b/content/browser/loader/mojo_async_resource_handler.h
index de57cbc..c4fc140a 100644
--- a/content/browser/loader/mojo_async_resource_handler.h
+++ b/content/browser/loader/mojo_async_resource_handler.h
@@ -17,12 +17,12 @@
 #include "content/common/content_export.h"
 #include "content/network/upload_progress_tracker.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "mojo/public/cpp/system/simple_watcher.h"
 #include "net/base/io_buffer.h"
 #include "net/base/request_priority.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 class GURL;
 
@@ -51,13 +51,14 @@
 // TODO(yhirano): Send cached metadata.
 //
 // This class can be inherited only for tests.
-class CONTENT_EXPORT MojoAsyncResourceHandler : public ResourceHandler,
-                                                public mojom::URLLoader {
+class CONTENT_EXPORT MojoAsyncResourceHandler
+    : public ResourceHandler,
+      public network::mojom::URLLoader {
  public:
   MojoAsyncResourceHandler(net::URLRequest* request,
                            ResourceDispatcherHostImpl* rdh,
-                           mojom::URLLoaderRequest mojo_request,
-                           mojom::URLLoaderClientPtr url_loader_client,
+                           network::mojom::URLLoaderRequest mojo_request,
+                           network::mojom::URLLoaderClientPtr url_loader_client,
                            ResourceType resource_type,
                            uint32_t url_loader_options);
   ~MojoAsyncResourceHandler() override;
@@ -82,7 +83,7 @@
       std::unique_ptr<ResourceController> controller) override;
   void OnDataDownloaded(int bytes_downloaded) override;
 
-  // mojom::URLLoader implementation:
+  // network::mojom::URLLoader implementation:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -127,14 +128,14 @@
       const base::Location& from_here,
       UploadProgressTracker::UploadProgressReportCallback callback);
 
-  void OnTransfer(mojom::URLLoaderRequest mojo_request,
-                  mojom::URLLoaderClientPtr url_loader_client);
+  void OnTransfer(network::mojom::URLLoaderRequest mojo_request,
+                  network::mojom::URLLoaderClientPtr url_loader_client);
   void SendUploadProgress(const net::UploadProgress& progress);
   void OnUploadProgressACK();
   static void InitializeResourceBufferConstants();
 
   ResourceDispatcherHostImpl* rdh_;
-  mojo::Binding<mojom::URLLoader> binding_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
 
   uint32_t url_loader_options_;
 
@@ -157,8 +158,8 @@
   int* parent_buffer_size_ = nullptr;
 
   mojo::SimpleWatcher handle_watcher_;
-  std::unique_ptr<mojom::URLLoader> url_loader_;
-  mojom::URLLoaderClientPtr url_loader_client_;
+  std::unique_ptr<network::mojom::URLLoader> url_loader_;
+  network::mojom::URLLoaderClientPtr url_loader_client_;
   scoped_refptr<net::IOBufferWithSize> buffer_;
   size_t buffer_offset_ = 0;
   size_t buffer_bytes_read_ = 0;
diff --git a/content/browser/loader/mojo_async_resource_handler_unittest.cc b/content/browser/loader/mojo_async_resource_handler_unittest.cc
index a02cb8b..4571f9b 100644
--- a/content/browser/loader/mojo_async_resource_handler_unittest.cc
+++ b/content/browser/loader/mojo_async_resource_handler_unittest.cc
@@ -32,8 +32,6 @@
 #include "content/public/browser/stream_info.h"
 #include "content/public/common/previews_state.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/test_browser_context.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_url_loader_client.h"
@@ -58,6 +56,8 @@
 #include "net/url_request/url_request_test_util.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/cpp/url_loader_completion_status.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/base/page_transition_types.h"
 
@@ -205,8 +205,8 @@
   MojoAsyncResourceHandlerWithStubOperations(
       net::URLRequest* request,
       ResourceDispatcherHostImpl* rdh,
-      mojom::URLLoaderRequest mojo_request,
-      mojom::URLLoaderClientPtr url_loader_client,
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client,
       uint32_t options)
       : MojoAsyncResourceHandler(request,
                                  rdh,
@@ -285,34 +285,38 @@
   DISALLOW_COPY_AND_ASSIGN(MojoAsyncResourceHandlerWithStubOperations);
 };
 
-class TestURLLoaderFactory final : public mojom::URLLoaderFactory {
+class TestURLLoaderFactory final : public network::mojom::URLLoaderFactory {
  public:
   TestURLLoaderFactory() {}
   ~TestURLLoaderFactory() override {}
 
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client_ptr,
+                            network::mojom::URLLoaderClientPtr client_ptr,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     loader_request_ = std::move(request);
     client_ptr_ = std::move(client_ptr);
   }
 
-  mojom::URLLoaderRequest PassLoaderRequest() {
+  network::mojom::URLLoaderRequest PassLoaderRequest() {
     return std::move(loader_request_);
   }
 
-  mojom::URLLoaderClientPtr PassClientPtr() { return std::move(client_ptr_); }
+  network::mojom::URLLoaderClientPtr PassClientPtr() {
+    return std::move(client_ptr_);
+  }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
  private:
-  mojom::URLLoaderRequest loader_request_;
-  mojom::URLLoaderClientPtr client_ptr_;
+  network::mojom::URLLoaderRequest loader_request_;
+  network::mojom::URLLoaderClientPtr client_ptr_;
 
   DISALLOW_COPY_AND_ASSIGN(TestURLLoaderFactory);
 };
@@ -349,13 +353,14 @@
         nullptr);                                // navigation_ui_data
 
     network::ResourceRequest request;
-    base::WeakPtr<mojo::StrongBinding<mojom::URLLoaderFactory>> weak_binding =
-        mojo::MakeStrongBinding(std::make_unique<TestURLLoaderFactory>(),
-                                mojo::MakeRequest(&url_loader_factory_));
+    base::WeakPtr<mojo::StrongBinding<network::mojom::URLLoaderFactory>>
+        weak_binding =
+            mojo::MakeStrongBinding(std::make_unique<TestURLLoaderFactory>(),
+                                    mojo::MakeRequest(&url_loader_factory_));
 
     url_loader_factory_->CreateLoaderAndStart(
         mojo::MakeRequest(&url_loader_proxy_), kRouteId, kRequestId,
-        mojom::kURLLoadOptionNone, request,
+        network::mojom::kURLLoadOptionNone, request,
         url_loader_client_.CreateInterfacePtr(),
         net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
@@ -415,8 +420,8 @@
   TestBrowserThreadBundle thread_bundle_;
   TestResourceDispatcherHostDelegate rdh_delegate_;
   ResourceDispatcherHostImpl rdh_;
-  mojom::URLLoaderFactoryPtr url_loader_factory_;
-  mojom::URLLoaderPtr url_loader_proxy_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_;
+  network::mojom::URLLoaderPtr url_loader_proxy_;
   TestURLLoaderClient url_loader_client_;
   std::unique_ptr<TestBrowserContext> browser_context_;
   net::TestDelegate url_request_delegate_;
@@ -435,7 +440,8 @@
                                      public ::testing::Test {
  protected:
   MojoAsyncResourceHandlerTest()
-      : MojoAsyncResourceHandlerTestBase(nullptr, mojom::kURLLoadOptionNone) {}
+      : MojoAsyncResourceHandlerTestBase(nullptr,
+                                         network::mojom::kURLLoadOptionNone) {}
 };
 
 class MojoAsyncResourceHandlerDeferOnResponseStartedTest
@@ -445,7 +451,7 @@
   MojoAsyncResourceHandlerDeferOnResponseStartedTest()
       : MojoAsyncResourceHandlerTestBase(
             nullptr,
-            mojom::kURLLoadOptionPauseOnResponseStarted) {}
+            network::mojom::kURLLoadOptionPauseOnResponseStarted) {}
 };
 
 class MojoAsyncResourceHandlerSendSSLInfoWithResponseTest
@@ -455,7 +461,7 @@
   MojoAsyncResourceHandlerSendSSLInfoWithResponseTest()
       : MojoAsyncResourceHandlerTestBase(
             nullptr,
-            mojom::kURLLoadOptionSendSSLInfoWithResponse) {}
+            network::mojom::kURLLoadOptionSendSSLInfoWithResponse) {}
 };
 
 class MojoAsyncResourceHandlerSendSSLInfoForCertificateError
@@ -465,7 +471,7 @@
   MojoAsyncResourceHandlerSendSSLInfoForCertificateError()
       : MojoAsyncResourceHandlerTestBase(
             nullptr,
-            mojom::kURLLoadOptionSendSSLInfoForCertificateError) {}
+            network::mojom::kURLLoadOptionSendSSLInfoForCertificateError) {}
 };
 
 // This test class is parameterized with MojoAsyncResourceHandler's allocation
@@ -475,7 +481,8 @@
       public ::testing::TestWithParam<size_t> {
  protected:
   MojoAsyncResourceHandlerWithAllocationSizeTest()
-      : MojoAsyncResourceHandlerTestBase(nullptr, mojom::kURLLoadOptionNone) {
+      : MojoAsyncResourceHandlerTestBase(nullptr,
+                                         network::mojom::kURLLoadOptionNone) {
     MojoAsyncResourceHandler::SetAllocationSizeForTesting(GetParam());
   }
 };
@@ -487,7 +494,7 @@
   MojoAsyncResourceHandlerUploadTest()
       : MojoAsyncResourceHandlerTestBase(
             std::make_unique<DummyUploadDataStream>(),
-            mojom::kURLLoadOptionNone) {}
+            network::mojom::kURLLoadOptionNone) {}
 };
 
 TEST_F(MojoAsyncResourceHandlerTest, InFlightRequests) {
diff --git a/content/browser/loader/navigation_url_loader_delegate.h b/content/browser/loader/navigation_url_loader_delegate.h
index 32e3ce4..0517402 100644
--- a/content/browser/loader/navigation_url_loader_delegate.h
+++ b/content/browser/loader/navigation_url_loader_delegate.h
@@ -11,7 +11,7 @@
 #include "base/memory/ref_counted.h"
 #include "base/optional.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace net {
 struct RedirectInfo;
@@ -50,7 +50,7 @@
   // like AppCache or ServiceWorker.
   virtual void OnResponseStarted(
       const scoped_refptr<network::ResourceResponse>& response,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       std::unique_ptr<StreamHandle> body_stream,
       const net::SSLInfo& ssl_info,
       std::unique_ptr<NavigationData> navigation_data,
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc
index 8be6ea73..47a9bf56 100644
--- a/content/browser/loader/navigation_url_loader_impl.cc
+++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -105,10 +105,10 @@
     bool is_stream) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 
-  delegate_->OnResponseStarted(response, mojom::URLLoaderClientEndpointsPtr(),
-                               std::move(body), ssl_info,
-                               std::move(navigation_data), request_id,
-                               is_download, is_stream, base::nullopt);
+  delegate_->OnResponseStarted(
+      response, network::mojom::URLLoaderClientEndpointsPtr(), std::move(body),
+      ssl_info, std::move(navigation_data), request_id, is_download, is_stream,
+      base::nullopt);
 }
 void NavigationURLLoaderImpl::NotifyRequestFailed(
     bool in_cache,
diff --git a/content/browser/loader/navigation_url_loader_impl_core.cc b/content/browser/loader/navigation_url_loader_impl_core.cc
index d39946a..955cc6c 100644
--- a/content/browser/loader/navigation_url_loader_impl_core.cc
+++ b/content/browser/loader/navigation_url_loader_impl_core.cc
@@ -18,11 +18,11 @@
 #include "content/public/browser/navigation_ui_data.h"
 #include "content/public/browser/ssl_status.h"
 #include "content/public/browser/stream_handle.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/base/net_errors.h"
 #include "net/url_request/redirect_info.h"
 #include "net/url_request/url_request_context_getter.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "storage/browser/fileapi/file_system_context.h"
 
 namespace content {
@@ -56,9 +56,11 @@
     ResourceDispatcherHostImpl::Get()->BeginNavigationRequest(
         resource_context, url_request_context_getter->GetURLRequestContext(),
         upload_file_system_context, *request_info,
-        std::move(navigation_ui_data), this, mojom::URLLoaderClientPtr(),
-        mojom::URLLoaderRequest(), service_worker_handle_core,
-        appcache_handle_core, mojom::kURLLoadOptionNone, &global_request_id);
+        std::move(navigation_ui_data), this,
+        network::mojom::URLLoaderClientPtr(),
+        network::mojom::URLLoaderRequest(), service_worker_handle_core,
+        appcache_handle_core, network::mojom::kURLLoadOptionNone,
+        &global_request_id);
   }
 
   // Careful, |this| could be destroyed at this point. Don't notify start if
diff --git a/content/browser/loader/navigation_url_loader_network_service.cc b/content/browser/loader/navigation_url_loader_network_service.cc
index be17388..6393244 100644
--- a/content/browser/loader/navigation_url_loader_network_service.cc
+++ b/content/browser/loader/navigation_url_loader_network_service.cc
@@ -48,7 +48,6 @@
 #include "content/public/common/content_features.h"
 #include "content/public/common/referrer.h"
 #include "content/public/common/url_constants.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/common/url_utils.h"
 #include "net/base/load_flags.h"
 #include "net/http/http_content_disposition.h"
@@ -57,6 +56,7 @@
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_context.h"
 #include "services/network/public/interfaces/request_context_frame_type.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "services/service_manager/public/cpp/connector.h"
 #include "third_party/WebKit/common/mime_util/mime_util.h"
 
@@ -187,7 +187,7 @@
 // may be performed multiple times when redirects happen.
 // TODO(michaeln): Expose this class and add more unittests.
 class NavigationURLLoaderNetworkService::URLLoaderRequestController
-    : public mojom::URLLoaderClient {
+    : public network::mojom::URLLoaderClient {
  public:
   URLLoaderRequestController(
       std::vector<std::unique_ptr<URLLoaderRequestHandler>> initial_handlers,
@@ -214,17 +214,17 @@
   }
 
   static uint32_t GetURLLoaderOptions(bool is_main_frame) {
-    uint32_t options = mojom::kURLLoadOptionSendSSLInfoWithResponse;
+    uint32_t options = network::mojom::kURLLoadOptionSendSSLInfoWithResponse;
     if (is_main_frame)
-      options |= mojom::kURLLoadOptionSendSSLInfoForCertificateError;
+      options |= network::mojom::kURLLoadOptionSendSSLInfoForCertificateError;
 
     if (base::FeatureList::IsEnabled(features::kNetworkService)) {
-      options |= mojom::kURLLoadOptionSniffMimeType;
+      options |= network::mojom::kURLLoadOptionSniffMimeType;
     } else {
       // TODO(arthursonzogni): This is a temporary option. Remove this as soon
       // as the InterceptingResourceHandler is removed.
       // See https://crbug.com/791049.
-      options |= mojom::kURLLoadOptionPauseOnResponseStarted;
+      options |= network::mojom::kURLLoadOptionPauseOnResponseStarted;
     }
 
     return options;
@@ -237,8 +237,8 @@
       std::unique_ptr<NavigationUIData> navigation_ui_data,
       ServiceWorkerNavigationHandleCore* service_worker_navigation_handle_core,
       AppCacheNavigationHandleCore* appcache_handle_core,
-      mojom::URLLoaderRequest url_loader,
-      mojom::URLLoaderClientPtr url_loader_client) {
+      network::mojom::URLLoaderRequest url_loader,
+      network::mojom::URLLoaderClientPtr url_loader_client) {
     DCHECK(!base::FeatureList::IsEnabled(features::kNetworkService));
     DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
@@ -298,7 +298,7 @@
       AppCacheNavigationHandleCore* appcache_handle_core,
       std::unique_ptr<NavigationRequestInfo> request_info,
       std::unique_ptr<NavigationUIData> navigation_ui_data,
-      mojom::URLLoaderFactoryPtrInfo factory_for_webui,
+      network::mojom::URLLoaderFactoryPtrInfo factory_for_webui,
       int frame_tree_node_id,
       std::unique_ptr<service_manager::Connector> connector) {
     DCHECK(base::FeatureList::IsEnabled(features::kNetworkService));
@@ -327,8 +327,9 @@
               std::move(factory_for_webui)),
           GetContentClient()->browser()->CreateURLLoaderThrottles(
               web_contents_getter_, navigation_ui_data_.get()),
-          0 /* routing_id */, 0 /* request_id? */, mojom::kURLLoadOptionNone,
-          resource_request_.get(), this, kNavigationUrlLoaderTrafficAnnotation,
+          0 /* routing_id */, 0 /* request_id? */,
+          network::mojom::kURLLoadOptionNone, resource_request_.get(), this,
+          kNavigationUrlLoaderTrafficAnnotation,
           base::ThreadTaskRunnerHandle::Get());
       return;
     }
@@ -439,13 +440,13 @@
       return;
     }
 
-    mojom::URLLoaderFactory* factory = nullptr;
+    network::mojom::URLLoaderFactory* factory = nullptr;
     DCHECK_EQ(handlers_.size(), handler_index_);
     if (resource_request_->url.SchemeIs(url::kBlobScheme)) {
       factory = default_url_loader_factory_getter_->GetBlobFactory();
     } else if (!IsURLHandledByNetworkService(resource_request_->url) &&
                !resource_request_->url.SchemeIs(url::kDataScheme)) {
-      mojom::URLLoaderFactoryPtr& non_network_factory =
+      network::mojom::URLLoaderFactoryPtr& non_network_factory =
           non_network_url_loader_factories_[resource_request_->url.scheme()];
       if (!non_network_factory.is_bound()) {
         BrowserThread::PostTask(
@@ -523,11 +524,11 @@
   }
 
  private:
-  // mojom::URLLoaderClient implementation:
+  // network::mojom::URLLoaderClient implementation:
   void OnReceiveResponse(
       const network::ResourceResponseHead& head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     received_response_ = true;
 
     // If the default loader (network) was used to handle the URL load request
@@ -536,13 +537,14 @@
     if (MaybeCreateLoaderForResponse(head))
       return;
 
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints;
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints;
     if (url_loader_) {
       url_loader_client_endpoints = url_loader_->Unbind();
     } else {
-      url_loader_client_endpoints = mojom::URLLoaderClientEndpoints::New(
-          response_url_loader_.PassInterface(),
-          response_loader_binding_.Unbind());
+      url_loader_client_endpoints =
+          network::mojom::URLLoaderClientEndpoints::New(
+              response_url_loader_.PassInterface(),
+              response_loader_binding_.Unbind());
     }
 
     scoped_refptr<network::ResourceResponse> response(
@@ -668,7 +670,7 @@
       return false;
 
     for (auto& handler : handlers_) {
-      mojom::URLLoaderClientRequest response_client_request;
+      network::mojom::URLLoaderClientRequest response_client_request;
       if (handler->MaybeCreateLoaderForResponse(response, &response_url_loader_,
                                                 &response_client_request)) {
         response_loader_binding_.Bind(std::move(response_client_request));
@@ -721,11 +723,11 @@
 
   // URLLoaderClient binding for loaders created for responses received from the
   // network loader.
-  mojo::Binding<mojom::URLLoaderClient> response_loader_binding_;
+  mojo::Binding<network::mojom::URLLoaderClient> response_loader_binding_;
 
   // URLLoader instance for response loaders, i.e loaders created for handing
   // responses received from the network URLLoader.
-  mojom::URLLoaderPtr response_url_loader_;
+  network::mojom::URLLoaderPtr response_url_loader_;
 
   // Set to true if we receive a valid response from a URLLoader, i.e.
   // URLLoaderClient::OnReceivedResponse() is called.
@@ -735,7 +737,7 @@
 
   // Lazily initialized and used in the case of non-network resource
   // navigations. Keyed by URL scheme.
-  std::map<std::string, mojom::URLLoaderFactoryPtr>
+  std::map<std::string, network::mojom::URLLoaderFactoryPtr>
       non_network_url_loader_factories_;
 
   // The completion status if it has been received. This is needed to handle
@@ -856,7 +858,7 @@
   // Check if a web UI scheme wants to handle this request.
   FrameTreeNode* frame_tree_node =
       FrameTreeNode::GloballyFindByID(frame_tree_node_id);
-  mojom::URLLoaderFactoryPtrInfo factory_for_webui;
+  network::mojom::URLLoaderFactoryPtrInfo factory_for_webui;
   const auto& schemes = URLDataManagerBackend::GetWebUISchemes();
   std::string scheme = new_request->url.scheme();
   if (std::find(schemes.begin(), schemes.end(), scheme) != schemes.end()) {
@@ -920,13 +922,13 @@
 
 void NavigationURLLoaderNetworkService::OnReceiveResponse(
     scoped_refptr<network::ResourceResponse> response,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     const base::Optional<net::SSLInfo>& maybe_ssl_info,
     std::unique_ptr<NavigationData> navigation_data,
     const GlobalRequestID& global_request_id,
     bool is_download,
     bool is_stream,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   TRACE_EVENT_ASYNC_END2("navigation", "Navigation timeToResponseStarted", this,
                          "&NavigationURLLoaderNetworkService", this, "success",
                          true);
@@ -972,7 +974,7 @@
 
 void NavigationURLLoaderNetworkService::BindNonNetworkURLLoaderFactoryRequest(
     const GURL& url,
-    mojom::URLLoaderFactoryRequest factory) {
+    network::mojom::URLLoaderFactoryRequest factory) {
   auto it = non_network_url_loader_factories_.find(url.scheme());
   if (it == non_network_url_loader_factories_.end()) {
     DVLOG(1) << "Ignoring request with unknown scheme: " << url.spec();
diff --git a/content/browser/loader/navigation_url_loader_network_service.h b/content/browser/loader/navigation_url_loader_network_service.h
index 2d3f171..69c8ac3 100644
--- a/content/browser/loader/navigation_url_loader_network_service.h
+++ b/content/browser/loader/navigation_url_loader_network_service.h
@@ -12,8 +12,8 @@
 #include "content/browser/loader/navigation_url_loader.h"
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/ssl_status.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace net {
 struct RedirectInfo;
@@ -52,13 +52,13 @@
 
   void OnReceiveResponse(
       scoped_refptr<network::ResourceResponse> response,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       const base::Optional<net::SSLInfo>& maybe_ssl_info,
       std::unique_ptr<NavigationData> navigation_data,
       const GlobalRequestID& global_request_id,
       bool is_download,
       bool is_stream,
-      mojom::DownloadedTempFilePtr downloaded_file);
+      network::mojom::DownloadedTempFilePtr downloaded_file);
   void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
                          scoped_refptr<network::ResourceResponse> response);
   void OnComplete(const network::URLLoaderCompletionStatus& status);
@@ -69,7 +69,7 @@
 
   void BindNonNetworkURLLoaderFactoryRequest(
       const GURL& url,
-      mojom::URLLoaderFactoryRequest factory);
+      network::mojom::URLLoaderFactoryRequest factory);
 
   NavigationURLLoaderDelegate* delegate_;
 
diff --git a/content/browser/loader/navigation_url_loader_network_service_unittest.cc b/content/browser/loader/navigation_url_loader_network_service_unittest.cc
index 6c3cdf4..fab2e5c 100644
--- a/content/browser/loader/navigation_url_loader_network_service_unittest.cc
+++ b/content/browser/loader/navigation_url_loader_network_service_unittest.cc
@@ -50,8 +50,8 @@
   }
 
   void StartLoader(network::ResourceRequest resource_request,
-                   mojom::URLLoaderRequest request,
-                   mojom::URLLoaderClientPtr client) {
+                   network::mojom::URLLoaderRequest request,
+                   network::mojom::URLLoaderClientPtr client) {
     *most_recent_resource_request_ = resource_request;
     // The URLLoader will delete itself upon completion.
     new URLLoader(context_.get(), std::move(request), 0 /* options */,
@@ -62,8 +62,8 @@
 
   bool MaybeCreateLoaderForResponse(
       const network::ResourceResponseHead& response,
-      mojom::URLLoaderPtr* loader,
-      mojom::URLLoaderClientRequest* client_request) override {
+      network::mojom::URLLoaderPtr* loader,
+      network::mojom::URLLoaderClientRequest* client_request) override {
     return false;
   }
 
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index d1cfc78..fbe324f0 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -163,16 +163,16 @@
 void AbortRequestBeforeItStarts(
     IPC::Sender* sender,
     int request_id,
-    mojom::URLLoaderClientPtr url_loader_client) {
-    // Tell the renderer that this request was disallowed.
-    network::URLLoaderCompletionStatus status;
-    status.error_code = net::ERR_ABORTED;
-    status.exists_in_cache = false;
-    // No security info needed, connection not established.
-    status.completion_time = base::TimeTicks();
-    status.encoded_data_length = 0;
-    status.encoded_body_length = 0;
-    url_loader_client->OnComplete(status);
+    network::mojom::URLLoaderClientPtr url_loader_client) {
+  // Tell the renderer that this request was disallowed.
+  network::URLLoaderCompletionStatus status;
+  status.error_code = net::ERR_ABORTED;
+  status.exists_in_cache = false;
+  // No security info needed, connection not established.
+  status.completion_time = base::TimeTicks();
+  status.encoded_data_length = 0;
+  status.encoded_body_length = 0;
+  url_loader_client->OnComplete(status);
 }
 
 void RemoveDownloadFileFromChildSecurityPolicy(int child_id,
@@ -718,8 +718,8 @@
     int request_id,
     bool is_sync_load,
     const network::ResourceRequest& request_data,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation) {
   DCHECK(requester_info->IsRenderer() || requester_info->IsNavigationPreload());
   BeginRequest(requester_info, request_id, request_data, is_sync_load,
@@ -747,8 +747,8 @@
     int request_id,
     const network::ResourceRequest& request_data,
     LoaderMap::iterator iter,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client) {
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client) {
   DCHECK(requester_info->IsRenderer());
   int child_id = requester_info->child_id();
   ResourceRequestInfoImpl* info = iter->second->GetRequestInfo();
@@ -818,8 +818,8 @@
     int request_id,
     const network::ResourceRequest& request_data,
     int route_id,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client) {
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client) {
   DCHECK(requester_info->IsRenderer());
   // Caller should ensure that |request_data| is associated with a transfer.
   DCHECK(request_data.transferred_request_child_id != -1 ||
@@ -873,8 +873,8 @@
     const network::ResourceRequest& request_data,
     bool is_sync_load,
     int route_id,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation) {
   DCHECK(requester_info->IsRenderer() || requester_info->IsNavigationPreload());
   int child_id = requester_info->child_id();
@@ -1011,8 +1011,8 @@
     bool is_sync_load,
     int route_id,
     const net::HttpRequestHeaders& headers,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
     BlobHandles blob_handles,
     const net::NetworkTrafficAnnotationTag& traffic_annotation,
     HeaderInterceptorResult interceptor_result) {
@@ -1071,7 +1071,7 @@
   } else {
     // Log that this request is a service worker navigation preload request
     // here, since navigation preload machinery has no access to netlog.
-    // TODO(falken): Figure out how mojom::URLLoaderClient can
+    // TODO(falken): Figure out how network::mojom::URLLoaderClient can
     // access the request's netlog.
     if (requester_info->IsNavigationPreload()) {
       new_request->net_log().AddEvent(
@@ -1264,8 +1264,8 @@
     int route_id,
     int child_id,
     ResourceContext* resource_context,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client) {
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client) {
   DCHECK(requester_info->IsRenderer() || requester_info->IsNavigationPreload());
   // Construct the IPC resource handler.
   std::unique_ptr<ResourceHandler> handler;
@@ -1304,13 +1304,13 @@
 std::unique_ptr<ResourceHandler>
 ResourceDispatcherHostImpl::CreateBaseResourceHandler(
     net::URLRequest* request,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
     ResourceType resource_type) {
   std::unique_ptr<ResourceHandler> handler;
   handler.reset(new MojoAsyncResourceHandler(
       request, this, std::move(mojo_request), std::move(url_loader_client),
-      resource_type, mojom::kURLLoadOptionNone));
+      resource_type, network::mojom::kURLLoadOptionNone));
   return handler;
 }
 
@@ -1789,8 +1789,8 @@
     const NavigationRequestInfo& info,
     std::unique_ptr<NavigationUIData> navigation_ui_data,
     NavigationURLLoaderImplCore* loader,
-    mojom::URLLoaderClientPtr url_loader_client,
-    mojom::URLLoaderRequest url_loader_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest url_loader_request,
     ServiceWorkerNavigationHandleCore* service_worker_handle_core,
     AppCacheNavigationHandleCore* appcache_handle_core,
     uint32_t url_loader_options,
@@ -2018,18 +2018,18 @@
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& request,
-    mojom::URLLoaderRequest mojo_request,
-    mojom::URLLoaderClientPtr url_loader_client,
+    network::mojom::URLLoaderRequest mojo_request,
+    network::mojom::URLLoaderClientPtr url_loader_client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation) {
-  DCHECK_EQ(mojom::kURLLoadOptionNone,
-            options & ~mojom::kURLLoadOptionSynchronous);
+  DCHECK_EQ(network::mojom::kURLLoadOptionNone,
+            options & ~network::mojom::kURLLoadOptionSynchronous);
   if (!url_loader_client) {
     VLOG(1) << "Killed renderer for null client";
     bad_message::ReceivedBadMessage(requester_info->filter(),
                                     bad_message::RDH_NULL_CLIENT);
     return;
   }
-  bool is_sync_load = options & mojom::kURLLoadOptionSynchronous;
+  bool is_sync_load = options & network::mojom::kURLLoadOptionSynchronous;
   OnRequestResourceInternal(requester_info, routing_id, request_id,
                             is_sync_load, request, std::move(mojo_request),
                             std::move(url_loader_client), traffic_annotation);
diff --git a/content/browser/loader/resource_dispatcher_host_impl.h b/content/browser/loader/resource_dispatcher_host_impl.h
index 454831d..1393215f 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.h
+++ b/content/browser/loader/resource_dispatcher_host_impl.h
@@ -37,10 +37,10 @@
 #include "content/public/common/previews_state.h"
 #include "content/public/common/request_context_type.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "net/base/load_states.h"
 #include "net/base/request_priority.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "url/gurl.h"
 
 namespace base {
@@ -258,8 +258,8 @@
       const NavigationRequestInfo& info,
       std::unique_ptr<NavigationUIData> navigation_ui_data,
       NavigationURLLoaderImplCore* loader,
-      mojom::URLLoaderClientPtr url_loader_client,
-      mojom::URLLoaderRequest url_loader_request,
+      network::mojom::URLLoaderClientPtr url_loader_client,
+      network::mojom::URLLoaderRequest url_loader_request,
       ServiceWorkerNavigationHandleCore* service_worker_handle_core,
       AppCacheNavigationHandleCore* appcache_handle_core,
       uint32_t url_loader_options,
@@ -282,8 +282,8 @@
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& request,
-      mojom::URLLoaderRequest mojo_request,
-      mojom::URLLoaderClientPtr url_loader_client,
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client,
       const net::NetworkTrafficAnnotationTag& traffic_annotation);
 
   // Helper function for initializing the |request| passed in. By initializing
@@ -532,21 +532,22 @@
       int request_id,
       bool is_sync_load,
       const network::ResourceRequest& request_data,
-      mojom::URLLoaderRequest mojo_request,
-      mojom::URLLoaderClientPtr url_loader_client,
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client,
       const net::NetworkTrafficAnnotationTag& traffic_annotation);
 
   bool IsRequestIDInUse(const GlobalRequestID& id) const;
 
   // Update the ResourceRequestInfo and internal maps when a request is
   // transferred from one process to another.
-  void UpdateRequestForTransfer(ResourceRequesterInfo* requester_info,
-                                int route_id,
-                                int request_id,
-                                const network::ResourceRequest& request_data,
-                                LoaderMap::iterator iter,
-                                mojom::URLLoaderRequest mojo_request,
-                                mojom::URLLoaderClientPtr url_loader_client);
+  void UpdateRequestForTransfer(
+      ResourceRequesterInfo* requester_info,
+      int route_id,
+      int request_id,
+      const network::ResourceRequest& request_data,
+      LoaderMap::iterator iter,
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client);
 
   // If |request_data| is for a request being transferred from another process,
   // then CompleteTransfer method can be used to complete the transfer.
@@ -554,16 +555,16 @@
                         int request_id,
                         const network::ResourceRequest& request_data,
                         int route_id,
-                        mojom::URLLoaderRequest mojo_request,
-                        mojom::URLLoaderClientPtr url_loader_client);
+                        network::mojom::URLLoaderRequest mojo_request,
+                        network::mojom::URLLoaderClientPtr url_loader_client);
 
   void BeginRequest(ResourceRequesterInfo* requester_info,
                     int request_id,
                     const network::ResourceRequest& request_data,
                     bool is_sync_load,
                     int route_id,
-                    mojom::URLLoaderRequest mojo_request,
-                    mojom::URLLoaderClientPtr url_loader_client,
+                    network::mojom::URLLoaderRequest mojo_request,
+                    network::mojom::URLLoaderClientPtr url_loader_client,
                     const net::NetworkTrafficAnnotationTag& traffic_annotation);
 
   // There are requests which need decisions to be made like the following:
@@ -581,8 +582,8 @@
       bool is_sync_load,
       int route_id,
       const net::HttpRequestHeaders& headers,
-      mojom::URLLoaderRequest mojo_request,
-      mojom::URLLoaderClientPtr url_loader_client,
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client,
       BlobHandles blob_handles,
       const net::NetworkTrafficAnnotationTag& traffic_annotation,
       HeaderInterceptorResult interceptor_result);
@@ -596,14 +597,14 @@
       int route_id,
       int child_id,
       ResourceContext* resource_context,
-      mojom::URLLoaderRequest mojo_request,
-      mojom::URLLoaderClientPtr url_loader_client);
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client);
 
   // Creates either MojoAsyncResourceHandler or AsyncResourceHandler.
   std::unique_ptr<ResourceHandler> CreateBaseResourceHandler(
       net::URLRequest* request,
-      mojom::URLLoaderRequest mojo_request,
-      mojom::URLLoaderClientPtr url_loader_client,
+      network::mojom::URLLoaderRequest mojo_request,
+      network::mojom::URLLoaderClientPtr url_loader_client,
       ResourceType resource_type);
 
   // Wraps |handler| in the standard resource handlers for normal resource
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index 9c6b5b4..f03fd144 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -724,30 +724,32 @@
   void MakeTestRequest(int render_view_id,
                        int request_id,
                        const GURL& url,
-                       mojom::URLLoaderRequest loader_request,
-                       mojom::URLLoaderClientPtr client);
-  void MakeTestRequestWithRenderFrame(int render_view_id,
-                                      int render_frame_id,
-                                      int request_id,
-                                      const GURL& url,
-                                      ResourceType type,
-                                      mojom::URLLoaderRequest loader_request,
-                                      mojom::URLLoaderClientPtr client);
+                       network::mojom::URLLoaderRequest loader_request,
+                       network::mojom::URLLoaderClientPtr client);
+  void MakeTestRequestWithRenderFrame(
+      int render_view_id,
+      int render_frame_id,
+      int request_id,
+      const GURL& url,
+      ResourceType type,
+      network::mojom::URLLoaderRequest loader_request,
+      network::mojom::URLLoaderClientPtr client);
   // Generates a request using the given filter and resource type.
-  void MakeTestRequestWithResourceType(ResourceMessageFilter* filter,
-                                       int render_view_id,
-                                       int request_id,
-                                       const GURL& url,
-                                       ResourceType type,
-                                       mojom::URLLoaderRequest loader_request,
-                                       mojom::URLLoaderClientPtr client);
+  void MakeTestRequestWithResourceType(
+      ResourceMessageFilter* filter,
+      int render_view_id,
+      int request_id,
+      const GURL& url,
+      ResourceType type,
+      network::mojom::URLLoaderRequest loader_request,
+      network::mojom::URLLoaderClientPtr client);
 
   void MakeWebContentsAssociatedTestRequestWithResourceType(
       int request_id,
       const GURL& url,
       ResourceType type,
-      mojom::URLLoaderRequest loader_request,
-      mojom::URLLoaderClientPtr client);
+      network::mojom::URLLoaderRequest loader_request,
+      network::mojom::URLLoaderClientPtr client);
 
   // Generates a request with the given priority.
   void MakeTestRequestWithPriorityAndRenderFrame(
@@ -755,8 +757,8 @@
       int render_frame_id,
       int request_id,
       net::RequestPriority priority,
-      mojom::URLLoaderRequest loader_request,
-      mojom::URLLoaderClientPtr client);
+      network::mojom::URLLoaderRequest loader_request,
+      network::mojom::URLLoaderClientPtr client);
 
   void CancelRequest(int request_id);
   void CompleteStartRequest(int request_id);
@@ -833,7 +835,7 @@
       ASSERT_EQ(expected_error_code, delegate.net_error());
       return;
     }
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     TestURLLoaderClient client;
 
     MakeTestRequestWithResourceType(
@@ -883,8 +885,8 @@
     int render_view_id,
     int request_id,
     const GURL& url,
-    mojom::URLLoaderRequest loader_request,
-    mojom::URLLoaderClientPtr client) {
+    network::mojom::URLLoaderRequest loader_request,
+    network::mojom::URLLoaderClientPtr client) {
   MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
                                   url, RESOURCE_TYPE_SUB_RESOURCE,
                                   std::move(loader_request), std::move(client));
@@ -896,13 +898,13 @@
     int request_id,
     const GURL& url,
     ResourceType type,
-    mojom::URLLoaderRequest loader_request,
-    mojom::URLLoaderClientPtr client) {
+    network::mojom::URLLoaderRequest loader_request,
+    network::mojom::URLLoaderClientPtr client) {
   network::ResourceRequest request = CreateResourceRequest("GET", type, url);
   request.render_frame_id = render_frame_id;
   filter_->CreateLoaderAndStart(
       std::move(loader_request), render_view_id, request_id,
-      mojom::kURLLoadOptionNone, request, std::move(client),
+      network::mojom::kURLLoadOptionNone, request, std::move(client),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 }
 
@@ -912,12 +914,12 @@
     int request_id,
     const GURL& url,
     ResourceType type,
-    mojom::URLLoaderRequest loader_request,
-    mojom::URLLoaderClientPtr client) {
+    network::mojom::URLLoaderRequest loader_request,
+    network::mojom::URLLoaderClientPtr client) {
   network::ResourceRequest request = CreateResourceRequest("GET", type, url);
   filter->CreateLoaderAndStart(
       std::move(loader_request), render_view_id, request_id,
-      mojom::kURLLoadOptionNone, request, std::move(client),
+      network::mojom::kURLLoadOptionNone, request, std::move(client),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 }
 
@@ -926,15 +928,15 @@
         int request_id,
         const GURL& url,
         ResourceType type,
-        mojom::URLLoaderRequest loader_request,
-        mojom::URLLoaderClientPtr client) {
+        network::mojom::URLLoaderRequest loader_request,
+        network::mojom::URLLoaderClientPtr client) {
   network::ResourceRequest request = CreateResourceRequest("GET", type, url);
   DCHECK_EQ(web_contents_filter_->child_id(),
             web_contents_->GetMainFrame()->GetProcess()->GetID());
   request.render_frame_id = web_contents_->GetMainFrame()->GetRoutingID();
   web_contents_filter_->CreateLoaderAndStart(
-      std::move(loader_request), 0, request_id, mojom::kURLLoadOptionNone,
-      request, std::move(client),
+      std::move(loader_request), 0, request_id,
+      network::mojom::kURLLoadOptionNone, request, std::move(client),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 }
 
@@ -943,15 +945,15 @@
     int render_frame_id,
     int request_id,
     net::RequestPriority priority,
-    mojom::URLLoaderRequest loader_request,
-    mojom::URLLoaderClientPtr client) {
+    network::mojom::URLLoaderRequest loader_request,
+    network::mojom::URLLoaderClientPtr client) {
   network::ResourceRequest request = CreateResourceRequest(
       "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority"));
   request.render_frame_id = render_frame_id;
   request.priority = priority;
   filter_->CreateLoaderAndStart(
       std::move(loader_request), render_view_id, request_id,
-      mojom::kURLLoadOptionNone, request, std::move(client),
+      network::mojom::kURLLoadOptionNone, request, std::move(client),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 }
 
@@ -992,7 +994,7 @@
 // Tests whether messages get canceled properly. We issue four requests,
 // cancel two of them, and make sure that each sent the proper notifications.
 TEST_F(ResourceDispatcherHostTest, Cancel) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
   TestURLLoaderClient client1, client2, client3, client4;
   MakeTestRequest(0, 1, net::URLRequestTestJob::test_url_1(),
                   mojo::MakeRequest(&loader1), client1.CreateInterfacePtr());
@@ -1040,7 +1042,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, DownloadToNetworkCache) {
-  mojom::URLLoaderPtr loader1, loader2;
+  network::mojom::URLLoaderPtr loader1, loader2;
   TestURLLoaderClient client1, client2;
   // Normal request.
   MakeTestRequest(0, 1, net::URLRequestTestJob::test_url_2(),
@@ -1051,7 +1053,7 @@
       "GET", RESOURCE_TYPE_IMAGE, net::URLRequestTestJob::test_url_3());
   request_to_cache.download_to_network_cache_only = true;
   filter_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader2), 0, 2, mojom::kURLLoadOptionNone,
+      mojo::MakeRequest(&loader2), 0, 2, network::mojom::kURLLoadOptionNone,
       request_to_cache, client2.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
@@ -1087,7 +1089,7 @@
 // Shows that detachable requests will timeout if the request takes too long to
 // complete.
 TEST_F(ResourceDispatcherHostTest, DetachedResourceTimesOut) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   MakeTestRequestWithResourceType(
       filter_.get(), 0, 1, net::URLRequestTestJob::test_url_2(),
@@ -1135,7 +1137,7 @@
 // we can unship the feature easily if needed.
 // TODO(yhirano): Add a corresponding test case with the feature.
 TEST_F(ResourceDispatcherHostTest, DeletedFilterDetached) {
-  mojom::URLLoaderPtr loader1, loader2;
+  network::mojom::URLLoaderPtr loader1, loader2;
   TestURLLoaderClient client1, client2;
   base::test::ScopedFeatureList feature_list;
   feature_list.InitAndDisableFeature(
@@ -1147,12 +1149,12 @@
       "GET", RESOURCE_TYPE_PING, net::URLRequestTestJob::test_url_3());
 
   filter_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader1), 0, 1, mojom::kURLLoadOptionNone,
+      mojo::MakeRequest(&loader1), 0, 1, network::mojom::kURLLoadOptionNone,
       request_prefetch, client1.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   filter_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader2), 0, 2, mojom::kURLLoadOptionNone,
+      mojo::MakeRequest(&loader2), 0, 2, network::mojom::kURLLoadOptionNone,
       request_ping, client2.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
@@ -1191,15 +1193,15 @@
 // If the filter has disappeared (original process dies) then detachable
 // resources should continue to load, even when redirected.
 TEST_F(ResourceDispatcherHostTest, DeletedFilterDetachedRedirect) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   network::ResourceRequest request = CreateResourceRequest(
       "GET", RESOURCE_TYPE_PREFETCH,
       net::URLRequestTestJob::test_url_redirect_to_url_2());
 
   filter_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 0, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 0, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   // Remove the filter before processing the request by simulating channel
@@ -1239,7 +1241,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, CancelWhileStartIsDeferred) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   bool was_deleted = false;
 
@@ -1267,7 +1269,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, DetachWhileStartIsDeferred) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   bool was_deleted = false;
 
@@ -1312,7 +1314,7 @@
 // Tests if cancel is called in ResourceThrottle::WillStartRequest, then the
 // URLRequest will not be started.
 TEST_F(ResourceDispatcherHostTest, CancelInResourceThrottleWillStartRequest) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   TestResourceDispatcherHostDelegate delegate;
   delegate.set_flags(CANCEL_BEFORE_START);
@@ -1334,7 +1336,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, PausedStartError) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   // Arrange to have requests deferred before processing response headers.
   TestResourceDispatcherHostDelegate delegate;
@@ -1354,7 +1356,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, ThrottleAndResumeTwice) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   // Arrange to have requests deferred before starting.
   TestResourceDispatcherHostDelegate delegate;
@@ -1391,7 +1393,7 @@
 
 // Tests that the delegate can cancel a request and provide a error code.
 TEST_F(ResourceDispatcherHostTest, CancelInDelegate) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   TestResourceDispatcherHostDelegate delegate;
   delegate.set_flags(CANCEL_BEFORE_START);
@@ -1415,7 +1417,7 @@
 // we can unship the feature easily if needed.
 // TODO(yhirano): Add a corresponding test case with the feature.
 TEST_F(ResourceDispatcherHostTest, CancelRequestsForRoute) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
   TestURLLoaderClient client1, client2, client3, client4;
   base::test::ScopedFeatureList feature_list;
   feature_list.InitAndDisableFeature(
@@ -1471,7 +1473,7 @@
 
 // Tests CancelRequestsForProcess
 TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
   TestURLLoaderClient client1, client2, client3, client4;
   scoped_refptr<TestFilter> test_filter = MakeTestFilter();
 
@@ -1545,7 +1547,7 @@
 // Tests whether the correct requests get canceled when a RenderViewHost is
 // deleted.
 TEST_F(ResourceDispatcherHostTest, CancelRequestsOnRenderFrameDeleted) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5;
   TestURLLoaderClient client1, client2, client3, client4, client5;
   // Requests all hang once started.  This prevents requests from being
   // destroyed due to completion.
@@ -1602,7 +1604,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, TestProcessCancelDetachedTimesOut) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   MakeTestRequestWithResourceType(
       filter_.get(), 0, 1, net::URLRequestTestJob::test_url_4(),
@@ -1648,8 +1650,8 @@
 
 // Tests blocking and resuming requests.
 TEST_F(ResourceDispatcherHostTest, TestBlockingResumingRequests) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5, loader6,
-      loader7;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5,
+      loader6, loader7;
   TestURLLoaderClient client1, client2, client3, client4, client5, client6,
       client7;
 
@@ -1728,7 +1730,7 @@
 
 // Tests blocking and canceling requests.
 TEST_F(ResourceDispatcherHostTest, TestBlockingCancelingRequests) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5;
   TestURLLoaderClient client1, client2, client3, client4, client5;
 
   host_.BlockRequestsForRoute(GlobalFrameRoutingId(filter_->child_id(), 11));
@@ -1778,7 +1780,7 @@
 
 // Tests that blocked requests are canceled if their associated process dies.
 TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5;
   TestURLLoaderClient client1, client2, client3, client4, client5;
   // This second filter is used to emulate a second process.
   scoped_refptr<TestFilter> second_filter = MakeTestFilter();
@@ -1829,8 +1831,8 @@
 // If this test turns the Purify bot red, check the ResourceDispatcherHost
 // destructor to make sure the blocked requests are deleted.
 TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsDontLeak) {
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5, loader6,
-      loader7, loader8;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4, loader5,
+      loader6, loader7, loader8;
   TestURLLoaderClient client1, client2, client3, client4, client5, client6,
       client7, client8;
   // This second filter is used to emulate a second process.
@@ -1930,9 +1932,10 @@
   // throttling kicks in.
   const size_t kMaxRequests = kMaxCostPerProcess / kMemoryCostOfTest2Req;
 
-  auto loaders = std::make_unique<mojom::URLLoaderPtr[]>(kMaxRequests + 4);
+  auto loaders =
+      std::make_unique<network::mojom::URLLoaderPtr[]>(kMaxRequests + 4);
   auto clients = std::make_unique<TestURLLoaderClient[]>(kMaxRequests + 4);
-  mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
+  network::mojom::URLLoaderPtr loader1, loader2, loader3, loader4;
   TestURLLoaderClient client1, client2, client3, client4;
 
   // This second filter is used to emulate a second process.
@@ -2008,7 +2011,7 @@
   scoped_refptr<TestFilter> second_filter = MakeTestFilter();
   scoped_refptr<TestFilter> third_filter = MakeTestFilter();
 
-  mojom::URLLoaderPtr loaders[kMaxRequests + 3];
+  network::mojom::URLLoaderPtr loaders[kMaxRequests + 3];
   TestURLLoaderClient clients[kMaxRequests + 3];
 
   // Saturate the number of outstanding requests for our process.
@@ -2066,7 +2069,7 @@
 
 // Tests that we sniff the mime type for a simple request.
 TEST_F(ResourceDispatcherHostTest, MimeSniffed) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   std::string raw_headers("HTTP/1.1 200 OK\n\n");
   std::string response_data("<html><title>Test One</title></html>");
@@ -2086,7 +2089,7 @@
 
 // Tests that we don't sniff the mime type when the server provides one.
 TEST_F(ResourceDispatcherHostTest, MimeNotSniffed) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   std::string raw_headers("HTTP/1.1 200 OK\n"
                           "Content-type: image/jpeg\n\n");
@@ -2107,7 +2110,7 @@
 
 // Tests that we don't sniff the mime type when there is no message body.
 TEST_F(ResourceDispatcherHostTest, MimeNotSniffed2) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   SetResponse("HTTP/1.1 304 Not Modified\n\n");
 
@@ -2124,7 +2127,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, MimeSniff204) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   SetResponse("HTTP/1.1 204 No Content\n\n");
 
@@ -2141,7 +2144,7 @@
 }
 
 TEST_F(ResourceDispatcherHostTest, MimeSniffEmpty) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   SetResponse("HTTP/1.1 200 OK\n\n");
 
@@ -2176,7 +2179,7 @@
 
 TEST_F(ResourceDispatcherHostTest, CancelRequestsForContextDetached) {
   EXPECT_EQ(0, host_.pending_requests());
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   constexpr int render_view_id = 0;
   constexpr int request_id = 1;
@@ -2223,7 +2226,7 @@
 
   constexpr int render_view_id = 0;
   constexpr int request_id = 1;
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
 
   std::string raw_headers("HTTP\n"
@@ -2285,7 +2288,7 @@
   // Register it for a resource request.
   auto downloaded_file =
       DownloadedTempFileImpl::Create(filter_->child_id(), kRequestID);
-  mojom::DownloadedTempFilePtr downloaded_file_ptr =
+  network::mojom::DownloadedTempFilePtr downloaded_file_ptr =
       DownloadedTempFileImpl::Create(filter_->child_id(), kRequestID);
   host_.RegisterDownloadedTempFile(filter_->child_id(), kRequestID, file_path);
 
@@ -2348,14 +2351,14 @@
 
 TEST_F(ResourceDispatcherHostTest, DownloadToFile) {
   // Make a request which downloads to file.
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
   network::ResourceRequest request = CreateResourceRequest(
       "GET", RESOURCE_TYPE_SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
   request.download_to_file = true;
   filter_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 0, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 0, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
   content::RunAllTasksUntilIdle();
 
@@ -2580,7 +2583,7 @@
       "Content-Type: text/plain; charset=utf-8\n\n");
   std::string response_data("p { text-align: center; }");
   SetResponse(raw_headers, response_data);
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   TestURLLoaderClient client;
 
   MakeTestRequestWithResourceType(
diff --git a/content/browser/loader/resource_message_filter.cc b/content/browser/loader/resource_message_filter.cc
index 415b53c..874b809 100644
--- a/content/browser/loader/resource_message_filter.cc
+++ b/content/browser/loader/resource_message_filter.cc
@@ -18,7 +18,7 @@
 
 namespace content {
 namespace {
-mojom::URLLoaderFactory* g_test_factory;
+network::mojom::URLLoaderFactory* g_test_factory;
 ResourceMessageFilter* g_current_filter;
 }  // namespace
 
@@ -31,7 +31,7 @@
     const GetContextsCallback& get_contexts_callback,
     const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner)
     : BrowserMessageFilter(ResourceMsgStart),
-      BrowserAssociatedInterface<mojom::URLLoaderFactory>(this, this),
+      BrowserAssociatedInterface<network::mojom::URLLoaderFactory>(this, this),
       is_channel_closed_(false),
       requester_info_(
           ResourceRequesterInfo::CreateForRenderer(child_id,
@@ -91,12 +91,12 @@
 }
 
 void ResourceMessageFilter::CreateLoaderAndStart(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& url_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   if (g_test_factory && !g_current_filter) {
     g_current_filter = this;
@@ -113,7 +113,8 @@
       net::NetworkTrafficAnnotationTag(traffic_annotation));
 }
 
-void ResourceMessageFilter::Clone(mojom::URLLoaderFactoryRequest request) {
+void ResourceMessageFilter::Clone(
+    network::mojom::URLLoaderFactoryRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
@@ -126,7 +127,7 @@
 }
 
 void ResourceMessageFilter::SetNetworkFactoryForTesting(
-    mojom::URLLoaderFactory* test_factory) {
+    network::mojom::URLLoaderFactory* test_factory) {
   DCHECK(!BrowserThread::IsThreadInitialized(BrowserThread::IO) ||
          BrowserThread::CurrentlyOn(BrowserThread::IO));
   DCHECK(!test_factory || !g_test_factory);
diff --git a/content/browser/loader/resource_message_filter.h b/content/browser/loader/resource_message_filter.h
index d37c6bc..f0a4253 100644
--- a/content/browser/loader/resource_message_filter.h
+++ b/content/browser/loader/resource_message_filter.h
@@ -17,8 +17,8 @@
 #include "content/public/browser/browser_associated_interface.h"
 #include "content/public/browser/browser_message_filter.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace storage {
 class FileSystemContext;
@@ -43,8 +43,8 @@
 // will not interfere with browser UI.
 class CONTENT_EXPORT ResourceMessageFilter
     : public BrowserMessageFilter,
-      public BrowserAssociatedInterface<mojom::URLLoaderFactory>,
-      public mojom::URLLoaderFactory {
+      public BrowserAssociatedInterface<network::mojom::URLLoaderFactory>,
+      public network::mojom::URLLoaderFactory {
  public:
   typedef base::Callback<void(ResourceType resource_type,
                               ResourceContext**,
@@ -71,15 +71,15 @@
 
   base::WeakPtr<ResourceMessageFilter> GetWeakPtr();
 
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
   int child_id() const;
 
@@ -97,7 +97,7 @@
   // This method must be called either on the IO thread or before threads start.
   // This callback is run on the IO thread.
   static void SetNetworkFactoryForTesting(
-      mojom::URLLoaderFactory* test_factory);
+      network::mojom::URLLoaderFactory* test_factory);
   static ResourceMessageFilter* GetCurrentForTesting();
 
  protected:
@@ -116,7 +116,7 @@
   // An additional set of non-associated bindings (beyond those held by the
   // BrowserAssociatedInterface parent class) of pipes to this object's
   // URLLoaderFactory interface.
-  mojo::BindingSet<mojom::URLLoaderFactory> bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
 
   // Task runner for the IO thead.
   scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
diff --git a/content/browser/loader/resource_request_info_impl.cc b/content/browser/loader/resource_request_info_impl.cc
index 91a42fd..0e8439e 100644
--- a/content/browser/loader/resource_request_info_impl.cc
+++ b/content/browser/loader/resource_request_info_impl.cc
@@ -346,8 +346,8 @@
     int render_frame_id,
     int request_id,
     ResourceRequesterInfo* requester_info,
-    mojom::URLLoaderRequest url_loader_request,
-    mojom::URLLoaderClientPtr url_loader_client) {
+    network::mojom::URLLoaderRequest url_loader_request,
+    network::mojom::URLLoaderClientPtr url_loader_client) {
   route_id_ = route_id;
   render_frame_id_ = render_frame_id;
   plugin_child_id_ = ChildProcessHost::kInvalidUniqueID;
diff --git a/content/browser/loader/resource_request_info_impl.h b/content/browser/loader/resource_request_info_impl.h
index dbe9520..e88be08 100644
--- a/content/browser/loader/resource_request_info_impl.h
+++ b/content/browser/loader/resource_request_info_impl.h
@@ -21,9 +21,9 @@
 #include "content/public/common/previews_state.h"
 #include "content/public/common/referrer.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "net/base/load_states.h"
 #include "services/network/public/cpp/resource_request_body.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 class DetachableResourceHandler;
@@ -37,7 +37,8 @@
                                 public base::SupportsUserData::Data {
  public:
   using TransferCallback =
-      base::Callback<void(mojom::URLLoaderRequest, mojom::URLLoaderClientPtr)>;
+      base::Callback<void(network::mojom::URLLoaderRequest,
+                          network::mojom::URLLoaderClientPtr)>;
 
   // Returns the ResourceRequestInfoImpl associated with the given URLRequest.
   CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest(
@@ -126,8 +127,8 @@
                          int render_frame_id,
                          int request_id,
                          ResourceRequesterInfo* requester_info,
-                         mojom::URLLoaderRequest url_loader_request,
-                         mojom::URLLoaderClientPtr url_loader_client);
+                         network::mojom::URLLoaderRequest url_loader_request,
+                         network::mojom::URLLoaderClientPtr url_loader_client);
 
   // Whether this request is part of a navigation that should replace the
   // current session history entry. This state is shuffled up and down the stack
diff --git a/content/browser/loader/url_loader_factory_impl.cc b/content/browser/loader/url_loader_factory_impl.cc
index 8803e19..a19d764 100644
--- a/content/browser/loader/url_loader_factory_impl.cc
+++ b/content/browser/loader/url_loader_factory_impl.cc
@@ -7,10 +7,10 @@
 #include "base/memory/ptr_util.h"
 #include "content/browser/loader/resource_dispatcher_host_impl.h"
 #include "content/browser/loader/resource_requester_info.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
@@ -31,12 +31,12 @@
 }
 
 void URLLoaderFactoryImpl::CreateLoaderAndStart(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& url_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   CreateLoaderAndStart(
       requester_info_.get(), std::move(request), routing_id, request_id,
@@ -44,19 +44,20 @@
       static_cast<net::NetworkTrafficAnnotationTag>(traffic_annotation));
 }
 
-void URLLoaderFactoryImpl::Clone(mojom::URLLoaderFactoryRequest request) {
+void URLLoaderFactoryImpl::Clone(
+    network::mojom::URLLoaderFactoryRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
 // static
 void URLLoaderFactoryImpl::CreateLoaderAndStart(
     ResourceRequesterInfo* requester_info,
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& url_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation) {
   DCHECK(ResourceDispatcherHostImpl::Get()
              ->io_thread_task_runner()
@@ -71,7 +72,7 @@
 // static
 void URLLoaderFactoryImpl::Create(
     scoped_refptr<ResourceRequesterInfo> requester_info,
-    mojom::URLLoaderFactoryRequest request,
+    network::mojom::URLLoaderFactoryRequest request,
     const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner) {
   // This instance is effectively reference counted by the number of pipes open
   // to it and will get deleted when all clients drop their connections.
diff --git a/content/browser/loader/url_loader_factory_impl.h b/content/browser/loader/url_loader_factory_impl.h
index 1440e9b..32c0be4 100644
--- a/content/browser/loader/url_loader_factory_impl.h
+++ b/content/browser/loader/url_loader_factory_impl.h
@@ -9,46 +9,46 @@
 #include "base/memory/ref_counted.h"
 #include "base/single_thread_task_runner.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
 class ResourceRequesterInfo;
 
-// This class is an implementation of mojom::URLLoaderFactory that creates
-// a mojom::URLLoader. This class is instantiated only for Service Worker
-// navigation preload or test cases.
-class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory {
+// This class is an implementation of network::mojom::URLLoaderFactory that
+// creates a network::mojom::URLLoader. This class is instantiated only for
+// Service Worker navigation preload or test cases.
+class URLLoaderFactoryImpl final : public network::mojom::URLLoaderFactory {
  public:
   ~URLLoaderFactoryImpl() override;
 
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
   static void CreateLoaderAndStart(
       ResourceRequesterInfo* requester_info,
-      mojom::URLLoaderRequest request,
+      network::mojom::URLLoaderRequest request,
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& url_request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::NetworkTrafficAnnotationTag& traffic_annotation);
 
   // Creates a URLLoaderFactoryImpl instance. The instance is held by the
   // StrongBinding in it, so this function doesn't return the instance.
   CONTENT_EXPORT static void Create(
       scoped_refptr<ResourceRequesterInfo> requester_info,
-      mojom::URLLoaderFactoryRequest request,
+      network::mojom::URLLoaderFactoryRequest request,
       const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner);
 
  private:
@@ -58,7 +58,7 @@
 
   void OnConnectionError();
 
-  mojo::BindingSet<mojom::URLLoaderFactory> bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
 
   scoped_refptr<ResourceRequesterInfo> requester_info_;
 
diff --git a/content/browser/loader/url_loader_factory_impl_unittest.cc b/content/browser/loader/url_loader_factory_impl_unittest.cc
index af411b57..0a504b6 100644
--- a/content/browser/loader/url_loader_factory_impl_unittest.cc
+++ b/content/browser/loader/url_loader_factory_impl_unittest.cc
@@ -29,8 +29,6 @@
 #include "content/public/browser/resource_context.h"
 #include "content/public/browser/resource_dispatcher_host_delegate.h"
 #include "content/public/common/content_paths.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/test_browser_context.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_url_loader_client.h"
@@ -51,6 +49,8 @@
 #include "net/url_request/url_request_filter.h"
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/cpp/url_loader_completion_status.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 #include "url/origin.h"
@@ -139,7 +139,7 @@
   ResourceDispatcherHostImpl rdh_;
   std::unique_ptr<TestBrowserContext> browser_context_;
   scoped_refptr<ResourceMessageFilter> resource_message_filter_;
-  mojom::URLLoaderFactoryPtr factory_;
+  network::mojom::URLLoaderFactoryPtr factory_;
 
   DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImplTest);
 };
@@ -147,7 +147,7 @@
 TEST_P(URLLoaderFactoryImplTest, GetResponse) {
   constexpr int32_t kRoutingId = 81;
   constexpr int32_t kRequestId = 28;
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   base::FilePath root;
   PathService::Get(DIR_TEST_DATA, &root);
   net::URLRequestMockHTTPJob::AddUrlHandlers(root);
@@ -164,7 +164,7 @@
   request.request_initiator = url::Origin::Create(request.url);
   factory_->CreateLoaderAndStart(
       mojo::MakeRequest(&loader), kRoutingId, kRequestId,
-      mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
+      network::mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   ASSERT_FALSE(client.has_received_response());
@@ -225,7 +225,7 @@
 }
 
 TEST_P(URLLoaderFactoryImplTest, GetFailedResponse) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   network::ResourceRequest request;
   TestURLLoaderClient client;
   net::URLRequestFailedJob::AddUrlHandler();
@@ -239,8 +239,8 @@
   // Need to set same-site |request_initiator| for non main frame type request.
   request.request_initiator = url::Origin::Create(request.url);
   factory_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 2, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 2, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   client.RunUntilComplete();
@@ -254,7 +254,7 @@
 
 // In this case, the loading fails after receiving a response.
 TEST_P(URLLoaderFactoryImplTest, GetFailedResponse2) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   network::ResourceRequest request;
   TestURLLoaderClient client;
   net::URLRequestFailedJob::AddUrlHandler();
@@ -268,8 +268,8 @@
   // Need to set same-site |request_initiator| for non main frame type request.
   request.request_initiator = url::Origin::Create(request.url);
   factory_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 2, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 2, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   client.RunUntilComplete();
@@ -283,7 +283,7 @@
 
 // This test tests a case where resource loading is cancelled before started.
 TEST_P(URLLoaderFactoryImplTest, InvalidURL) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   network::ResourceRequest request;
   TestURLLoaderClient client;
   request.url = GURL();
@@ -296,8 +296,8 @@
   request.request_initiator = url::Origin::Create(request.url);
   ASSERT_FALSE(request.url.is_valid());
   factory_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 2, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 2, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   client.RunUntilComplete();
@@ -309,7 +309,7 @@
 
 // This test tests a case where resource loading is cancelled before started.
 TEST_P(URLLoaderFactoryImplTest, ShouldNotRequestURL) {
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   RejectingResourceDispatcherHostDelegate rdh_delegate;
   rdh_.SetDelegate(&rdh_delegate);
   network::ResourceRequest request;
@@ -323,8 +323,8 @@
   // Need to set same-site |request_initiator| for non main frame type request.
   request.request_initiator = url::Origin::Create(request.url);
   factory_->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 2, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 2, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   client.RunUntilComplete();
@@ -340,7 +340,7 @@
   constexpr int32_t kRoutingId = 1;
   constexpr int32_t kRequestId = 2;
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   base::FilePath root;
   PathService::Get(DIR_TEST_DATA, &root);
   net::URLRequestMockHTTPJob::AddUrlHandlers(root);
@@ -408,7 +408,7 @@
   constexpr int32_t kRoutingId = 1;
   constexpr int32_t kRequestId = 2;
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   base::FilePath root;
   PathService::Get(DIR_TEST_DATA, &root);
   net::URLRequestSlowDownloadJob::AddUrlHandler();
@@ -466,7 +466,7 @@
 TEST_P(URLLoaderFactoryImplTest, OnTransferSizeUpdated) {
   constexpr int32_t kRoutingId = 81;
   constexpr int32_t kRequestId = 28;
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   base::FilePath root;
   PathService::Get(DIR_TEST_DATA, &root);
   net::URLRequestMockHTTPJob::AddUrlHandlers(root);
@@ -484,7 +484,7 @@
   request.report_raw_headers = true;
   factory_->CreateLoaderAndStart(
       mojo::MakeRequest(&loader), kRoutingId, kRequestId,
-      mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
+      network::mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   client.RunUntilComplete();
@@ -526,7 +526,7 @@
 TEST_P(URLLoaderFactoryImplTest, CancelFromRenderer) {
   constexpr int32_t kRoutingId = 81;
   constexpr int32_t kRequestId = 28;
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   base::FilePath root;
   PathService::Get(DIR_TEST_DATA, &root);
   net::URLRequestFailedJob::AddUrlHandler();
@@ -544,7 +544,7 @@
   request.request_initiator = url::Origin::Create(request.url);
   factory_->CreateLoaderAndStart(
       mojo::MakeRequest(&loader), kRoutingId, kRequestId,
-      mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
+      network::mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   base::RunLoop().RunUntilIdle();
diff --git a/content/browser/loader/url_loader_request_handler.cc b/content/browser/loader/url_loader_request_handler.cc
index 9e4b93d..6074215 100644
--- a/content/browser/loader/url_loader_request_handler.cc
+++ b/content/browser/loader/url_loader_request_handler.cc
@@ -15,8 +15,8 @@
 
 bool URLLoaderRequestHandler::MaybeCreateLoaderForResponse(
     const network::ResourceResponseHead& response,
-    mojom::URLLoaderPtr* loader,
-    mojom::URLLoaderClientRequest* client_request) {
+    network::mojom::URLLoaderPtr* loader,
+    network::mojom::URLLoaderClientRequest* client_request) {
   return false;
 }
 
diff --git a/content/browser/loader/url_loader_request_handler.h b/content/browser/loader/url_loader_request_handler.h
index 67adeb4..d2c8b452 100644
--- a/content/browser/loader/url_loader_request_handler.h
+++ b/content/browser/loader/url_loader_request_handler.h
@@ -9,9 +9,10 @@
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/optional.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "content/common/content_export.h"
 #include "net/url_request/redirect_info.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -20,8 +21,8 @@
 struct SubresourceLoaderParams;
 
 using StartLoaderCallback =
-    base::OnceCallback<void(mojom::URLLoaderRequest request,
-                            mojom::URLLoaderClientPtr client)>;
+    base::OnceCallback<void(network::mojom::URLLoaderRequest request,
+                            network::mojom::URLLoaderClientPtr client)>;
 
 using LoaderCallback = base::OnceCallback<void(StartLoaderCallback)>;
 
@@ -57,8 +58,8 @@
   // |client_request| parameter.
   virtual bool MaybeCreateLoaderForResponse(
       const network::ResourceResponseHead& response,
-      mojom::URLLoaderPtr* loader,
-      mojom::URLLoaderClientRequest* client_request);
+      network::mojom::URLLoaderPtr* loader,
+      network::mojom::URLLoaderClientRequest* client_request);
 };
 
 }  // namespace content
diff --git a/content/browser/media/audio_stream_monitor.cc b/content/browser/media/audio_stream_monitor.cc
index 9d649f98..67c0bae 100644
--- a/content/browser/media/audio_stream_monitor.cc
+++ b/content/browser/media/audio_stream_monitor.cc
@@ -40,7 +40,8 @@
 }
 
 AudioStreamMonitor::AudioStreamMonitor(WebContents* contents)
-    : web_contents_(contents),
+    : WebContentsObserver(contents),
+      web_contents_(contents),
       clock_(base::DefaultTickClock::GetInstance()),
       indicator_is_on_(false),
       is_audible_(false) {
@@ -218,4 +219,19 @@
   }
 }
 
+void AudioStreamMonitor::RenderFrameDeleted(
+    RenderFrameHost* render_frame_host) {
+  int render_process_id = render_frame_host->GetProcess()->GetID();
+  int render_frame_id = render_frame_host->GetRoutingID();
+
+  // It is possible for a frame to be deleted before notifications about its
+  // streams are received. Explicitly clear these streams.
+  base::EraseIf(streams_, [render_process_id, render_frame_id](
+                              const std::pair<StreamID, bool>& entry) {
+    return entry.first.render_process_id == render_process_id &&
+           entry.first.render_frame_id == render_frame_id;
+  });
+  UpdateStreams();
+}
+
 }  // namespace content
diff --git a/content/browser/media/audio_stream_monitor.h b/content/browser/media/audio_stream_monitor.h
index 4674b37..febec7c 100644
--- a/content/browser/media/audio_stream_monitor.h
+++ b/content/browser/media/audio_stream_monitor.h
@@ -17,6 +17,7 @@
 #include "base/timer/timer.h"
 #include "build/build_config.h"
 #include "content/common/content_export.h"
+#include "content/public/browser/web_contents_observer.h"
 #include "media/audio/audio_output_controller.h"
 
 namespace base {
@@ -39,10 +40,10 @@
 // active audio streams.
 //
 // Each WebContentsImpl owns an AudioStreamMonitor.
-class CONTENT_EXPORT AudioStreamMonitor {
+class CONTENT_EXPORT AudioStreamMonitor : public WebContentsObserver {
  public:
   explicit AudioStreamMonitor(WebContents* contents);
-  ~AudioStreamMonitor();
+  ~AudioStreamMonitor() override;
 
   // Returns true if audio has recently been audible from the tab.  This is
   // usually called whenever the tab data model is refreshed; but there are
@@ -74,6 +75,11 @@
                                        int stream_id,
                                        bool is_audible);
 
+  // WebContentsObserver implementation
+  void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
+  // Overloaded to avoid conflict with RenderProcessGone(int).
+  void RenderProcessGone(base::TerminationStatus status) override {}
+
   void set_was_recently_audible_for_testing(bool value) {
     indicator_is_on_ = value;
   }
diff --git a/content/browser/media/audio_stream_monitor_unittest.cc b/content/browser/media/audio_stream_monitor_unittest.cc
index 1f02f7c..4b9dc715 100644
--- a/content/browser/media/audio_stream_monitor_unittest.cc
+++ b/content/browser/media/audio_stream_monitor_unittest.cc
@@ -156,6 +156,8 @@
         is_audible);
   }
 
+  WebContents* web_contents() { return monitor_->web_contents_; }
+
  protected:
   AudioStreamMonitor* monitor_;
 
@@ -374,4 +376,19 @@
   ExpectIsMonitoring(kAnotherRenderProcessId, kRenderFrameId, kStreamId, false);
 }
 
+TEST_F(AudioStreamMonitorTest, RenderFrameGone) {
+  RenderFrameHost* render_frame_host = web_contents()->GetMainFrame();
+  int render_process_id = render_frame_host->GetProcess()->GetID();
+  int render_frame_id = render_frame_host->GetRoutingID();
+
+  StartMonitoring(render_process_id, render_frame_id, kStreamId);
+  StartMonitoring(kAnotherRenderProcessId, kRenderFrameId, kStreamId);
+  ExpectIsMonitoring(render_process_id, render_frame_id, kStreamId, true);
+  ExpectIsMonitoring(kAnotherRenderProcessId, kRenderFrameId, kStreamId, true);
+
+  monitor_->RenderFrameDeleted(render_frame_host);
+  ExpectIsMonitoring(render_process_id, render_frame_id, kStreamId, false);
+  ExpectIsMonitoring(kAnotherRenderProcessId, kRenderFrameId, kStreamId, true);
+}
+
 }  // namespace content
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 49e9b49..028eb14 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -2004,7 +2004,7 @@
 }
 
 void RenderProcessHostImpl::GetBlobURLLoaderFactory(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   if (!base::FeatureList::IsEnabled(features::kNetworkService)) {
     NOTREACHED();
     return;
@@ -2060,7 +2060,7 @@
 }
 
 void RenderProcessHostImpl::CreateURLLoaderFactory(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   if (!base::FeatureList::IsEnabled(features::kNetworkService)) {
     NOTREACHED();
     return;
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index a3b1844..f8118999 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -39,7 +39,6 @@
 #include "content/common/storage_partition_service.mojom.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/common/service_manager_connection.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "ipc/ipc_channel_proxy.h"
 #include "ipc/ipc_platform_file.h"
 #include "media/media_features.h"
@@ -47,6 +46,7 @@
 #include "mojo/public/cpp/bindings/associated_binding.h"
 #include "mojo/public/cpp/bindings/associated_binding_set.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
 #include "services/service_manager/public/interfaces/service.mojom.h"
 #include "services/ui/public/interfaces/gpu.mojom.h"
@@ -448,7 +448,8 @@
       mojom::AssociatedInterfaceAssociatedRequest request) override;
 
   // mojom::RendererHost
-  void GetBlobURLLoaderFactory(mojom::URLLoaderFactoryRequest request) override;
+  void GetBlobURLLoaderFactory(
+      network::mojom::URLLoaderFactoryRequest request) override;
   using BrowserHistogramCallback =
       mojom::RendererHost::GetBrowserHistogramCallback;
   void GetBrowserHistogram(const std::string& name,
@@ -468,7 +469,7 @@
   void CreateStoragePartitionService(
       mojom::StoragePartitionServiceRequest request);
   void CreateRendererHost(mojom::RendererHostAssociatedRequest request);
-  void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request);
+  void CreateURLLoaderFactory(network::mojom::URLLoaderFactoryRequest request);
 
   // Control message handlers.
   void OnUserMetricsRecordAction(const std::string& action);
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index 47aec69..9ab72e7 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -295,6 +295,13 @@
     base::debug::DumpWithoutCrashing();
   }
 
+  RenderFrameHostImpl* main_rfh = nullptr;
+  if (main_frame_routing_id_ != MSG_ROUTING_NONE) {
+    main_rfh = RenderFrameHostImpl::FromID(GetProcess()->GetID(),
+                                           main_frame_routing_id_);
+    DCHECK(main_rfh);
+  }
+
   GetWidget()->set_renderer_initialized(true);
 
   mojom::CreateViewParamsPtr params = mojom::CreateViewParams::New();
@@ -304,10 +311,7 @@
   params->web_preferences = GetWebkitPreferences();
   params->view_id = GetRoutingID();
   params->main_frame_routing_id = main_frame_routing_id_;
-  if (main_frame_routing_id_ != MSG_ROUTING_NONE) {
-    RenderFrameHostImpl* main_rfh = RenderFrameHostImpl::FromID(
-        GetProcess()->GetID(), main_frame_routing_id_);
-    DCHECK(main_rfh);
+  if (main_rfh) {
     main_rfh->BindInterfaceProviderRequest(
         mojo::MakeRequest(&params->main_frame_interface_provider));
     RenderWidgetHostImpl* main_rwh = main_rfh->GetRenderWidgetHost();
@@ -324,6 +328,10 @@
                               : GetWidget()->delegate()->IsHidden();
   params->never_visible = delegate_->IsNeverVisible();
   params->window_was_created_with_opener = window_was_created_with_opener;
+  if (main_rfh) {
+    params->has_committed_real_load =
+        main_rfh->frame_tree_node()->has_committed_real_load();
+  }
   params->enable_auto_resize = GetWidget()->auto_resize_enabled();
   params->min_size = GetWidget()->min_size_for_auto_resize();
   params->max_size = GetWidget()->max_size_for_auto_resize();
@@ -343,10 +351,8 @@
 
   // Since this method can create the main RenderFrame in the renderer process,
   // set the proper state on its corresponding RenderFrameHost.
-  if (main_frame_routing_id_ != MSG_ROUTING_NONE) {
-    RenderFrameHostImpl::FromID(GetProcess()->GetID(), main_frame_routing_id_)
-        ->SetRenderFrameCreated(true);
-  }
+  if (main_rfh)
+    main_rfh->SetRenderFrameCreated(true);
   GetWidget()->delegate()->SendScreenRects();
   PostRenderViewReady();
 
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.cc b/content/browser/renderer_host/render_widget_host_input_event_router.cc
index 1f16d83..caae0f4 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.cc
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.cc
@@ -25,24 +25,12 @@
 
 // Transforms WebTouchEvent touch positions from the root view coordinate
 // space to the target view coordinate space.
-void TransformEventTouchPositions(
-    blink::WebTouchEvent* event,
-    content::RenderWidgetHostViewBase* root_view,
-    content::RenderWidgetHostViewBase* target_view) {
-  if (!target_view || target_view == root_view)
-    return;
-
+void TransformEventTouchPositions(blink::WebTouchEvent* event,
+                                  const gfx::Vector2dF& delta) {
   for (unsigned i = 0; i < event->touches_length; ++i) {
-    gfx::PointF transformed_point(event->touches[i].PositionInWidget());
-    // TODO(wjmaclean): For multiple touch points this might be inefficient;
-    // we should investigate whether it's better to transform arrays of
-    // points all at once.
-    if (root_view->TransformPointToCoordSpaceForView(
-            event->touches[i].PositionInWidget(), target_view,
-            &transformed_point)) {
-      event->touches[i].SetPositionInWidget(transformed_point.x(),
-                                            transformed_point.y());
-    }
+    event->touches[i].SetPositionInWidget(
+        event->touches[i].PositionInWidget().x + delta.x(),
+        event->touches[i].PositionInWidget().y + delta.y());
   }
 }
 
@@ -262,6 +250,10 @@
                  ->delegate()
                  ->GetMouseLockWidget()
                  ->GetView();
+    if (!root_view->TransformPointToCoordSpaceForView(
+            event.PositionInWidget(), target, &transformed_point)) {
+      return {nullptr, false, base::nullopt};
+    }
     return {target, false, transformed_point};
   }
 
@@ -272,7 +264,9 @@
           viz::EventSource::MOUSE, &transformed_point);
       return {result.view, result.should_query_view, transformed_point};
     }
-    return {target, false, transformed_point};
+    // For non-begin events, the target found for the previous phaseBegan is
+    // used.
+    return {nullptr, false, base::nullopt};
   }
 
   auto result = FindViewAtLocation(root_view, event.PositionInWidget(),
@@ -386,15 +380,23 @@
     RenderWidgetHostViewBase* root_view,
     RenderWidgetHostViewBase* target,
     const blink::WebMouseWheelEvent& mouse_wheel_event,
-    const ui::LatencyInfo& latency) {
+    const ui::LatencyInfo& latency,
+    const base::Optional<gfx::PointF>& target_location) {
+  base::Optional<gfx::PointF> point_in_target = target_location;
   if (!root_view->IsMouseLocked() &&
       root_view->wheel_scroll_latching_enabled()) {
     if (mouse_wheel_event.phase == blink::WebMouseWheelEvent::kPhaseBegan) {
       wheel_target_.target = target;
+      if (target_location.has_value()) {
+        wheel_target_.delta =
+            target_location.value() - mouse_wheel_event.PositionInWidget();
+      }
     } else {
       if (wheel_target_.target) {
-        DCHECK(!target);
+        DCHECK(!target && !target_location.has_value());
         target = wheel_target_.target;
+        point_in_target.emplace(mouse_wheel_event.PositionInWidget() +
+                                wheel_target_.delta);
       } else if ((mouse_wheel_event.phase ==
                       blink::WebMouseWheelEvent::kPhaseEnded ||
                   mouse_wheel_event.momentum_phase ==
@@ -419,17 +421,16 @@
                              INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
     return;
   }
-
-  gfx::PointF point_in_target;
-  if (!root_view->TransformPointToCoordSpaceForView(
-          mouse_wheel_event.PositionInWidget(), target, &point_in_target)) {
-    root_view->WheelEventAck(mouse_wheel_event,
-                             INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
-    return;
-  }
+  // If target_location doesn't have a value, it can be for two reasons:
+  // 1. |target| is null, in which case we would have early returned from the
+  // check above.
+  // 2. Wheel scroll latching is enabled and the event we are receiving is not
+  // a phaseBegan, in which case we should have got a valid |point_in_target|
+  // from wheel_target_.delta above.
+  DCHECK(point_in_target.has_value());
 
   blink::WebMouseWheelEvent event = mouse_wheel_event;
-  event.SetPositionInWidget(point_in_target.x(), point_in_target.y());
+  event.SetPositionInWidget(point_in_target->x(), point_in_target->y());
   target->ProcessMouseWheelEvent(event, latency);
 
   DCHECK(root_view->wheel_scroll_latching_enabled() || !wheel_target_.target);
@@ -531,13 +532,22 @@
     RenderWidgetHostViewBase* root_view,
     RenderWidgetHostViewBase* target,
     const blink::WebTouchEvent& touch_event,
-    const ui::LatencyInfo& latency) {
+    const ui::LatencyInfo& latency,
+    const base::Optional<gfx::PointF>& target_location) {
   DCHECK(blink::WebInputEvent::IsTouchEventType(touch_event.GetType()) &&
          touch_event.GetType() != blink::WebInputEvent::kTouchScrollStarted);
 
   bool is_sequence_start = !touch_target_.target && target;
   if (is_sequence_start) {
     touch_target_.target = target;
+    // TODO(wjmaclean): Instead of just computing a delta, we should extract
+    // the complete transform. We assume it doesn't change for the duration
+    // of the touch sequence, though this could be wrong; a better approach
+    // might be to always transform each point to the |touch_target_.target|
+    // for the duration of the sequence.
+    DCHECK(target_location.has_value());
+    touch_target_.delta =
+        target_location.value() - touch_event.touches[0].PositionInWidget();
 
     DCHECK(touchscreen_gesture_target_map_.find(
                touch_event.unique_touch_event_id) ==
@@ -575,7 +585,7 @@
   }
 
   blink::WebTouchEvent event(touch_event);
-  TransformEventTouchPositions(&event, root_view, touch_target_.target);
+  TransformEventTouchPositions(&event, touch_target_.delta);
   touch_target_.target->ProcessTouchEvent(event, latency);
 
   if (!active_touches_)
@@ -990,7 +1000,8 @@
     RenderWidgetHostViewBase* root_view,
     RenderWidgetHostViewBase* target,
     const blink::WebGestureEvent& gesture_event,
-    const ui::LatencyInfo& latency) {
+    const ui::LatencyInfo& latency,
+    const base::Optional<gfx::PointF>& target_location) {
   if (gesture_event.GetType() == blink::WebInputEvent::kGesturePinchBegin) {
     in_touchscreen_gesture_pinch_ = true;
     // If the root view wasn't already receiving the gesture stream, then we
@@ -1048,6 +1059,9 @@
     // RenderWidgetTargeter. These gesture events should always have a
     // unique_touch_event_id of 0.
     touchscreen_gesture_target_.target = target;
+    DCHECK(target_location.has_value());
+    touchscreen_gesture_target_.delta =
+        target_location.value() - gfx::PointF(gesture_event.x, gesture_event.y);
   } else if (no_matching_id && is_gesture_start) {
     // A long-standing Windows issues where occasionally a GestureStart is
     // encountered with no targets in the event queue. We never had a repro for
@@ -1070,6 +1084,7 @@
     // don't worry about the fact we're ignoring |result.should_query_view|, as
     // this is the best we can do until we fix https://crbug.com/595422.
     touchscreen_gesture_target_.target = result.view;
+    touchscreen_gesture_target_.delta = transformed_point - original_point;
   } else if (is_gesture_start) {
     touchscreen_gesture_target_ = gesture_target_it->second;
     touchscreen_gesture_target_map_.erase(gesture_target_it);
@@ -1091,19 +1106,10 @@
     return;
   }
 
+  // TODO(wjmaclean): Add SetPositionInWidget() to WebGestureEvent.
   blink::WebGestureEvent event(gesture_event);
-  gfx::PointF transformed_point;
-  if (root_view->TransformPointToCoordSpaceForView(
-          gesture_event.PositionInWidget(), touchscreen_gesture_target_.target,
-          &transformed_point)) {
-    // TODO(wjmaclean): Add SetPositionInWidget() to WebGestureEvent.
-    event.x = transformed_point.x();
-    event.y = transformed_point.y();
-  } else {
-    // TODO(wjmaclean): we can get here in Android tests. We should figure out
-    // why, then make this a NOTREACHED().
-    LOG(ERROR) << "Unable to convert event coordinates.";
-  }
+  event.x += touchscreen_gesture_target_.delta.x();
+  event.y += touchscreen_gesture_target_.delta.y();
   touchscreen_gesture_target_.target->ProcessGestureEvent(event, latency);
 }
 
@@ -1112,10 +1118,7 @@
     blink::WebGestureEvent* event,
     const ui::LatencyInfo& latency) {
   DCHECK_EQ(blink::kWebGestureDeviceTouchscreen, event->source_device);
-  RenderWidgetTargetResult event_target =
-      FindTouchscreenGestureEventTarget(root_view, *event);
-  DispatchTouchscreenGestureEvent(root_view, event_target.view, *event,
-                                  latency);
+  event_targeter_->FindTargetAndDispatch(root_view, *event, latency);
 }
 
 RenderWidgetTargetResult
@@ -1145,9 +1148,18 @@
     RenderWidgetHostViewBase* root_view,
     RenderWidgetHostViewBase* target,
     const blink::WebGestureEvent& touchpad_gesture_event,
-    const ui::LatencyInfo& latency) {
+    const ui::LatencyInfo& latency,
+    const base::Optional<gfx::PointF>& target_location) {
   if (target) {
     touchpad_gesture_target_.target = target;
+    // TODO(mohsen): Instead of just computing a delta, we should extract the
+    // complete transform. We assume it doesn't change for the duration of the
+    // touchpad gesture sequence, though this could be wrong; a better approach
+    // might be to always transform each point to the
+    // |touchpad_gesture_target_.target| for the duration of the sequence.
+    DCHECK(target_location.has_value());
+    touchpad_gesture_target_.delta =
+        target_location.value() - touchpad_gesture_event.PositionInWidget();
 
     // Abort any scroll bubbling in progress to avoid double entry.
     if (touchpad_gesture_target_.target &&
@@ -1166,19 +1178,10 @@
     return;
   }
 
-  gfx::PointF point_in_target;
-  if (!root_view->TransformPointToCoordSpaceForView(
-          touchpad_gesture_event.PositionInWidget(),
-          touchpad_gesture_target_.target, &point_in_target)) {
-    root_view->GestureEventAck(touchpad_gesture_event,
-                               INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
-    return;
-  }
-
   blink::WebGestureEvent gesture_event = touchpad_gesture_event;
   // TODO(mohsen): Add tests to check event location.
-  gesture_event.x = point_in_target.x();
-  gesture_event.y = point_in_target.y();
+  gesture_event.x += touchpad_gesture_target_.delta.x();
+  gesture_event.y += touchpad_gesture_target_.delta.y();
   touchpad_gesture_target_.target->ProcessGestureEvent(gesture_event, latency);
 }
 
@@ -1231,7 +1234,8 @@
     RenderWidgetHostViewBase* root_view,
     RenderWidgetHostViewBase* target,
     const blink::WebInputEvent& event,
-    const ui::LatencyInfo& latency) {
+    const ui::LatencyInfo& latency,
+    const base::Optional<gfx::PointF>& target_location) {
   if (blink::WebInputEvent::IsMouseEventType(event.GetType())) {
     DispatchMouseEvent(root_view, target,
                        static_cast<const blink::WebMouseEvent&>(event),
@@ -1241,26 +1245,27 @@
   if (event.GetType() == blink::WebInputEvent::kMouseWheel) {
     DispatchMouseWheelEvent(
         root_view, target, static_cast<const blink::WebMouseWheelEvent&>(event),
-        latency);
+        latency, target_location);
     return;
   }
   if (blink::WebInputEvent::IsTouchEventType(event.GetType())) {
     DispatchTouchEvent(root_view, target,
-                       static_cast<const blink::WebTouchEvent&>(event),
-                       latency);
+                       static_cast<const blink::WebTouchEvent&>(event), latency,
+                       target_location);
     return;
   }
   if (blink::WebInputEvent::IsGestureEventType(event.GetType())) {
     auto gesture_event = static_cast<const blink::WebGestureEvent&>(event);
     if (gesture_event.source_device ==
         blink::WebGestureDevice::kWebGestureDeviceTouchscreen) {
-      DispatchTouchscreenGestureEvent(root_view, target, gesture_event,
-                                      latency);
+      DispatchTouchscreenGestureEvent(root_view, target, gesture_event, latency,
+                                      target_location);
       return;
     }
     if (gesture_event.source_device ==
         blink::WebGestureDevice::kWebGestureDeviceTouchpad) {
-      DispatchTouchpadGestureEvent(root_view, target, gesture_event, latency);
+      DispatchTouchpadGestureEvent(root_view, target, gesture_event, latency,
+                                   target_location);
       return;
     }
   }
diff --git a/content/browser/renderer_host/render_widget_host_input_event_router.h b/content/browser/renderer_host/render_widget_host_input_event_router.h
index d5da50b7..f69037a3 100644
--- a/content/browser/renderer_host/render_widget_host_input_event_router.h
+++ b/content/browser/renderer_host/render_widget_host_input_event_router.h
@@ -158,7 +158,8 @@
       RenderWidgetHostViewBase* root_view,
       RenderWidgetHostViewBase* target,
       const blink::WebGestureEvent& touchpad_gesture_event,
-      const ui::LatencyInfo& latency);
+      const ui::LatencyInfo& latency,
+      const base::Optional<gfx::PointF>& target_location);
 
   // MouseMove/Enter/Leave events might need to be processed by multiple frames
   // in different processes for MouseEnter and MouseLeave event handlers to
@@ -203,27 +204,32 @@
       RenderWidgetHostViewBase* root_view,
       RenderWidgetHostViewBase* target,
       const blink::WebMouseWheelEvent& mouse_wheel_event,
-      const ui::LatencyInfo& latency);
+      const ui::LatencyInfo& latency,
+      const base::Optional<gfx::PointF>& target_location);
   // Assumes |touch_event| has coordinates in the root view's coordinate space.
   void DispatchTouchEvent(RenderWidgetHostViewBase* root_view,
                           RenderWidgetHostViewBase* target,
                           const blink::WebTouchEvent& touch_event,
-                          const ui::LatencyInfo& latency);
+                          const ui::LatencyInfo& latency,
+                          const base::Optional<gfx::PointF>& target_location);
   // Assumes |gesture_event| has coordinates in root view's coordinate space.
   void DispatchTouchscreenGestureEvent(
       RenderWidgetHostViewBase* root_view,
       RenderWidgetHostViewBase* target,
       const blink::WebGestureEvent& gesture_event,
-      const ui::LatencyInfo& latency);
+      const ui::LatencyInfo& latency,
+      const base::Optional<gfx::PointF>& target_location);
 
   // RenderWidgetTargeter::Delegate:
   RenderWidgetTargetResult FindTargetSynchronously(
       RenderWidgetHostViewBase* root_view,
       const blink::WebInputEvent& event) override;
-  void DispatchEventToTarget(RenderWidgetHostViewBase* root_view,
-                             RenderWidgetHostViewBase* target,
-                             const blink::WebInputEvent& event,
-                             const ui::LatencyInfo& latency) override;
+  void DispatchEventToTarget(
+      RenderWidgetHostViewBase* root_view,
+      RenderWidgetHostViewBase* target,
+      const blink::WebInputEvent& event,
+      const ui::LatencyInfo& latency,
+      const base::Optional<gfx::PointF>& target_location) override;
   RenderWidgetHostViewBase* FindViewFromFrameSinkId(
       const viz::FrameSinkId& frame_sink_id) const override;
 
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index fcd772d..5bebf77 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2377,6 +2377,8 @@
 
   const TextInputState* state = text_input_manager_->GetTextInputState();
   if (state && state->show_ime_if_needed &&
+      state->type != ui::TEXT_INPUT_TYPE_NONE &&
+      state->mode != ui::TEXT_INPUT_MODE_NONE &&
       GetInputMethod()->GetTextInputClient() == this) {
     GetInputMethod()->ShowImeIfNeeded();
   }
diff --git a/content/browser/renderer_host/render_widget_targeter.cc b/content/browser/renderer_host/render_widget_targeter.cc
index 7c5591e..5bde7d58 100644
--- a/content/browser/renderer_host/render_widget_targeter.cc
+++ b/content/browser/renderer_host/render_widget_targeter.cc
@@ -268,7 +268,8 @@
                                       target_location->y());
     }
     if (mouse_event.GetType() != blink::WebInputEvent::kUndefined)
-      delegate_->DispatchEventToTarget(root_view, target, mouse_event, latency);
+      delegate_->DispatchEventToTarget(root_view, target, mouse_event, latency,
+                                       target_location);
   } else if (event.GetType() == blink::WebInputEvent::kMouseWheel ||
              blink::WebInputEvent::IsTouchEventType(event.GetType()) ||
              blink::WebInputEvent::IsGestureEventType(event.GetType())) {
@@ -277,7 +278,8 @@
                 blink::WebGestureDevice::kWebGestureDeviceTouchscreen ||
             static_cast<const blink::WebGestureEvent&>(event).source_device ==
                 blink::WebGestureDevice::kWebGestureDeviceTouchpad));
-    delegate_->DispatchEventToTarget(root_view, target, event, latency);
+    delegate_->DispatchEventToTarget(root_view, target, event, latency,
+                                     target_location);
   } else {
     NOTREACHED();
     return;
diff --git a/content/browser/renderer_host/render_widget_targeter.h b/content/browser/renderer_host/render_widget_targeter.h
index e5feaab..a3a4f648 100644
--- a/content/browser/renderer_host/render_widget_targeter.h
+++ b/content/browser/renderer_host/render_widget_targeter.h
@@ -57,10 +57,13 @@
         RenderWidgetHostViewBase* root_view,
         const blink::WebInputEvent& event) = 0;
 
-    virtual void DispatchEventToTarget(RenderWidgetHostViewBase* root_view,
-                                       RenderWidgetHostViewBase* target,
-                                       const blink::WebInputEvent& event,
-                                       const ui::LatencyInfo& latency) = 0;
+    // |event| is in |root_view|'s coordinate space.
+    virtual void DispatchEventToTarget(
+        RenderWidgetHostViewBase* root_view,
+        RenderWidgetHostViewBase* target,
+        const blink::WebInputEvent& event,
+        const ui::LatencyInfo& latency,
+        const base::Optional<gfx::PointF>& target_location) = 0;
 
     virtual RenderWidgetHostViewBase* FindViewFromFrameSinkId(
         const viz::FrameSinkId& frame_sink_id) const = 0;
diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc
index 60fa2ff2..05c2b5e 100644
--- a/content/browser/security_exploit_browsertest.cc
+++ b/content/browser/security_exploit_browsertest.cc
@@ -35,7 +35,6 @@
 #include "content/public/common/browser_side_navigation_policy.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/file_chooser_params.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "content/public/test/browser_test_utils.h"
 #include "content/public/test/content_browser_test.h"
 #include "content/public/test/content_browser_test_utils.h"
@@ -53,6 +52,7 @@
 #include "net/test/url_request/url_request_slow_download_job.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "third_party/WebKit/public/web/WebTriggeringEventInfo.h"
 
 using IPC::IpcSecurityTestUtil;
@@ -188,11 +188,12 @@
       int route_id,
       int request_id,
       const network::ResourceRequest& request) {
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     TestURLLoaderClient client;
     filter->CreateLoaderAndStart(
         mojo::MakeRequest(&loader), route_id, request_id,
-        mojom::kURLLoadOptionNone, request, client.CreateInterfacePtr(),
+        network::mojom::kURLLoadOptionNone, request,
+        client.CreateInterfacePtr(),
         net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
   }
 
diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc
index 8fef488..a53041ee 100644
--- a/content/browser/service_worker/embedded_worker_instance.cc
+++ b/content/browser/service_worker/embedded_worker_instance.cc
@@ -697,7 +697,7 @@
 void EmbeddedWorkerInstance::OnReadyForInspection() {
   if (devtools_proxy_) {
     blink::mojom::DevToolsAgentAssociatedPtrInfo devtools_agent_ptr_info;
-    client_->GetDevToolsAgent(mojo::MakeRequest(&devtools_agent_ptr_info));
+    client_->BindDevToolsAgent(mojo::MakeRequest(&devtools_agent_ptr_info));
     devtools_proxy_->NotifyWorkerReadyForInspection(
         std::move(devtools_agent_ptr_info));
   }
diff --git a/content/browser/service_worker/embedded_worker_test_helper.h b/content/browser/service_worker/embedded_worker_test_helper.h
index 3e05321..97c656e 100644
--- a/content/browser/service_worker/embedded_worker_test_helper.h
+++ b/content/browser/service_worker/embedded_worker_test_helper.h
@@ -84,7 +84,7 @@
     void ResumeAfterDownload() override;
     void AddMessageToConsole(blink::WebConsoleMessage::Level level,
                              const std::string& message) override;
-    void GetDevToolsAgent(
+    void BindDevToolsAgent(
         blink::mojom::DevToolsAgentAssociatedRequest request) override {}
 
     base::WeakPtr<EmbeddedWorkerTestHelper> helper_;
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc
index f89afae..5ac5504 100644
--- a/content/browser/service_worker/service_worker_browsertest.cc
+++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -2252,10 +2252,11 @@
 }
 
 // When the content type of the page is not correctly set,
-// OnStartLoadingResponseBody() of mojom::URLLoaderClient is called before
-// OnReceiveResponse(). This behavior is caused by MimeSniffingResourceHandler.
-// This test checks that even if the MimeSniffingResourceHandler is triggered
-// navigation preload must be handled correctly.
+// OnStartLoadingResponseBody() of network::mojom::URLLoaderClient is called
+// before OnReceiveResponse(). This behavior is caused by
+// MimeSniffingResourceHandler. This test checks that even if the
+// MimeSniffingResourceHandler is triggered navigation preload must be handled
+// correctly.
 IN_PROC_BROWSER_TEST_F(ServiceWorkerNavigationPreloadTest,
                        RespondWithNavigationPreloadWithMimeSniffing) {
   const char kPageUrl[] = "/service_worker/navigation_preload.html";
diff --git a/content/browser/service_worker/service_worker_client_utils.cc b/content/browser/service_worker/service_worker_client_utils.cc
index 7a7fd67..1b8025a 100644
--- a/content/browser/service_worker/service_worker_client_utils.cc
+++ b/content/browser/service_worker/service_worker_client_utils.cc
@@ -257,48 +257,6 @@
   new OpenURLObserver(web_contents, frame_tree_node_id, callback);
 }
 
-void DidNavigate(const base::WeakPtr<ServiceWorkerContextCore>& context,
-                 const GURL& origin,
-                 const NavigationCallback& callback,
-                 int render_process_id,
-                 int render_frame_id) {
-  DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
-  if (!context) {
-    callback.Run(SERVICE_WORKER_ERROR_ABORT,
-                 blink::mojom::ServiceWorkerClientInfo());
-    return;
-  }
-
-  if (render_process_id == ChildProcessHost::kInvalidUniqueID &&
-      render_frame_id == MSG_ROUTING_NONE) {
-    callback.Run(SERVICE_WORKER_ERROR_FAILED,
-                 blink::mojom::ServiceWorkerClientInfo());
-    return;
-  }
-
-  for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
-           context->GetClientProviderHostIterator(origin);
-       !it->IsAtEnd(); it->Advance()) {
-    ServiceWorkerProviderHost* provider_host = it->GetProviderHost();
-    if (provider_host->process_id() != render_process_id ||
-        provider_host->frame_id() != render_frame_id) {
-      continue;
-    }
-    BrowserThread::PostTaskAndReplyWithResult(
-        BrowserThread::UI, FROM_HERE,
-        base::Bind(&GetWindowClientInfoOnUI, provider_host->process_id(),
-                   provider_host->route_id(), provider_host->create_time(),
-                   provider_host->client_uuid()),
-        base::Bind(callback, SERVICE_WORKER_OK));
-    return;
-  }
-
-  // If here, it means that no provider_host was found, in which case, the
-  // renderer should still be informed that the window was opened.
-  callback.Run(SERVICE_WORKER_OK, blink::mojom::ServiceWorkerClientInfo());
-}
-
 void AddWindowClient(
     ServiceWorkerProviderHost* host,
     std::vector<std::tuple<int, int, base::TimeTicks, std::string>>*
@@ -569,5 +527,47 @@
                       std::move(clients));
 }
 
+void DidNavigate(const base::WeakPtr<ServiceWorkerContextCore>& context,
+                 const GURL& origin,
+                 const NavigationCallback& callback,
+                 int render_process_id,
+                 int render_frame_id) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+  if (!context) {
+    callback.Run(SERVICE_WORKER_ERROR_ABORT,
+                 blink::mojom::ServiceWorkerClientInfo());
+    return;
+  }
+
+  if (render_process_id == ChildProcessHost::kInvalidUniqueID &&
+      render_frame_id == MSG_ROUTING_NONE) {
+    callback.Run(SERVICE_WORKER_ERROR_FAILED,
+                 blink::mojom::ServiceWorkerClientInfo());
+    return;
+  }
+
+  for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
+           context->GetClientProviderHostIterator(origin);
+       !it->IsAtEnd(); it->Advance()) {
+    ServiceWorkerProviderHost* provider_host = it->GetProviderHost();
+    if (provider_host->process_id() != render_process_id ||
+        provider_host->frame_id() != render_frame_id) {
+      continue;
+    }
+    BrowserThread::PostTaskAndReplyWithResult(
+        BrowserThread::UI, FROM_HERE,
+        base::Bind(&GetWindowClientInfoOnUI, provider_host->process_id(),
+                   provider_host->route_id(), provider_host->create_time(),
+                   provider_host->client_uuid()),
+        base::Bind(callback, SERVICE_WORKER_OK));
+    return;
+  }
+
+  // If here, it means that no provider_host was found, in which case, the
+  // renderer should still be informed that the window was opened.
+  callback.Run(SERVICE_WORKER_OK, blink::mojom::ServiceWorkerClientInfo());
+}
+
 }  // namespace service_worker_client_utils
 }  // namespace content
diff --git a/content/browser/service_worker/service_worker_client_utils.h b/content/browser/service_worker/service_worker_client_utils.h
index 87ed835..4c68b3f 100644
--- a/content/browser/service_worker/service_worker_client_utils.h
+++ b/content/browser/service_worker/service_worker_client_utils.h
@@ -70,6 +70,16 @@
                 blink::mojom::ServiceWorkerClientQueryOptionsPtr options,
                 const ClientsCallback& callback);
 
+// Finds the provider host for |origin| in |context| then uses
+// |render_process_id| and |render_process_host| to create a relevant
+// blink::mojom::ServiceWorkerClientInfo struct and calls |callback| with it.
+// Must be called on the IO thread.
+void DidNavigate(const base::WeakPtr<ServiceWorkerContextCore>& context,
+                 const GURL& origin,
+                 const NavigationCallback& callback,
+                 int render_process_id,
+                 int render_frame_id);
+
 }  // namespace service_worker_client_utils
 
 }  // namespace content
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
index 17218a1..2e726ca 100644
--- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc
+++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc
@@ -48,9 +48,9 @@
 
 // This class wraps a mojo::AssociatedInterfacePtr<URLLoader>. It also is a
 // URLLoader implementation and delegates URLLoader calls to the wrapped loader.
-class DelegatingURLLoader final : public mojom::URLLoader {
+class DelegatingURLLoader final : public network::mojom::URLLoader {
  public:
-  explicit DelegatingURLLoader(mojom::URLLoaderPtr loader)
+  explicit DelegatingURLLoader(network::mojom::URLLoaderPtr loader)
       : binding_(this), loader_(std::move(loader)) {}
   ~DelegatingURLLoader() override {}
 
@@ -69,8 +69,8 @@
     loader_->ResumeReadingBodyFromNet();
   }
 
-  mojom::URLLoaderPtr CreateInterfacePtrAndBind() {
-    mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr CreateInterfacePtrAndBind() {
+    network::mojom::URLLoaderPtr loader;
     binding_.Bind(mojo::MakeRequest(&loader));
     // This unretained pointer is safe, because |binding_| is owned by |this|
     // and the callback will never be called after |this| is destroyed.
@@ -80,14 +80,15 @@
   }
 
  private:
-  // Called when the mojom::URLLoaderPtr in the service worker is deleted.
+  // Called when the network::mojom::URLLoaderPtr in the service worker is
+  // deleted.
   void Cancel() {
     // Cancel loading as stated in url_loader.mojom.
     loader_ = nullptr;
   }
 
-  mojo::Binding<mojom::URLLoader> binding_;
-  mojom::URLLoaderPtr loader_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
+  network::mojom::URLLoaderPtr loader_;
 
   DISALLOW_COPY_AND_ASSIGN(DelegatingURLLoader);
 };
@@ -125,10 +126,10 @@
 // network request. It watches as the response comes in, and pipes the response
 // back to the service worker while also doing extra processing like notifying
 // DevTools.
-class DelegatingURLLoaderClient final : public mojom::URLLoaderClient {
+class DelegatingURLLoaderClient final : public network::mojom::URLLoaderClient {
  public:
   using WorkerId = std::pair<int, int>;
-  explicit DelegatingURLLoaderClient(mojom::URLLoaderClientPtr client,
+  explicit DelegatingURLLoaderClient(network::mojom::URLLoaderClientPtr client,
                                      base::OnceClosure on_response,
                                      const network::ResourceRequest& request)
       : binding_(this),
@@ -173,7 +174,7 @@
   void OnReceiveResponse(
       const network::ResourceResponseHead& head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     client_->OnReceiveResponse(head, ssl_info, std::move(downloaded_file));
     DCHECK(on_response_);
     std::move(on_response_).Run();
@@ -206,7 +207,7 @@
         base::Bind(&NotifyNavigationPreloadCompletedOnUI, status));
   }
 
-  void Bind(mojom::URLLoaderClientPtr* ptr_info) {
+  void Bind(network::mojom::URLLoaderClientPtr* ptr_info) {
     binding_.Bind(mojo::MakeRequest(ptr_info));
   }
 
@@ -228,8 +229,8 @@
     MaybeRunDevToolsCallbacks();
   }
 
-  mojo::Binding<mojom::URLLoaderClient> binding_;
-  mojom::URLLoaderClientPtr client_;
+  mojo::Binding<network::mojom::URLLoaderClient> binding_;
+  network::mojom::URLLoaderClientPtr client_;
   base::OnceClosure on_response_;
   bool completed_ = false;
   const GURL url_;
@@ -430,8 +431,8 @@
 class ServiceWorkerFetchDispatcher::URLLoaderAssets
     : public base::RefCounted<ServiceWorkerFetchDispatcher::URLLoaderAssets> {
  public:
-  URLLoaderAssets(mojom::URLLoaderFactoryPtr url_loader_factory,
-                  std::unique_ptr<mojom::URLLoader> url_loader,
+  URLLoaderAssets(network::mojom::URLLoaderFactoryPtr url_loader_factory,
+                  std::unique_ptr<network::mojom::URLLoader> url_loader,
                   std::unique_ptr<DelegatingURLLoaderClient> url_loader_client)
       : url_loader_factory_(std::move(url_loader_factory)),
         url_loader_(std::move(url_loader)),
@@ -446,8 +447,8 @@
   friend class base::RefCounted<URLLoaderAssets>;
   virtual ~URLLoaderAssets() {}
 
-  mojom::URLLoaderFactoryPtr url_loader_factory_;
-  std::unique_ptr<mojom::URLLoader> url_loader_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_;
+  std::unique_ptr<network::mojom::URLLoader> url_loader_;
   std::unique_ptr<DelegatingURLLoaderClient> url_loader_client_;
 
   DISALLOW_COPY_AND_ASSIGN(URLLoaderAssets);
@@ -685,7 +686,7 @@
 
   DCHECK(!url_loader_assets_);
 
-  mojom::URLLoaderFactoryPtr url_loader_factory;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory;
   URLLoaderFactoryImpl::Create(
       ResourceRequesterInfo::CreateForNavigationPreload(requester_info),
       mojo::MakeRequest(&url_loader_factory),
@@ -727,19 +728,20 @@
   DCHECK_LT(request_id, -1);
 
   preload_handle_ = mojom::FetchEventPreloadHandle::New();
-  mojom::URLLoaderClientPtr url_loader_client_ptr;
+  network::mojom::URLLoaderClientPtr url_loader_client_ptr;
   preload_handle_->url_loader_client_request =
       mojo::MakeRequest(&url_loader_client_ptr);
   auto url_loader_client = std::make_unique<DelegatingURLLoaderClient>(
       std::move(url_loader_client_ptr), std::move(on_response), request);
-  mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass;
+  network::mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass;
   url_loader_client->Bind(&url_loader_client_ptr_to_pass);
-  mojom::URLLoaderPtr url_loader_associated_ptr;
+  network::mojom::URLLoaderPtr url_loader_associated_ptr;
 
   url_loader_factory->CreateLoaderAndStart(
       mojo::MakeRequest(&url_loader_associated_ptr),
-      original_info->GetRouteID(), request_id, mojom::kURLLoadOptionNone,
-      request, std::move(url_loader_client_ptr_to_pass),
+      original_info->GetRouteID(), request_id,
+      network::mojom::kURLLoadOptionNone, request,
+      std::move(url_loader_client_ptr_to_pass),
       net::MutableNetworkTrafficAnnotationTag(
           original_request->traffic_annotation()));
 
@@ -790,7 +792,7 @@
 
   // Create the DelegatingURLLoaderClient, which becomes the
   // URLLoaderClient for the navigation preload network request.
-  mojom::URLLoaderClientPtr url_loader_client_ptr;
+  network::mojom::URLLoaderClientPtr url_loader_client_ptr;
   preload_handle_->url_loader_client_request =
       mojo::MakeRequest(&url_loader_client_ptr);
   auto url_loader_client = std::make_unique<DelegatingURLLoaderClient>(
@@ -799,13 +801,13 @@
 
   // Start the network request for the URL using the network loader.
   // TODO(falken): What to do about routing_id, request_id?
-  mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass;
+  network::mojom::URLLoaderClientPtr url_loader_client_ptr_to_pass;
   url_loader_client->Bind(&url_loader_client_ptr_to_pass);
-  mojom::URLLoaderPtr url_loader_associated_ptr;
+  network::mojom::URLLoaderPtr url_loader_associated_ptr;
   url_loader_factory_getter->GetNetworkFactory()->CreateLoaderAndStart(
       mojo::MakeRequest(&url_loader_associated_ptr), -1 /* routing_id? */,
-      -1 /* request_id? */, mojom::kURLLoadOptionNone, resource_request,
-      std::move(url_loader_client_ptr_to_pass),
+      -1 /* request_id? */, network::mojom::kURLLoadOptionNone,
+      resource_request, std::move(url_loader_client_ptr_to_pass),
       net::MutableNetworkTrafficAnnotationTag(
           kNavigationPreloadTrafficAnnotation));
 
@@ -820,7 +822,7 @@
   // Unlike the non-S13N code path, we don't own the URLLoaderFactory being used
   // (it's the generic network factory), so we don't need to pass it to
   // URLLoaderAssets to keep it alive.
-  mojom::URLLoaderFactoryPtr null_factory;
+  network::mojom::URLLoaderFactoryPtr null_factory;
   url_loader_assets_ = base::MakeRefCounted<URLLoaderAssets>(
       std::move(null_factory), std::move(url_loader),
       std::move(url_loader_client));
diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.h b/content/browser/service_worker/service_worker_fetch_dispatcher.h
index d60c23f8..8681ca9a2 100644
--- a/content/browser/service_worker/service_worker_fetch_dispatcher.h
+++ b/content/browser/service_worker/service_worker_fetch_dispatcher.h
@@ -19,10 +19,10 @@
 #include "content/common/service_worker/service_worker_status_code.h"
 #include "content/common/service_worker/service_worker_types.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "net/log/net_log_with_source.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/common/blob/blob.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_event_status.mojom.h"
 
diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc
index f89c79e..9e688a8 100644
--- a/content/browser/service_worker/service_worker_provider_host.cc
+++ b/content/browser/service_worker/service_worker_provider_host.cc
@@ -668,7 +668,8 @@
       scoped_refptr<ServiceWorkerRegistration>(registration));
   provider_info->client_request = mojo::MakeRequest(&container_);
 
-  mojom::URLLoaderFactoryAssociatedPtrInfo script_loader_factory_ptr_info;
+  network::mojom::URLLoaderFactoryAssociatedPtrInfo
+      script_loader_factory_ptr_info;
   if (ServiceWorkerUtils::IsServicificationEnabled()) {
     mojo::MakeStrongAssociatedBinding(
         std::make_unique<ServiceWorkerScriptURLLoaderFactory>(
diff --git a/content/browser/service_worker/service_worker_script_url_loader.cc b/content/browser/service_worker/service_worker_script_url_loader.cc
index 0d881b55..a7256a97 100644
--- a/content/browser/service_worker/service_worker_script_url_loader.cc
+++ b/content/browser/service_worker/service_worker_script_url_loader.cc
@@ -32,7 +32,7 @@
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& resource_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     scoped_refptr<ServiceWorkerVersion> version,
     scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation)
@@ -94,7 +94,7 @@
                                                      cache_resource_id);
   AdvanceState(State::kStarted);
 
-  mojom::URLLoaderClientPtr network_client;
+  network::mojom::URLLoaderClientPtr network_client;
   network_client_binding_.Bind(mojo::MakeRequest(&network_client));
   loader_factory_getter->GetNetworkFactory()->CreateLoaderAndStart(
       mojo::MakeRequest(&network_loader_), routing_id, request_id, options,
@@ -131,7 +131,7 @@
 void ServiceWorkerScriptURLLoader::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   if (!version_->context() || version_->is_redundant()) {
     CommitCompleted(network::URLLoaderCompletionStatus(net::ERR_FAILED));
     return;
diff --git a/content/browser/service_worker/service_worker_script_url_loader.h b/content/browser/service_worker/service_worker_script_url_loader.h
index 0e53e6f11..f687401 100644
--- a/content/browser/service_worker/service_worker_script_url_loader.h
+++ b/content/browser/service_worker/service_worker_script_url_loader.h
@@ -8,11 +8,11 @@
 #include "base/macros.h"
 #include "content/browser/service_worker/service_worker_version.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "services/network/public/cpp/net_adapters.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "url/gurl.h"
 
 namespace content {
@@ -45,21 +45,21 @@
 // worker. If the script is identical, the load succeeds but no script is
 // written, and ServiceWorkerVersion is told to terminate startup.
 class CONTENT_EXPORT ServiceWorkerScriptURLLoader
-    : public mojom::URLLoader,
-      public mojom::URLLoaderClient {
+    : public network::mojom::URLLoader,
+      public network::mojom::URLLoaderClient {
  public:
   ServiceWorkerScriptURLLoader(
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& resource_request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       scoped_refptr<ServiceWorkerVersion> version,
       scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter,
       const net::MutableNetworkTrafficAnnotationTag& traffic_annotation);
   ~ServiceWorkerScriptURLLoader() override;
 
-  // mojom::URLLoader:
+  // network::mojom::URLLoader:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -67,10 +67,11 @@
   void PauseReadingBodyFromNet() override;
   void ResumeReadingBodyFromNet() override;
 
-  // mojom::URLLoaderClient for the network load:
-  void OnReceiveResponse(const network::ResourceResponseHead& response_head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  // network::mojom::URLLoaderClient for the network load:
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& response_head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(
       const net::RedirectInfo& redirect_info,
       const network::ResourceResponseHead& response_head) override;
@@ -132,14 +133,14 @@
   std::unique_ptr<ServiceWorkerCacheWriter> cache_writer_;
 
   // Used for fetching the script from network.
-  mojom::URLLoaderPtr network_loader_;
-  mojo::Binding<mojom::URLLoaderClient> network_client_binding_;
+  network::mojom::URLLoaderPtr network_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> network_client_binding_;
   mojo::ScopedDataPipeConsumerHandle network_consumer_;
   mojo::SimpleWatcher network_watcher_;
   bool network_load_completed_ = false;
 
   // Used for responding with the fetched script to this loader's client.
-  mojom::URLLoaderClientPtr client_;
+  network::mojom::URLLoaderClientPtr client_;
   mojo::ScopedDataPipeProducerHandle client_producer_;
 
   State state_ = State::kNotStarted;
diff --git a/content/browser/service_worker/service_worker_script_url_loader_factory.cc b/content/browser/service_worker/service_worker_script_url_loader_factory.cc
index da41181..94af24f 100644
--- a/content/browser/service_worker/service_worker_script_url_loader_factory.cc
+++ b/content/browser/service_worker/service_worker_script_url_loader_factory.cc
@@ -30,12 +30,12 @@
     default;
 
 void ServiceWorkerScriptURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& resource_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   if (!ShouldHandleScriptRequest(resource_request)) {
     // If the request should not be handled by ServiceWorkerScriptURLLoader,
@@ -57,7 +57,7 @@
 }
 
 void ServiceWorkerScriptURLLoaderFactory::Clone(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   // This method is required to support synchronous requests which are not
   // performed during installation.
   NOTREACHED();
diff --git a/content/browser/service_worker/service_worker_script_url_loader_factory.h b/content/browser/service_worker/service_worker_script_url_loader_factory.h
index 946d9d5..9ca2f8c 100644
--- a/content/browser/service_worker/service_worker_script_url_loader_factory.h
+++ b/content/browser/service_worker/service_worker_script_url_loader_factory.h
@@ -6,7 +6,7 @@
 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_SCRIPT_URL_LOADER_FACTORY_H_
 
 #include "base/macros.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -19,7 +19,8 @@
 // installation, eventually). This is kept alive while
 // ServiceWorkerNetworkProvider in the renderer process is alive.
 // Used only when IsServicificationEnabled is true.
-class ServiceWorkerScriptURLLoaderFactory : public mojom::URLLoaderFactory {
+class ServiceWorkerScriptURLLoaderFactory
+    : public network::mojom::URLLoaderFactory {
  public:
   ServiceWorkerScriptURLLoaderFactory(
       base::WeakPtr<ServiceWorkerContextCore> context,
@@ -27,16 +28,16 @@
       scoped_refptr<URLLoaderFactoryGetter> loader_factory_getter);
   ~ServiceWorkerScriptURLLoaderFactory() override;
 
-  // mojom::URLLoaderFactory:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& resource_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
  private:
   bool ShouldHandleScriptRequest(
diff --git a/content/browser/service_worker/service_worker_script_url_loader_unittest.cc b/content/browser/service_worker/service_worker_script_url_loader_unittest.cc
index 4be5478..73df18d8 100644
--- a/content/browser/service_worker/service_worker_script_url_loader_unittest.cc
+++ b/content/browser/service_worker/service_worker_script_url_loader_unittest.cc
@@ -12,7 +12,6 @@
 #include "content/browser/service_worker/service_worker_context_core.h"
 #include "content/browser/service_worker/service_worker_disk_cache.h"
 #include "content/browser/url_loader_factory_getter.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/test_browser_thread_bundle.h"
 #include "content/public/test/test_url_loader_client.h"
 #include "mojo/common/data_pipe_utils.h"
@@ -23,6 +22,7 @@
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "net/url_request/redirect_info.h"
 #include "services/network/public/cpp/url_loader_completion_status.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_registration.mojom.h"
 
 namespace content {
@@ -65,18 +65,19 @@
 // instead of making it a common test helper because we might want to customize
 // the mock factory to add more tests later. Merge this and that if we're
 // convinced it's better.
-class MockNetworkURLLoaderFactory final : public mojom::URLLoaderFactory {
+class MockNetworkURLLoaderFactory final
+    : public network::mojom::URLLoaderFactory {
  public:
   explicit MockNetworkURLLoaderFactory(MockHTTPServer* mock_server)
       : mock_server_(mock_server) {}
 
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     const MockHTTPServer::Response& response =
@@ -114,7 +115,9 @@
     client->OnComplete(status);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest factory) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest factory) override {
+    NOTREACHED();
+  }
 
  private:
   // This is owned by ServiceWorkerScriptURLLoaderTest.
@@ -147,7 +150,7 @@
                           std::string("this body came from the network")));
 
     // Initialize URLLoaderFactory.
-    mojom::URLLoaderFactoryPtr test_loader_factory;
+    network::mojom::URLLoaderFactoryPtr test_loader_factory;
     mock_url_loader_factory_ =
         std::make_unique<MockNetworkURLLoaderFactory>(mock_server_.get());
     helper_->url_loader_factory_getter()->SetNetworkFactoryForTesting(
diff --git a/content/browser/service_worker/service_worker_url_job_wrapper.h b/content/browser/service_worker/service_worker_url_job_wrapper.h
index 4f6d1d8f..316936e 100644
--- a/content/browser/service_worker/service_worker_url_job_wrapper.h
+++ b/content/browser/service_worker/service_worker_url_job_wrapper.h
@@ -18,9 +18,9 @@
 
 // This class is a helper to support having
 // ServiceWorkerControlleeRequestHandler work with both URLRequestJobs and
-// mojom::URLLoaders (that is, both with and without --enable-network-service).
-// It wraps either a ServiceWorkerURLRequestJob or a callback for
-// URLLoader and forwards to the underlying implementation.
+// network::mojom::URLLoaders (that is, both with and without
+// --enable-network-service). It wraps either a ServiceWorkerURLRequestJob or a
+// callback for URLLoader and forwards to the underlying implementation.
 class ServiceWorkerURLJobWrapper {
  public:
   // A helper used by the ServiceWorkerURLLoaderJob or
diff --git a/content/browser/service_worker/service_worker_url_loader_job.cc b/content/browser/service_worker/service_worker_url_loader_job.cc
index 2e37e84..eeb05dec 100644
--- a/content/browser/service_worker/service_worker_url_loader_job.cc
+++ b/content/browser/service_worker/service_worker_url_loader_job.cc
@@ -263,8 +263,8 @@
     scoped_refptr<ServiceWorkerVersion> version,
     blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream,
     blink::mojom::BlobPtr body_as_blob,
-    mojom::URLLoaderRequest request,
-    mojom::URLLoaderClientPtr client) {
+    network::mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderClientPtr client) {
   DCHECK(!binding_.is_bound());
   DCHECK(!url_loader_client_.is_bound());
   binding_.Bind(std::move(request));
@@ -332,8 +332,8 @@
 }
 
 void ServiceWorkerURLLoaderJob::StartErrorResponse(
-    mojom::URLLoaderRequest request,
-    mojom::URLLoaderClientPtr client) {
+    network::mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderClientPtr client) {
   DCHECK_EQ(Status::kStarted, status_);
   DCHECK(!url_loader_client_.is_bound());
   url_loader_client_ = std::move(client);
diff --git a/content/browser/service_worker/service_worker_url_loader_job.h b/content/browser/service_worker/service_worker_url_loader_job.h
index 059a7957..bc839ec8 100644
--- a/content/browser/service_worker/service_worker_url_loader_job.h
+++ b/content/browser/service_worker/service_worker_url_loader_job.h
@@ -18,9 +18,9 @@
 #include "content/browser/url_loader_factory_getter.h"
 #include "content/common/service_worker/service_worker_status_code.h"
 #include "content/common/service_worker/service_worker_types.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "third_party/WebKit/common/blob/blob.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_stream_handle.mojom.h"
 
@@ -31,11 +31,12 @@
 
 // S13nServiceWorker:
 // ServiceWorkerURLLoaderJob works similar to ServiceWorkerURLRequestJob
-// but with mojom::URLLoader instead of URLRequest.
+// but with network::mojom::URLLoader instead of URLRequest.
 // This class is owned by the job wrapper until it is bound to a URLLoader
 // request. After it is bound |this| is kept alive until the Mojo connection
 // to this URLLoader is dropped.
-class CONTENT_EXPORT ServiceWorkerURLLoaderJob : public mojom::URLLoader {
+class CONTENT_EXPORT ServiceWorkerURLLoaderJob
+    : public network::mojom::URLLoader {
  public:
   using Delegate = ServiceWorkerURLJobWrapper::Delegate;
   using ResponseType = ServiceWorkerResponseType;
@@ -60,7 +61,8 @@
   // 4. Otherwise if the SW returned a stream or blob as a response
   //    this job calls |loader_callback| with a bound method for
   //    StartResponse().
-  // 5. Then StartResponse() will be called with mojom::URLLoaderClientPtr
+  // 5. Then StartResponse() will be called with
+  // network::mojom::URLLoaderClientPtr
   //    that is connected to NavigationURLLoaderNetworkService (for resource
   //    loading for navigation). This forwards the blob/stream data pipe to the
   //    NavigationURLLoader if the response body was sent as a blob/stream.
@@ -112,13 +114,13 @@
                      scoped_refptr<ServiceWorkerVersion> version,
                      blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream,
                      blink::mojom::BlobPtr body_as_blob,
-                     mojom::URLLoaderRequest request,
-                     mojom::URLLoaderClientPtr client);
+                     network::mojom::URLLoaderRequest request,
+                     network::mojom::URLLoaderClientPtr client);
 
   // Used as the StartLoaderCallback passed to |loader_callback_| on error.
   // Returns a network error to |client|.
-  void StartErrorResponse(mojom::URLLoaderRequest request,
-                          mojom::URLLoaderClientPtr client);
+  void StartErrorResponse(network::mojom::URLLoaderRequest request,
+                          network::mojom::URLLoaderClientPtr client);
 
   // Calls url_loader_client_->OnReceiveResopnse() with |response_head_|.
   void CommitResponseHeaders();
@@ -130,7 +132,7 @@
   // called once either StartResponse or StartErrorResponse is called.
   void ReturnNetworkError();
 
-  // mojom::URLLoader:
+  // network::mojom::URLLoader:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -158,8 +160,8 @@
   base::Optional<net::SSLInfo> ssl_info_;
 
   // Pointer to the URLLoaderClient (i.e. NavigationURLLoader).
-  mojom::URLLoaderClientPtr url_loader_client_;
-  mojo::Binding<mojom::URLLoader> binding_;
+  network::mojom::URLLoaderClientPtr url_loader_client_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
 
   enum class Status {
     kNotStarted,
diff --git a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
index 0cdd125..13ea86ca 100644
--- a/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
+++ b/content/browser/service_worker/service_worker_url_loader_job_unittest.cc
@@ -62,7 +62,8 @@
 // 6. Like all FetchEvent responses, the response is sent to
 //    ServiceWorkerURLLoaderJob::DidDispatchFetchEvent, and the
 //    StartLoaderCallback is returned.
-class NavigationPreloadLoaderClient final : public mojom::URLLoaderClient {
+class NavigationPreloadLoaderClient final
+    : public network::mojom::URLLoaderClient {
  public:
   NavigationPreloadLoaderClient(
       mojom::FetchEventPreloadHandlePtr preload_handle,
@@ -79,11 +80,11 @@
   }
   ~NavigationPreloadLoaderClient() override = default;
 
-  // mojom::URLLoaderClient implementation
+  // network::mojom::URLLoaderClient implementation
   void OnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     response_head_ = response_head;
   }
   void OnStartLoadingResponseBody(
@@ -135,8 +136,8 @@
   void OnConnectionError() { delete this; }
 
  private:
-  mojom::URLLoaderPtr url_loader_;
-  mojo::Binding<mojom::URLLoaderClient> binding_;
+  network::mojom::URLLoaderPtr url_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> binding_;
 
   network::ResourceResponseHead response_head_;
   mojo::ScopedDataPipeConsumerHandle body_;
@@ -154,17 +155,18 @@
 // ServiceWorkerURLLoaderJobTest sets the network factory for
 // ServiceWorkerContextCore to MockNetworkURLLoaderFactory. So far, it's only
 // used for navigation preload in these tests.
-class MockNetworkURLLoaderFactory final : public mojom::URLLoaderFactory {
+class MockNetworkURLLoaderFactory final
+    : public network::mojom::URLLoaderFactory {
  public:
   MockNetworkURLLoaderFactory() = default;
 
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     std::string headers = "HTTP/1.1 200 OK\n\n";
@@ -188,7 +190,9 @@
     client->OnComplete(status);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest factory) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest factory) override {
+    NOTREACHED();
+  }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockNetworkURLLoaderFactory);
@@ -609,7 +613,7 @@
   TestURLLoaderClient client_;
   bool was_main_resource_load_failed_called_ = false;
   std::unique_ptr<ServiceWorkerURLLoaderJob> job_;
-  mojom::URLLoaderPtr loader_;
+  network::mojom::URLLoaderPtr loader_;
   base::test::ScopedFeatureList feature_list_;
 };
 
diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc
index 779b594..4064b7b3 100644
--- a/content/browser/service_worker/service_worker_url_request_job.cc
+++ b/content/browser/service_worker/service_worker_url_request_job.cc
@@ -682,9 +682,9 @@
     blink::mojom::BlobPtr body_as_blob,
     scoped_refptr<ServiceWorkerVersion> version) {
   // Do not clear |fetch_dispatcher_| if it has dispatched a navigation preload
-  // request to keep the mojom::URLLoader related objects in it, because the
-  // preload response might still need to be streamed even after calling
-  // respondWith().
+  // request to keep the network::mojom::URLLoader related objects in it,
+  // because the preload response might still need to be streamed even after
+  // calling respondWith().
   if (!did_navigation_preload_) {
     fetch_dispatcher_.reset();
   }
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index 13ef96c3..18e2c12c 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -197,34 +197,50 @@
   return info;
 }
 
+void DidNavigateInPaymentHandlerWindow(
+    const GURL& url,
+    const base::WeakPtr<ServiceWorkerContextCore>& context,
+    const service_worker_client_utils::NavigationCallback& callback,
+    bool success,
+    int render_process_id,
+    int render_frame_id) {
+  if (success) {
+    service_worker_client_utils::DidNavigate(
+        context, url.GetOrigin(), callback, render_process_id, render_frame_id);
+  } else {
+    callback.Run(SERVICE_WORKER_ERROR_FAILED,
+                 blink::mojom::ServiceWorkerClientInfo());
+  }
+}
+
+using PaymentHandlerOpenWindowCallback =
+    base::OnceCallback<void(bool, int, int)>;
+
 void RunPaymentHandlerOpenWindowCallbackOnIO(
-    base::OnceCallback<void(ServiceWorkerStatusCode,
-                            const blink::mojom::ServiceWorkerClientInfo&)>
-        callback,
-    bool success) {
-  std::move(callback).Run(
-      success ? SERVICE_WORKER_OK : SERVICE_WORKER_ERROR_FAILED,
-      blink::mojom::ServiceWorkerClientInfo());
+    PaymentHandlerOpenWindowCallback callback,
+    bool success,
+    int render_process_id,
+    int render_frame_id) {
+  std::move(callback).Run(success, render_process_id, render_frame_id);
 }
 
 void OnOpenPaymentHandlerWindowOpenResponse(
-    base::OnceCallback<void(ServiceWorkerStatusCode,
-                            const blink::mojom::ServiceWorkerClientInfo&)>
-        callback,
-    bool success) {
+    PaymentHandlerOpenWindowCallback callback,
+    bool success,
+    int render_process_id,
+    int render_frame_id) {
   BrowserThread::PostTask(
       BrowserThread::IO, FROM_HERE,
       base::BindOnce(&RunPaymentHandlerOpenWindowCallbackOnIO,
-                     std::move(callback), success));
+                     std::move(callback), success, render_process_id,
+                     render_frame_id));
 }
 
 void ShowPaymentHandlerWindowOnUI(
     ContentBrowserClient* browser,
     const scoped_refptr<ServiceWorkerContextWrapper>& context_wrapper,
     const GURL& url,
-    base::OnceCallback<void(ServiceWorkerStatusCode,
-                            const blink::mojom::ServiceWorkerClientInfo&)>
-        callback,
+    PaymentHandlerOpenWindowCallback callback,
     base::OnceCallback<void(void)> fallback) {
   if (!browser->ShowPaymentHandlerWindow(
           context_wrapper->storage_partition()->browser_context(), url,
@@ -1236,14 +1252,15 @@
                                                       const GURL& url) {
   BrowserThread::PostTask(
       BrowserThread::UI, FROM_HERE,
-      base::BindOnce(&ShowPaymentHandlerWindowOnUI,
-                     GetContentClient()->browser(),
-                     base::WrapRefCounted(context_->wrapper()), url,
-                     base::BindOnce(&ServiceWorkerVersion::OnOpenWindowFinished,
-                                    weak_factory_.GetWeakPtr(), request_id),
-                     base::BindOnce(&ServiceWorkerVersion::OnOpenWindow,
-                                    weak_factory_.GetWeakPtr(), request_id, url,
-                                    WindowOpenDisposition::NEW_POPUP)));
+      base::BindOnce(
+          &ShowPaymentHandlerWindowOnUI, GetContentClient()->browser(),
+          base::WrapRefCounted(context_->wrapper()), url,
+          base::BindOnce(&DidNavigateInPaymentHandlerWindow, url, context_,
+                         base::Bind(&ServiceWorkerVersion::OnOpenWindowFinished,
+                                    weak_factory_.GetWeakPtr(), request_id)),
+          base::BindOnce(&ServiceWorkerVersion::OnOpenWindow,
+                         weak_factory_.GetWeakPtr(), request_id, url,
+                         WindowOpenDisposition::NEW_POPUP)));
 }
 
 void ServiceWorkerVersion::OnOpenWindow(int request_id,
diff --git a/content/browser/shared_worker/shared_worker_host.cc b/content/browser/shared_worker/shared_worker_host.cc
index 4031f8ef..212f41d 100644
--- a/content/browser/shared_worker/shared_worker_host.cc
+++ b/content/browser/shared_worker/shared_worker_host.cc
@@ -239,9 +239,9 @@
   return false;
 }
 
-void SharedWorkerHost::GetDevToolsAgent(
+void SharedWorkerHost::BindDevToolsAgent(
     blink::mojom::DevToolsAgentAssociatedRequest request) {
-  worker_->GetDevToolsAgent(std::move(request));
+  worker_->BindDevToolsAgent(std::move(request));
 }
 
 void SharedWorkerHost::OnClientConnectionLost() {
diff --git a/content/browser/shared_worker/shared_worker_host.h b/content/browser/shared_worker/shared_worker_host.h
index cb03ffe..06994468c 100644
--- a/content/browser/shared_worker/shared_worker_host.h
+++ b/content/browser/shared_worker/shared_worker_host.h
@@ -70,7 +70,7 @@
   // Returns true if any clients live in a different process from this worker.
   bool ServesExternalClient();
 
-  void GetDevToolsAgent(blink::mojom::DevToolsAgentAssociatedRequest request);
+  void BindDevToolsAgent(blink::mojom::DevToolsAgentAssociatedRequest request);
 
   SharedWorkerInstance* instance() { return instance_.get(); }
   int process_id() const { return process_id_; }
diff --git a/content/browser/shared_worker/shared_worker_service_impl_unittest.cc b/content/browser/shared_worker/shared_worker_service_impl_unittest.cc
index 870e30eb2..13df757a 100644
--- a/content/browser/shared_worker/shared_worker_service_impl_unittest.cc
+++ b/content/browser/shared_worker/shared_worker_service_impl_unittest.cc
@@ -29,6 +29,7 @@
 #include "content/test/test_render_view_host.h"
 #include "content/test/test_web_contents.h"
 #include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/test_support/test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/common/message_port/message_port_channel.h"
 
@@ -110,21 +111,6 @@
   return expected == actual;
 }
 
-std::vector<uint8_t> StringPieceToVector(base::StringPiece s) {
-  return std::vector<uint8_t>(s.begin(), s.end());
-}
-
-void BlockingReadFromMessagePort(MessagePortChannel port,
-                                 std::vector<uint8_t>* message) {
-  base::RunLoop run_loop;
-  port.SetCallback(run_loop.QuitClosure(), base::ThreadTaskRunnerHandle::Get());
-  run_loop.Run();
-
-  std::vector<MessagePortChannel> should_be_empty;
-  EXPECT_TRUE(port.GetMessage(message, &should_be_empty));
-  EXPECT_TRUE(should_be_empty.empty());
-}
-
 class MockSharedWorker : public mojom::SharedWorker {
  public:
   explicit MockSharedWorker(mojom::SharedWorkerRequest request)
@@ -162,7 +148,7 @@
     // Allow duplicate events.
     terminate_received_ = true;
   }
-  void GetDevToolsAgent(
+  void BindDevToolsAgent(
       blink::mojom::DevToolsAgentAssociatedRequest request) override {
     NOTREACHED();
   }
@@ -374,11 +360,12 @@
       client.CheckReceivedOnConnected(std::set<blink::mojom::WebFeature>()));
 
   // Verify that |port| corresponds to |connector->local_port()|.
-  std::vector<uint8_t> expected_message(StringPieceToVector("test1"));
-  local_port.PostMessage(expected_message.data(), expected_message.size(),
-                         std::vector<MessagePortChannel>());
-  std::vector<uint8_t> received_message;
-  BlockingReadFromMessagePort(port, &received_message);
+  std::string expected_message("test1");
+  EXPECT_TRUE(mojo::test::WriteTextMessage(local_port.GetHandle().get(),
+                                           expected_message));
+  std::string received_message;
+  EXPECT_TRUE(
+      mojo::test::ReadTextMessage(port.GetHandle().get(), &received_message));
   EXPECT_EQ(expected_message, received_message);
 
   // Send feature from shared worker to host.
@@ -449,11 +436,12 @@
       client0.CheckReceivedOnConnected(std::set<blink::mojom::WebFeature>()));
 
   // Verify that |port0| corresponds to |connector0->local_port()|.
-  std::vector<uint8_t> expected_message0(StringPieceToVector("test1"));
-  local_port0.PostMessage(expected_message0.data(), expected_message0.size(),
-                          std::vector<MessagePortChannel>());
-  std::vector<uint8_t> received_message0;
-  BlockingReadFromMessagePort(port0, &received_message0);
+  std::string expected_message0("test1");
+  EXPECT_TRUE(mojo::test::WriteTextMessage(local_port0.GetHandle().get(),
+                                           expected_message0));
+  std::string received_message0;
+  EXPECT_TRUE(
+      mojo::test::ReadTextMessage(port0.GetHandle().get(), &received_message0));
   EXPECT_EQ(expected_message0, received_message0);
 
   auto feature1 = static_cast<blink::mojom::WebFeature>(124);
@@ -506,11 +494,12 @@
   EXPECT_TRUE(client1.CheckReceivedOnConnected({feature1, feature2}));
 
   // Verify that |worker_msg_port2| corresponds to |connector1->local_port()|.
-  std::vector<uint8_t> expected_message1(StringPieceToVector("test2"));
-  local_port1.PostMessage(expected_message1.data(), expected_message1.size(),
-                          std::vector<MessagePortChannel>());
-  std::vector<uint8_t> received_message1;
-  BlockingReadFromMessagePort(port1, &received_message1);
+  std::string expected_message1("test2");
+  EXPECT_TRUE(mojo::test::WriteTextMessage(local_port1.GetHandle().get(),
+                                           expected_message1));
+  std::string received_message1;
+  EXPECT_TRUE(
+      mojo::test::ReadTextMessage(port1.GetHandle().get(), &received_message1));
   EXPECT_EQ(expected_message1, received_message1);
 
   worker_host->OnFeatureUsed(feature1);
diff --git a/content/browser/site_isolation_policy.cc b/content/browser/site_isolation_policy.cc
index 2401e866..509c394 100644
--- a/content/browser/site_isolation_policy.cc
+++ b/content/browser/site_isolation_policy.cc
@@ -11,9 +11,11 @@
 
 #include "base/command_line.h"
 #include "base/feature_list.h"
+#include "base/macros.h"
 #include "base/metrics/field_trial_params.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_split.h"
+#include "base/timer/timer.h"
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/common/content_client.h"
 #include "content/public/common/content_features.h"
@@ -115,6 +117,19 @@
 }
 
 // static
+void SiteIsolationPolicy::StartRecordingSiteIsolationFlagUsage() {
+  RecordSiteIsolationFlagUsage();
+  // Record the flag usage metrics every 24 hours.  Even though site isolation
+  // flags can't change dynamically at runtime, collecting these stats daily
+  // helps determine the overall population of users who run with a given flag
+  // on any given day.
+  CR_DEFINE_STATIC_LOCAL(base::RepeatingTimer, update_stats_timer, ());
+  update_stats_timer.Start(
+      FROM_HERE, base::TimeDelta::FromHours(24),
+      base::BindRepeating(&SiteIsolationPolicy::RecordSiteIsolationFlagUsage));
+}
+
+// static
 void SiteIsolationPolicy::RecordSiteIsolationFlagUsage() {
   // For --site-per-process and --isolate-origins, include flags specified on
   // command-line, in chrome://flags, and via enterprise policy (i.e., include
diff --git a/content/browser/site_isolation_policy.h b/content/browser/site_isolation_policy.h
index 8ece8d8..cfaa35d 100644
--- a/content/browser/site_isolation_policy.h
+++ b/content/browser/site_isolation_policy.h
@@ -47,9 +47,10 @@
   // This list applies globally to the whole browser in all profiles.
   static std::vector<url::Origin> GetIsolatedOrigins();
 
-  // Records metrics about which site isolation command-line flags are present.
-  // This should be called once on browser startup.
-  static void RecordSiteIsolationFlagUsage();
+  // Records metrics about which site isolation command-line flags are present,
+  // and sets up a timer to keep recording them every 24 hours.  This should be
+  // called once on browser startup.
+  static void StartRecordingSiteIsolationFlagUsage();
 
  private:
   SiteIsolationPolicy();  // Not instantiable.
@@ -61,6 +62,9 @@
   // Gets isolated origins from cmdline and/or from field trial param.
   static std::vector<url::Origin> GetIsolatedOriginsFromEnvironment();
 
+  // Records metrics about which site isolation command-line flags are present.
+  static void RecordSiteIsolationFlagUsage();
+
   DISALLOW_COPY_AND_ASSIGN(SiteIsolationPolicy);
 };
 
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc
index 2c30b295..7e555eb5 100644
--- a/content/browser/storage_partition_impl.cc
+++ b/content/browser/storage_partition_impl.cc
@@ -643,7 +643,7 @@
   return network_context_.get();
 }
 
-mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 StoragePartitionImpl::GetURLLoaderFactoryForBrowserProcess() {
   // Create the URLLoaderFactory as needed.
   if (!url_loader_factory_for_browser_process_ ||
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h
index 3ca766c..1a3128f 100644
--- a/content/browser/storage_partition_impl.h
+++ b/content/browser/storage_partition_impl.h
@@ -79,7 +79,8 @@
   net::URLRequestContextGetter* GetURLRequestContext() override;
   net::URLRequestContextGetter* GetMediaURLRequestContext() override;
   mojom::NetworkContext* GetNetworkContext() override;
-  mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() override;
+  network::mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess()
+      override;
   network::mojom::CookieManager* GetCookieManagerForBrowserProcess() override;
   storage::QuotaManager* GetQuotaManager() override;
   ChromeAppCacheService* GetAppCacheService() override;
@@ -307,7 +308,7 @@
   // See the method comment for
   // StoragePartition::GetURLLoaderFactoryForBrowserProcess() for
   // more details
-  mojom::URLLoaderFactoryPtr url_loader_factory_for_browser_process_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_for_browser_process_;
   ::network::mojom::CookieManagerPtr cookie_manager_for_browser_process_;
 
   // When the network service is disabled, a NetworkContext is created on the IO
diff --git a/content/browser/storage_partition_impl_browsertest.cc b/content/browser/storage_partition_impl_browsertest.cc
index 8005241..c55aca72 100644
--- a/content/browser/storage_partition_impl_browsertest.cc
+++ b/content/browser/storage_partition_impl_browsertest.cc
@@ -12,8 +12,6 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/content_features.h"
 #include "content/public/common/network_service.mojom.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/content_browser_test.h"
 #include "content/public/test/test_url_loader_client.h"
 #include "content/shell/browser/shell.h"
@@ -22,6 +20,8 @@
 #include "net/test/embedded_test_server/embedded_test_server.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "services/network/public/cpp/resource_response_info.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -52,7 +52,7 @@
 IN_PROC_BROWSER_TEST_P(StoragePartititionImplBrowsertest, NetworkContext) {
   ASSERT_TRUE(embedded_test_server()->Start());
 
-  mojom::URLLoaderFactoryPtr loader_factory;
+  network::mojom::URLLoaderFactoryPtr loader_factory;
   BrowserContext::GetDefaultStoragePartition(
       shell()->web_contents()->GetBrowserContext())
       ->GetNetworkContext()
@@ -62,10 +62,10 @@
   TestURLLoaderClient client;
   request.url = embedded_test_server()->GetURL("/set-header?foo: bar");
   request.method = "GET";
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   loader_factory->CreateLoaderAndStart(
-      mojo::MakeRequest(&loader), 2, 1, mojom::kURLLoadOptionNone, request,
-      client.CreateInterfacePtr(),
+      mojo::MakeRequest(&loader), 2, 1, network::mojom::kURLLoadOptionNone,
+      request, client.CreateInterfacePtr(),
       net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
   // Just wait until headers are received - if the right headers are received,
diff --git a/content/browser/url_loader_factory_getter.cc b/content/browser/url_loader_factory_getter.cc
index 26f3c7b..40a1d74 100644
--- a/content/browser/url_loader_factory_getter.cc
+++ b/content/browser/url_loader_factory_getter.cc
@@ -22,10 +22,10 @@
   DCHECK(partition);
   partition_ = partition;
 
-  mojom::URLLoaderFactoryPtr network_factory;
+  network::mojom::URLLoaderFactoryPtr network_factory;
   HandleNetworkFactoryRequestOnUIThread(MakeRequest(&network_factory));
 
-  mojom::URLLoaderFactoryPtr blob_factory;
+  network::mojom::URLLoaderFactoryPtr blob_factory;
   partition_->GetBlobURLLoaderFactory()->HandleRequest(
       mojo::MakeRequest(&blob_factory));
 
@@ -41,7 +41,7 @@
   partition_ = nullptr;
 }
 
-mojom::URLLoaderFactory* URLLoaderFactoryGetter::GetNetworkFactory() {
+network::mojom::URLLoaderFactory* URLLoaderFactoryGetter::GetNetworkFactory() {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (g_get_network_factory_callback.Get() && !test_factory_)
     g_get_network_factory_callback.Get().Run(this);
@@ -59,13 +59,13 @@
   return network_factory_.get();
 }
 
-mojom::URLLoaderFactory* URLLoaderFactoryGetter::GetBlobFactory() {
+network::mojom::URLLoaderFactory* URLLoaderFactoryGetter::GetBlobFactory() {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   return blob_factory_.get();
 }
 
 void URLLoaderFactoryGetter::SetNetworkFactoryForTesting(
-    mojom::URLLoaderFactory* test_factory) {
+    network::mojom::URLLoaderFactory* test_factory) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   DCHECK(!test_factory_ || !test_factory);
   test_factory_ = test_factory;
@@ -100,14 +100,14 @@
 URLLoaderFactoryGetter::~URLLoaderFactoryGetter() {}
 
 void URLLoaderFactoryGetter::InitializeOnIOThread(
-    mojom::URLLoaderFactoryPtrInfo network_factory,
-    mojom::URLLoaderFactoryPtrInfo blob_factory) {
+    network::mojom::URLLoaderFactoryPtrInfo network_factory,
+    network::mojom::URLLoaderFactoryPtrInfo blob_factory) {
   network_factory_.Bind(std::move(network_factory));
   blob_factory_.Bind(std::move(blob_factory));
 }
 
 void URLLoaderFactoryGetter::HandleNetworkFactoryRequestOnUIThread(
-    mojom::URLLoaderFactoryRequest network_factory_request) {
+    network::mojom::URLLoaderFactoryRequest network_factory_request) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   // |StoragePartitionImpl| may have went away while |URLLoaderFactoryGetter| is
   // still held by consumers.
diff --git a/content/browser/url_loader_factory_getter.h b/content/browser/url_loader_factory_getter.h
index b079878..2f13797 100644
--- a/content/browser/url_loader_factory_getter.h
+++ b/content/browser/url_loader_factory_getter.h
@@ -10,7 +10,7 @@
 #include "base/memory/ref_counted.h"
 #include "content/common/content_export.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -36,18 +36,18 @@
 
   // Called on the IO thread to get the URLLoaderFactory to the network service.
   // The pointer shouldn't be cached.
-  CONTENT_EXPORT mojom::URLLoaderFactory* GetNetworkFactory();
+  CONTENT_EXPORT network::mojom::URLLoaderFactory* GetNetworkFactory();
 
   // Called on the IO thread to get the URLLoaderFactory to the blob service.
   // The pointer shouldn't be cached.
-  CONTENT_EXPORT mojom::URLLoaderFactory* GetBlobFactory();
+  CONTENT_EXPORT network::mojom::URLLoaderFactory* GetBlobFactory();
 
   // Overrides the network URLLoaderFactory for subsequent requests. Passing a
   // null pointer will restore the default behavior.
   CONTENT_EXPORT void SetNetworkFactoryForTesting(
-      mojom::URLLoaderFactory* test_factory);
+      network::mojom::URLLoaderFactory* test_factory);
 
-  CONTENT_EXPORT mojom::URLLoaderFactoryPtr*
+  CONTENT_EXPORT network::mojom::URLLoaderFactoryPtr*
   original_network_factory_for_testing() {
     return &network_factory_;
   }
@@ -69,20 +69,21 @@
   friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
 
   CONTENT_EXPORT ~URLLoaderFactoryGetter();
-  void InitializeOnIOThread(mojom::URLLoaderFactoryPtrInfo network_factory,
-                            mojom::URLLoaderFactoryPtrInfo blob_factory);
+  void InitializeOnIOThread(
+      network::mojom::URLLoaderFactoryPtrInfo network_factory,
+      network::mojom::URLLoaderFactoryPtrInfo blob_factory);
 
   // Send |network_factory_request| to cached |StoragePartitionImpl|.
   void HandleNetworkFactoryRequestOnUIThread(
-      mojom::URLLoaderFactoryRequest network_factory_request);
+      network::mojom::URLLoaderFactoryRequest network_factory_request);
 
   // Call |network_factory_.FlushForTesting()|. For test use only.
   void FlushNetworkInterfaceForTesting();
 
   // Only accessed on IO thread.
-  mojom::URLLoaderFactoryPtr network_factory_;
-  mojom::URLLoaderFactoryPtr blob_factory_;
-  mojom::URLLoaderFactory* test_factory_ = nullptr;
+  network::mojom::URLLoaderFactoryPtr network_factory_;
+  network::mojom::URLLoaderFactoryPtr blob_factory_;
+  network::mojom::URLLoaderFactory* test_factory_ = nullptr;
 
   // Used to re-create |network_factory_| when connection error happens. Can
   // only be accessed on UI thread. Must be cleared by |StoragePartitionImpl|
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc
index 5715a00c..0c4242f8 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -28,7 +28,6 @@
 #include "content/browser/renderer_host/render_view_host_impl.h"
 #include "content/browser/web_contents/web_contents_impl.h"
 #include "content/browser/web_contents/web_contents_view_android.h"
-#include "content/common/devtools_messages.h"
 #include "content/common/frame.mojom.h"
 #include "content/common/frame_messages.h"
 #include "content/common/input_messages.h"
diff --git a/content/browser/webauth/authenticator_impl.cc b/content/browser/webauth/authenticator_impl.cc
index a4cc7ca..a9301f6 100644
--- a/content/browser/webauth/authenticator_impl.cc
+++ b/content/browser/webauth/authenticator_impl.cc
@@ -10,20 +10,65 @@
 
 #include "base/logging.h"
 #include "base/timer/timer.h"
+#include "content/browser/bad_message.h"
 #include "content/public/browser/render_frame_host.h"
+#include "content/public/common/origin_util.h"
 #include "content/public/common/service_manager_connection.h"
 #include "crypto/sha2.h"
 #include "device/u2f/u2f_hid_discovery.h"
 #include "device/u2f/u2f_register.h"
 #include "device/u2f/u2f_request.h"
 #include "device/u2f/u2f_return_code.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
 #include "services/service_manager/public/cpp/connector.h"
+#include "url/url_util.h"
 
 namespace content {
 
 namespace {
 constexpr int32_t kCoseEs256 = -7;
 
+// Ensure that the origin's effective domain is a valid domain.
+// Only the domain format of host is valid.
+// Reference https://url.spec.whatwg.org/#valid-domain-string and
+// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain.
+bool HasValidEffectiveDomain(url::Origin caller_origin) {
+  return (caller_origin.unique() ||
+          url::HostIsIPAddress(caller_origin.host()) ||
+          !content::IsOriginSecure(caller_origin.GetURL()))
+             ? false
+             : true;
+}
+
+// Ensure the relying party ID is a registrable domain suffix of or equal
+// to the origin's effective domain. Reference:
+// https://html.spec.whatwg.org/multipage/origin.html#is-a-registrable-domain-suffix-of-or-is-equal-to.
+bool IsRelyingPartyIdValid(const std::string& relying_party_id,
+                           url::Origin caller_origin) {
+  if (relying_party_id.empty())
+    return false;
+
+  if (caller_origin.host() == relying_party_id)
+    return true;
+
+  if (!caller_origin.DomainIs(relying_party_id))
+    return false;
+  if (!net::registry_controlled_domains::HostHasRegistryControlledDomain(
+          caller_origin.host(),
+          net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES,
+          net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES))
+    return false;
+  if (!net::registry_controlled_domains::HostHasRegistryControlledDomain(
+          relying_party_id,
+          net::registry_controlled_domains::INCLUDE_UNKNOWN_REGISTRIES,
+          net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES))
+    // TODO(crbug.com/803414): Accept corner-case situations like the following
+    // origin: "https://login.awesomecompany",
+    // relying_party_id: "awesomecompany".
+    return false;
+  return true;
+}
+
 bool HasValidAlgorithm(
     const std::vector<webauth::mojom::PublicKeyCredentialParametersPtr>&
         parameters) {
@@ -84,27 +129,22 @@
         webauth::mojom::AuthenticatorStatus::PENDING_REQUEST, nullptr);
     return;
   }
-
-  // Steps 6 & 7 of https://w3c.github.io/webauthn/#createCredential
-  // opaque origin
   url::Origin caller_origin = render_frame_host_->GetLastCommittedOrigin();
-  if (caller_origin.unique()) {
-    std::move(callback).Run(
-        webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, nullptr);
+
+  if (!HasValidEffectiveDomain(caller_origin)) {
+    bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(),
+                                    bad_message::AUTH_INVALID_EFFECTIVE_DOMAIN);
+    std::move(callback).Run(webauth::mojom::AuthenticatorStatus::INVALID_DOMAIN,
+                            nullptr);
     return;
   }
 
-  std::string relying_party_id;
-  if (options->relying_party->id) {
-    // TODO(kpaulhamus): Check if relyingPartyId is a registrable domain
-    // suffix of and equal to effectiveDomain and set relyingPartyId
-    // appropriately.
-    // TODO(kpaulhamus): Add unit tests for domains. http://crbug.com/785950.
-    relying_party_id = *options->relying_party->id;
-  } else {
-    // Use the effective domain of the caller origin.
-    relying_party_id = caller_origin.host();
-    DCHECK(!relying_party_id.empty());
+  if (!IsRelyingPartyIdValid(options->relying_party->id, caller_origin)) {
+    bad_message::ReceivedBadMessage(render_frame_host_->GetProcess(),
+                                    bad_message::AUTH_INVALID_RELYING_PARTY);
+    std::move(callback).Run(webauth::mojom::AuthenticatorStatus::INVALID_DOMAIN,
+                            nullptr);
+    return;
   }
 
   // Check that at least one of the cryptographic parameters is supported.
@@ -130,7 +170,8 @@
   // the application identity (i.e. relying_party_id) of the application
   // requesting the registration.
   std::vector<uint8_t> application_parameter(crypto::kSHA256Length);
-  crypto::SHA256HashString(relying_party_id, application_parameter.data(),
+  crypto::SHA256HashString(options->relying_party->id,
+                           application_parameter.data(),
                            application_parameter.size());
 
   // Start the timer (step 16 - https://w3c.github.io/webauthn/#makeCredential).
@@ -163,7 +204,17 @@
   // http://crbug.com/785955.
   u2f_request_ = device::U2fRegister::TryRegistration(
       registered_keys, client_data_hash, application_parameter,
-      relying_party_id, {u2f_discovery_.get()}, std::move(response_callback));
+      options->relying_party->id, {u2f_discovery_.get()},
+      std::move(response_callback));
+}
+
+// mojom:Authenticator
+void AuthenticatorImpl::GetAssertion(
+    webauth::mojom::PublicKeyCredentialRequestOptionsPtr options,
+    GetAssertionCallback callback) {
+  std::move(callback).Run(webauth::mojom::AuthenticatorStatus::NOT_IMPLEMENTED,
+                          nullptr);
+  return;
 }
 
 // Callback to handle the async registration response from a U2fDevice.
@@ -195,15 +246,23 @@
 }
 
 void AuthenticatorImpl::OnTimeout() {
-  DCHECK(make_credential_response_callback_);
+  DCHECK(make_credential_response_callback_ ||
+         get_assertion_response_callback_);
+  if (make_credential_response_callback_) {
+    std::move(make_credential_response_callback_)
+        .Run(webauth::mojom::AuthenticatorStatus::TIMED_OUT, nullptr);
+  } else if (get_assertion_response_callback_) {
+    std::move(get_assertion_response_callback_)
+        .Run(webauth::mojom::AuthenticatorStatus::TIMED_OUT, nullptr);
+  }
   Cleanup();
-  std::move(make_credential_response_callback_)
-      .Run(webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR, nullptr);
 }
 
 void AuthenticatorImpl::Cleanup() {
   u2f_request_.reset();
   u2f_discovery_.reset();
+  make_credential_response_callback_.Reset();
+  get_assertion_response_callback_.Reset();
   client_data_ = CollectedClientData();
 }
 }  // namespace content
diff --git a/content/browser/webauth/authenticator_impl.h b/content/browser/webauth/authenticator_impl.h
index 5ac97dc..90639ec 100644
--- a/content/browser/webauth/authenticator_impl.h
+++ b/content/browser/webauth/authenticator_impl.h
@@ -56,6 +56,10 @@
   void MakeCredential(webauth::mojom::MakePublicKeyCredentialOptionsPtr options,
                       MakeCredentialCallback callback) override;
 
+  void GetAssertion(
+      webauth::mojom::PublicKeyCredentialRequestOptionsPtr options,
+      GetAssertionCallback callback) override;
+
   // Callback to handle the async response from a U2fDevice.
   void OnRegisterResponse(
       device::U2fReturnCode status_code,
@@ -70,6 +74,7 @@
   std::unique_ptr<device::U2fDiscovery> u2f_discovery_;
   std::unique_ptr<device::U2fRequest> u2f_request_;
   MakeCredentialCallback make_credential_response_callback_;
+  GetAssertionCallback get_assertion_response_callback_;
 
   // Holds the client data to be returned to the caller.
   CollectedClientData client_data_;
diff --git a/content/browser/webauth/authenticator_impl_unittest.cc b/content/browser/webauth/authenticator_impl_unittest.cc
index 78bdf3e..5b3d86c 100644
--- a/content/browser/webauth/authenticator_impl_unittest.cc
+++ b/content/browser/webauth/authenticator_impl_unittest.cc
@@ -36,49 +36,141 @@
 using webauth::mojom::PublicKeyCredentialUserEntity;
 using webauth::mojom::PublicKeyCredentialUserEntityPtr;
 using webauth::mojom::MakeCredentialAuthenticatorResponsePtr;
+using webauth::mojom::GetAssertionAuthenticatorResponsePtr;
 using webauth::mojom::PublicKeyCredentialParameters;
 using webauth::mojom::PublicKeyCredentialParametersPtr;
+using webauth::mojom::PublicKeyCredentialRequestOptions;
+using webauth::mojom::PublicKeyCredentialRequestOptionsPtr;
 
 namespace {
 
-constexpr char kTestOrigin1[] = "https://google.com";
+typedef struct {
+  const char* origin;
+  const char* relying_party_id;
+} OriginRelyingPartyIdPair;
+
+constexpr char kTestOrigin1[] = "https://a.google.com";
+constexpr char kTestRelyingPartyId[] = "google.com";
 
 // Test data. CBOR test data can be built using the given diagnostic strings
 // and the utility at "http://cbor.me/".
 constexpr int32_t kCoseEs256 = -7;
 
-constexpr char kTestRelyingPartyId[] = "google.com";
-
 constexpr uint8_t kTestChallengeBytes[] = {
     0x68, 0x71, 0x34, 0x96, 0x82, 0x22, 0xEC, 0x17, 0x20, 0x2E, 0x42,
     0x50, 0x5F, 0x8E, 0xD2, 0xB1, 0x6A, 0xE2, 0x2F, 0x16, 0xBB, 0x05,
     0xB8, 0x8C, 0x25, 0xDB, 0x9E, 0x60, 0x26, 0x45, 0xF1, 0x41};
 
 constexpr char kTestClientDataJsonString[] =
-    "{\"challenge\":\"aHE0loIi7BcgLkJQX47SsWriLxa7BbiMJdueYCZF8UE\","
-    "\"hashAlgorithm\""
-    ":\"SHA-256\",\"origin\":\"google.com\",\"tokenBinding\":\"unused\","
-    "\"type\":\"webauthn.create\"}";
+    R"({"challenge":"aHE0loIi7BcgLkJQX47SsWriLxa7BbiMJdueYCZF8UE",)"
+    R"("hashAlgorithm":"SHA-256","origin":"google.com","tokenBinding":)"
+    R"("unused","type":"webauthn.create"})";
+
+constexpr OriginRelyingPartyIdPair kValidRelyingPartyTestCases[] = {
+    {"http://localhost", "localhost"},
+    {"https://myawesomedomain", "myawesomedomain"},
+    {"https://foo.bar.google.com", "foo.bar.google.com"},
+    {"https://foo.bar.google.com", "bar.google.com"},
+    {"https://foo.bar.google.com", "google.com"},
+    {"https://earth.login.awesomecompany", "login.awesomecompany"},
+    {"https://google.com:1337", "google.com"},
+
+    // Hosts with trailing dot valid for rpIds with or without trailing dot.
+    // Hosts without trailing dots only matches rpIDs without trailing dot.
+    // Two trailing dots only matches rpIDs with two trailing dots.
+    {"https://google.com.", "google.com"},
+    {"https://google.com.", "google.com."},
+    {"https://google.com..", "google.com.."},
+
+    // Leading dots are ignored in canonicalized hosts.
+    {"https://.google.com", "google.com"},
+    {"https://..google.com", "google.com"},
+    {"https://.google.com", ".google.com"},
+    {"https://..google.com", ".google.com"},
+    {"https://accounts.google.com", ".google.com"},
+
+    // The spec notes that RPs should not use non-https schemes, but this is
+    // technically still valid according to the authoritative parts.
+    {"wss:///google.com", "google.com"},
+};
+
+constexpr OriginRelyingPartyIdPair kInvalidRelyingPartyTestCases[] = {
+    {"https://google.com", "com"},
+    {"http://google.com", "google.com"},
+    {"http://myawesomedomain", "myawesomedomain"},
+    {"https://google.com", "foo.bar.google.com"},
+    {"http://myawesomedomain", "randomdomain"},
+    {"https://myawesomedomain", "randomdomain"},
+    {"https://notgoogle.com", "google.com)"},
+    {"https://not-google.com", "google.com)"},
+    {"https://evil.appspot.com", "appspot.com"},
+    {"https://evil.co.uk", "co.uk"},
+
+    {"https://google.com", "google.com."},
+    {"https://google.com", "google.com.."},
+    {"https://google.com", ".google.com"},
+    {"https://google.com..", "google.com"},
+    {"https://.com", "com."},
+    {"https://.co.uk", "co.uk."},
+
+    {"https://1.2.3", "1.2.3"},
+    {"https://1.2.3", "2.3"},
+
+    {"https://127.0.0.1", "127.0.0.1"},
+    {"https://127.0.0.1", "27.0.0.1"},
+    {"https://127.0.0.1", ".0.0.1"},
+    {"https://127.0.0.1", "0.0.1"},
+
+    {"https://[::127.0.0.1]", "127.0.0.1"},
+    {"https://[::127.0.0.1]", "[127.0.0.1]"},
+
+    {"https://[::1]", "1"},
+    {"https://[::1]", "1]"},
+    {"https://[::1]", "::1"},
+    {"https://[::1]", "[::1]"},
+    {"https://[1::1]", "::1"},
+    {"https://[1::1]", "::1]"},
+    {"https://[1::1]", "[::1]"},
+
+    {"http://google.com:443", "google.com"},
+    {"data:google.com", "google.com"},
+    {"data:text/html,google.com", "google.com"},
+    {"ws://google.com", "google.com"},
+    {"gopher://google.com", "google.com"},
+    {"ftp://google.com", "google.com"},
+    {"file:///google.com", "google.com"},
+
+    {"data:,", ""},
+    {"https://google.com", ""},
+    {"ws:///google.com", ""},
+    {"wss:///google.com", ""},
+    {"gopher://google.com", ""},
+    {"ftp://google.com", ""},
+    {"file:///google.com", ""},
+
+    // This case is acceptable according to spec, but both renderer
+    // and browser handling currently do not permit it.
+    {"https://login.awesomecompany", "awesomecompany"},
+};
 
 std::vector<uint8_t> GetTestChallengeBytes() {
   return std::vector<uint8_t>(std::begin(kTestChallengeBytes),
                               std::end(kTestChallengeBytes));
 }
 
-
 PublicKeyCredentialRpEntityPtr GetTestPublicKeyCredentialRPEntity() {
   auto entity = PublicKeyCredentialRpEntity::New();
-  entity->id = std::string("localhost");
-  entity->name = std::string("TestRP@example.com");
+  entity->id = std::string(kTestRelyingPartyId);
+  entity->name = "TestRP@example.com";
   return entity;
 }
 
 PublicKeyCredentialUserEntityPtr GetTestPublicKeyCredentialUserEntity() {
   auto entity = PublicKeyCredentialUserEntity::New();
-  entity->display_name = std::string("User A. Name");
+  entity->display_name = "User A. Name";
   std::vector<uint8_t> id(32, 0x0A);
   entity->id = id;
-  entity->name = std::string("username@example.com");
+  entity->name = "username@example.com";
   entity->icon = GURL("fakeurl2.png");
   return entity;
 }
@@ -95,12 +187,20 @@
 
 MakePublicKeyCredentialOptionsPtr GetTestMakePublicKeyCredentialOptions() {
   auto options = MakePublicKeyCredentialOptions::New();
-  std::vector<uint8_t> buffer(32, 0x0A);
   options->relying_party = GetTestPublicKeyCredentialRPEntity();
   options->user = GetTestPublicKeyCredentialUserEntity();
   options->public_key_parameters =
       GetTestPublicKeyCredentialParameters(kCoseEs256);
-  options->challenge = std::move(buffer);
+  options->challenge.assign(32, 0x0A);
+  options->adjusted_timeout = base::TimeDelta::FromMinutes(1);
+  return options;
+}
+
+PublicKeyCredentialRequestOptionsPtr
+GetTestPublicKeyCredentialRequestOptions() {
+  auto options = PublicKeyCredentialRequestOptions::New();
+  options->relying_party_id = std::string("localhost");
+  options->challenge.assign(32, 0x0A);
   options->adjusted_timeout = base::TimeDelta::FromMinutes(1);
   return options;
 }
@@ -154,7 +254,7 @@
   void ReceivedCallback(AuthenticatorStatus status,
                         MakeCredentialAuthenticatorResponsePtr credential) {
     response_ = std::make_pair(status, std::move(credential));
-    closure_.Run();
+    std::move(closure_).Run();
   }
 
   // TODO(crbug.com/799044) - simplify the runloop usage.
@@ -177,23 +277,79 @@
   base::RunLoop run_loop_;
 };
 
+class TestGetAssertionCallback {
+ public:
+  TestGetAssertionCallback()
+      : callback_(base::BindOnce(&TestGetAssertionCallback::ReceivedCallback,
+                                 base::Unretained(this))) {}
+  ~TestGetAssertionCallback() {}
+
+  void ReceivedCallback(AuthenticatorStatus status,
+                        GetAssertionAuthenticatorResponsePtr credential) {
+    response_ = std::make_pair(status, std::move(credential));
+    std::move(closure_).Run();
+  }
+
+  // TODO(crbug.com/799044) - simplify the runloop usage.
+  std::pair<AuthenticatorStatus, GetAssertionAuthenticatorResponsePtr>&
+  WaitForCallback() {
+    closure_ = run_loop_.QuitClosure();
+    run_loop_.Run();
+    return response_;
+  }
+
+  AuthenticatorImpl::GetAssertionCallback callback() {
+    return std::move(callback_);
+  }
+
+ private:
+  std::pair<AuthenticatorStatus, GetAssertionAuthenticatorResponsePtr>
+      response_;
+  base::OnceClosure closure_;
+  AuthenticatorImpl::GetAssertionCallback callback_;
+  base::RunLoop run_loop_;
+};
+
 }  // namespace
 
-// Test that service returns NOT_ALLOWED_ERROR on a call to MakeCredential with
-// an opaque origin.
-TEST_F(AuthenticatorImplTest, MakeCredentialOpaqueOrigin) {
-  NavigateAndCommit(GURL("data:text/html,opaque"));
-  AuthenticatorPtr authenticator = ConnectToAuthenticator();
-  MakePublicKeyCredentialOptionsPtr options =
-      GetTestMakePublicKeyCredentialOptions();
+// Verify behavior for various combinations of origins and rp id's.
+TEST_F(AuthenticatorImplTest, MakeCredentialOriginAndRpIds) {
+  // These instances should return security errors (for circumstances
+  // that would normally crash the renderer).
+  for (auto test_case : kInvalidRelyingPartyTestCases) {
+    NavigateAndCommit(GURL(test_case.origin));
+    AuthenticatorPtr authenticator = ConnectToAuthenticator();
+    MakePublicKeyCredentialOptionsPtr options =
+        GetTestMakePublicKeyCredentialOptions();
+    options->relying_party->id = test_case.relying_party_id;
 
-  TestMakeCredentialCallback cb;
-  authenticator->MakeCredential(std::move(options), cb.callback());
-  std::pair<webauth::mojom::AuthenticatorStatus,
-            webauth::mojom::MakeCredentialAuthenticatorResponsePtr>& response =
-      cb.WaitForCallback();
-  EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR,
-            response.first);
+    TestMakeCredentialCallback cb;
+    authenticator->MakeCredential(std::move(options), cb.callback());
+    std::pair<webauth::mojom::AuthenticatorStatus,
+              webauth::mojom::MakeCredentialAuthenticatorResponsePtr>&
+        response = cb.WaitForCallback();
+    EXPECT_EQ(webauth::mojom::AuthenticatorStatus::INVALID_DOMAIN,
+              response.first);
+  }
+
+  // These instances pass the origin and relying party checks and return at
+  // the algorithm check.
+  for (auto test_case : kValidRelyingPartyTestCases) {
+    NavigateAndCommit(GURL(test_case.origin));
+    AuthenticatorPtr authenticator = ConnectToAuthenticator();
+    MakePublicKeyCredentialOptionsPtr options =
+        GetTestMakePublicKeyCredentialOptions();
+    options->relying_party->id = test_case.relying_party_id;
+    options->public_key_parameters = GetTestPublicKeyCredentialParameters(123);
+
+    TestMakeCredentialCallback cb;
+    authenticator->MakeCredential(std::move(options), cb.callback());
+    std::pair<webauth::mojom::AuthenticatorStatus,
+              webauth::mojom::MakeCredentialAuthenticatorResponsePtr>&
+        response = cb.WaitForCallback();
+    EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_SUPPORTED_ERROR,
+              response.first);
+  }
 }
 
 // Test that service returns NOT_IMPLEMENTED_ERROR if no parameters contain
@@ -216,12 +372,12 @@
 }
 
 // Test that client data serializes to JSON properly.
-TEST_F(AuthenticatorImplTest, TestSerializedClientData) {
+TEST_F(AuthenticatorImplTest, TestSerializedRegisterClientData) {
   EXPECT_EQ(kTestClientDataJsonString,
             GetTestClientData(client_data::kCreateType).SerializeToJson());
 }
 
-TEST_F(AuthenticatorImplTest, TestTimeout) {
+TEST_F(AuthenticatorImplTest, TestMakeCredentialTimeout) {
   SimulateNavigation(GURL(kTestOrigin1));
   MakePublicKeyCredentialOptionsPtr options =
       GetTestMakePublicKeyCredentialOptions();
@@ -230,8 +386,7 @@
   // Set up service_manager::Connector for tests.
   auto fake_hid_manager = std::make_unique<device::FakeHidManager>();
   service_manager::mojom::ConnectorRequest request;
-  std::unique_ptr<service_manager::Connector> connector =
-      service_manager::Connector::Create(&request);
+  auto connector = service_manager::Connector::Create(&request);
   service_manager::Connector::TestApi test_api(connector.get());
   test_api.OverrideBinderForTesting(
       device::mojom::kServiceName, device::mojom::HidManager::Name_,
@@ -241,7 +396,7 @@
   // Set up a timer for testing.
   auto task_runner = base::MakeRefCounted<base::TestMockTimeTaskRunner>(
       base::Time::Now(), base::TimeTicks::Now());
-  std::unique_ptr<base::TickClock> tick_clock = task_runner->GetMockTickClock();
+  auto tick_clock = task_runner->GetMockTickClock();
   auto timer = std::make_unique<base::OneShotTimer>(tick_clock.get());
   timer->SetTaskRunner(task_runner);
   AuthenticatorPtr authenticator =
@@ -255,8 +410,22 @@
   std::pair<webauth::mojom::AuthenticatorStatus,
             webauth::mojom::MakeCredentialAuthenticatorResponsePtr>& response =
       cb.WaitForCallback();
-  EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_ALLOWED_ERROR,
-            response.first);
+  EXPECT_EQ(webauth::mojom::AuthenticatorStatus::TIMED_OUT, response.first);
 }
 
+// Test that service returns NOT_IMPLEMENTED on a call to GetAssertion.
+TEST_F(AuthenticatorImplTest, GetAssertionNotImplemented) {
+  SimulateNavigation(GURL(kTestOrigin1));
+  AuthenticatorPtr authenticator = ConnectToAuthenticator();
+  PublicKeyCredentialRequestOptionsPtr options =
+      GetTestPublicKeyCredentialRequestOptions();
+
+  TestGetAssertionCallback cb;
+  authenticator->GetAssertion(std::move(options), cb.callback());
+  std::pair<webauth::mojom::AuthenticatorStatus,
+            webauth::mojom::GetAssertionAuthenticatorResponsePtr>& response =
+      cb.WaitForCallback();
+  EXPECT_EQ(webauth::mojom::AuthenticatorStatus::NOT_IMPLEMENTED,
+            response.first);
+}
 }  // namespace content
diff --git a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
index 45e4a64..be18d3ce 100644
--- a/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
+++ b/content/browser/webrtc/webrtc_getusermedia_browsertest.cc
@@ -259,11 +259,16 @@
   ExecuteJavascriptAndWaitForOk("getUserMediaAndClone();");
 }
 
-// Test fails under Android, http://crbug.com/524388
-// Test fails under MSan
-// Flaky everywhere else: http://crbug.com/523152
+// http://crbug.com/803516 : Flaky on Linux debug
+#if defined(OS_LINUX) && !defined(NDEBUG)
+#define MAYBE_RenderVideoTrackInMultipleTagsAndPause \
+  DISABLED_RenderVideoTrackInMultipleTagsAndPause
+#else
+#define MAYBE_RenderVideoTrackInMultipleTagsAndPause \
+  RenderVideoTrackInMultipleTagsAndPause
+#endif
 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
-                       RenderVideoTrackInMultipleTagsAndPause) {
+                       MAYBE_RenderVideoTrackInMultipleTagsAndPause) {
   ASSERT_TRUE(embedded_test_server()->Start());
 
   GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
diff --git a/content/browser/webrtc/webrtc_image_capture_browsertest.cc b/content/browser/webrtc/webrtc_image_capture_browsertest.cc
index b12665d..1ca3828 100644
--- a/content/browser/webrtc/webrtc_image_capture_browsertest.cc
+++ b/content/browser/webrtc/webrtc_image_capture_browsertest.cc
@@ -80,7 +80,8 @@
 }  // namespace
 
 // This class is the content_browsertests for Image Capture API, which allows
-// for capturing still images out of a MediaStreamTrack.
+// for capturing still images out of a MediaStreamTrack. Is a
+// WebRtcWebcamBrowserTest to be able to use a physical camera.
 class WebRtcImageCaptureBrowserTestBase : public WebRtcWebcamBrowserTest {
  public:
   WebRtcImageCaptureBrowserTestBase() = default;
@@ -118,7 +119,7 @@
     NavigateToURL(shell(), url);
 
     if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
-      LOG(INFO) << "No video device; skipping test...";
+      DVLOG(1) << "No video device; skipping test...";
       return true;
     }
 
@@ -146,9 +147,6 @@
     if (std::get<1>(GetParam()).use_video_capture_service) {
       scoped_feature_list_.InitAndEnableFeature(
           video_capture::kMojoVideoCapture);
-    } else {
-      scoped_feature_list_.InitAndDisableFeature(
-          video_capture::kMojoVideoCapture);
     }
   }
 
diff --git a/content/browser/webui/network_error_url_loader.cc b/content/browser/webui/network_error_url_loader.cc
index 2f738740..fb636ec5 100644
--- a/content/browser/webui/network_error_url_loader.cc
+++ b/content/browser/webui/network_error_url_loader.cc
@@ -12,7 +12,7 @@
 namespace content {
 
 void StartNetworkErrorsURLLoader(const network::ResourceRequest& request,
-                                 mojom::URLLoaderClientPtr client) {
+                                 network::mojom::URLLoaderClientPtr client) {
   int net_error = net::ERR_INVALID_URL;
   if (request.url.host() == kChromeUIDinoHost) {
     net_error = net::Error::ERR_INTERNET_DISCONNECTED;
diff --git a/content/browser/webui/network_error_url_loader.h b/content/browser/webui/network_error_url_loader.h
index 7f87f10..834a734 100644
--- a/content/browser/webui/network_error_url_loader.h
+++ b/content/browser/webui/network_error_url_loader.h
@@ -5,13 +5,13 @@
 #ifndef CONTENT_BROWSER_WEBUI_NETWORK_ERROR_URL_LOADER_H_
 #define CONTENT_BROWSER_WEBUI_NETWORK_ERROR_URL_LOADER_H_
 
-#include "content/public/common/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
 // Creates the data for chrome://network-error.
 void StartNetworkErrorsURLLoader(const network::ResourceRequest& request,
-                                 mojom::URLLoaderClientPtr client);
+                                 network::mojom::URLLoaderClientPtr client);
 
 }  // namespace content
 
diff --git a/content/browser/webui/web_ui_url_loader_factory.cc b/content/browser/webui/web_ui_url_loader_factory.cc
index f96a955..d86beb2 100644
--- a/content/browser/webui/web_ui_url_loader_factory.cc
+++ b/content/browser/webui/web_ui_url_loader_factory.cc
@@ -44,8 +44,9 @@
                             std::unique_ptr<WebUIURLLoaderFactory>>>::Leaky
     g_web_ui_url_loader_factories = LAZY_INSTANCE_INITIALIZER;
 
-void CallOnError(mojom::URLLoaderClientPtrInfo client_info, int error_code) {
-  mojom::URLLoaderClientPtr client;
+void CallOnError(network::mojom::URLLoaderClientPtrInfo client_info,
+                 int error_code) {
+  network::mojom::URLLoaderClientPtr client;
   client.Bind(std::move(client_info));
 
   network::URLLoaderCompletionStatus status;
@@ -57,14 +58,14 @@
               const ui::TemplateReplacements* replacements,
               bool gzipped,
               scoped_refptr<URLDataSourceImpl> data_source,
-              mojom::URLLoaderClientPtrInfo client_info,
+              network::mojom::URLLoaderClientPtrInfo client_info,
               scoped_refptr<base::RefCountedMemory> bytes) {
   if (!bytes) {
     CallOnError(std::move(client_info), net::ERR_FAILED);
     return;
   }
 
-  mojom::URLLoaderClientPtr client;
+  network::mojom::URLLoaderClientPtr client;
   client.Bind(std::move(client_info));
   client->OnReceiveResponse(headers->head, base::nullopt, nullptr);
 
@@ -126,7 +127,7 @@
                    const ui::TemplateReplacements* replacements,
                    bool gzipped,
                    scoped_refptr<URLDataSourceImpl> source,
-                   mojom::URLLoaderClientPtrInfo client_info,
+                   network::mojom::URLLoaderClientPtrInfo client_info,
                    scoped_refptr<base::RefCountedMemory> bytes) {
   // Since the bytes are from the memory mapped resource file, copying the
   // data can lead to disk access. Needs to be posted to a SequencedTaskRunner
@@ -141,7 +142,7 @@
 
 void StartURLLoader(const network::ResourceRequest& request,
                     int frame_tree_node_id,
-                    mojom::URLLoaderClientPtrInfo client_info,
+                    network::mojom::URLLoaderClientPtrInfo client_info,
                     ResourceContext* resource_context) {
   // NOTE: this duplicates code in URLDataManagerBackend::StartRequest.
   if (!URLDataManagerBackend::CheckURLIsValid(request.url)) {
@@ -212,7 +213,7 @@
                                 wc_getter, data_available_callback));
 }
 
-class WebUIURLLoaderFactory : public mojom::URLLoaderFactory,
+class WebUIURLLoaderFactory : public network::mojom::URLLoaderFactory,
                               public WebContentsObserver {
  public:
   WebUIURLLoaderFactory(RenderFrameHost* rfh, const std::string& scheme)
@@ -222,19 +223,19 @@
 
   ~WebUIURLLoaderFactory() override {}
 
-  mojom::URLLoaderFactoryPtr CreateBinding() {
-    mojom::URLLoaderFactoryPtr factory;
+  network::mojom::URLLoaderFactoryPtr CreateBinding() {
+    network::mojom::URLLoaderFactoryPtr factory;
     loader_factory_bindings_.AddBinding(this, mojo::MakeRequest(&factory));
     return factory;
   }
 
-  // mojom::URLLoaderFactory implementation:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest loader,
+  // network::mojom::URLLoaderFactory implementation:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest loader,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -285,7 +286,7 @@
             GetStoragePartition()->browser_context()->GetResourceContext()));
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override {
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
     loader_factory_bindings_.AddBinding(this, std::move(request));
   }
 
@@ -308,14 +309,14 @@
 
   RenderFrameHost* render_frame_host_;
   std::string scheme_;
-  mojo::BindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> loader_factory_bindings_;
 
   DISALLOW_COPY_AND_ASSIGN(WebUIURLLoaderFactory);
 };
 
 }  // namespace
 
-mojom::URLLoaderFactoryPtr CreateWebUIURLLoader(
+network::mojom::URLLoaderFactoryPtr CreateWebUIURLLoader(
     RenderFrameHost* render_frame_host,
     const std::string& scheme) {
   GlobalFrameRoutingId routing_id(render_frame_host->GetRoutingID(),
diff --git a/content/browser/webui/web_ui_url_loader_factory.h b/content/browser/webui/web_ui_url_loader_factory.h
index cbb53849..fad09c0 100644
--- a/content/browser/webui/web_ui_url_loader_factory.h
+++ b/content/browser/webui/web_ui_url_loader_factory.h
@@ -5,7 +5,7 @@
 #ifndef CONTENT_BROWSER_WEBUI_WEB_UI_URL_LOADER_FACTORY_H_
 #define CONTENT_BROWSER_WEBUI_WEB_UI_URL_LOADER_FACTORY_H_
 
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 class RenderFrameHost;
@@ -14,7 +14,7 @@
 // the given |render_frame_host|. The factory will only create loaders for
 // requests with the same scheme as |scheme|. This is needed because there is
 // more than one scheme used for WebUI, and not all have WebUI bindings.
-mojom::URLLoaderFactoryPtr CreateWebUIURLLoader(
+network::mojom::URLLoaderFactoryPtr CreateWebUIURLLoader(
     RenderFrameHost* render_frame_host,
     const std::string& scheme);
 
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index 8d858e0..9282c510 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -106,7 +106,6 @@
     "cursors/webcursor_mac.mm",
     "cursors/webcursor_ozone.cc",
     "date_time_suggestion.h",
-    "devtools_messages.h",
     "dom_storage/dom_storage_map.cc",
     "dom_storage/dom_storage_map.h",
     "dom_storage/dom_storage_messages.h",
@@ -262,8 +261,9 @@
     "render_widget_surface_properties.h",
     "resize_params.cc",
     "resize_params.h",
-    "resource_messages.cc",
     "resource_messages.h",
+    "resource_timing_info.cc",
+    "resource_timing_info.h",
     "sandbox_init_linux.cc",
     "sandbox_init_mac.cc",
     "sandbox_init_win.cc",
@@ -297,8 +297,6 @@
     "unique_name_helper.h",
     "url_loader_factory_bundle.cc",
     "url_loader_factory_bundle.h",
-    "url_request_struct_traits.cc",
-    "url_request_struct_traits.h",
     "url_schemes.cc",
     "url_schemes.h",
     "user_agent.cc",
diff --git a/content/common/appcache.mojom b/content/common/appcache.mojom
index 0743f58c..9ade3569 100644
--- a/content/common/appcache.mojom
+++ b/content/common/appcache.mojom
@@ -5,8 +5,8 @@
 module content.mojom;
 
 import "content/public/common/appcache_info.mojom";
-import "content/public/common/url_loader_factory.mojom";
 import "url/mojo/url.mojom";
+import "services/network/public/interfaces/url_loader_factory.mojom";
 
 enum AppCacheEventID {
   APPCACHE_CHECKING_EVENT,
@@ -134,6 +134,6 @@
   // In the network service world this message sets the URLLoaderFactory to be
   // used for subresources.
   SetSubresourceFactory(int32 host_id,
-                        URLLoaderFactory url_loader_factory);
+                        network.mojom.URLLoaderFactory url_loader_factory);
 };
 
diff --git a/content/common/appcache_interfaces.h b/content/common/appcache_interfaces.h
index c6b4ce7..b3d9f0adc 100644
--- a/content/common/appcache_interfaces.h
+++ b/content/common/appcache_interfaces.h
@@ -84,7 +84,7 @@
   // parameter.
   virtual void OnSetSubresourceFactory(
       int host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) = 0;
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) = 0;
 
   virtual ~AppCacheFrontend() {}
 };
diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h
index d1505e7..604f1a98 100644
--- a/content/common/content_message_generator.h
+++ b/content/common/content_message_generator.h
@@ -21,11 +21,6 @@
 #ifndef CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_MESSAGES_H_
 #error "Failed to include content/common/cache_storage/cache_storage_messages.h"
 #endif
-#undef CONTENT_COMMON_DEVTOOLS_MESSAGES_H_
-#include "content/common/devtools_messages.h"
-#ifndef CONTENT_COMMON_DEVTOOLS_MESSAGES_H_
-#error "Failed to include content/common/devtools_messages.h"
-#endif
 #undef CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MESSAGES_H_
 #include "content/common/dom_storage/dom_storage_messages.h"
 #ifndef CONTENT_COMMON_DOM_STORAGE_DOM_STORAGE_MESSAGES_H_
diff --git a/content/common/content_param_traits_macros.h b/content/common/content_param_traits_macros.h
index a030577..2dfc986 100644
--- a/content/common/content_param_traits_macros.h
+++ b/content/common/content_param_traits_macros.h
@@ -16,7 +16,6 @@
 #include "content/public/common/request_context_type.h"
 #include "content/public/common/resource_type.h"
 #include "ipc/ipc_message_macros.h"
-#include "services/network/public/interfaces/request_context_frame_type.mojom.h"
 #include "third_party/WebKit/common/page/page_visibility_state.mojom.h"
 #include "third_party/WebKit/public/platform/WebContentSecurityPolicy.h"
 #include "third_party/WebKit/public/platform/WebInputEvent.h"
@@ -31,8 +30,6 @@
                           content::INPUT_EVENT_ACK_STATE_MAX)
 IPC_ENUM_TRAITS_MAX_VALUE(content::RequestContextType,
                           content::REQUEST_CONTEXT_TYPE_LAST)
-IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::RequestContextFrameType,
-                          network::mojom::RequestContextFrameType::kLast)
 IPC_ENUM_TRAITS_MAX_VALUE(content::ResourceType,
                           content::RESOURCE_TYPE_LAST_TYPE - 1)
 IPC_ENUM_TRAITS_MAX_VALUE(content::MhtmlSaveStatus,
diff --git a/content/common/content_switches_internal.cc b/content/common/content_switches_internal.cc
index 93bcf97e..f4b0773 100644
--- a/content/common/content_switches_internal.cc
+++ b/content/common/content_switches_internal.cc
@@ -37,9 +37,9 @@
 namespace {
 
 #if defined(ANDROID)
-const base::Feature kProgressBarCompletionResourcesBeforeDOMContentLoaded {
+const base::Feature kProgressBarCompletionResourcesBeforeDOMContentLoaded{
     "progress-bar-completion-resources-before-domContentLoaded",
-    base::FEATURE_DISABLED_BY_DEFAULT};
+    base::FEATURE_ENABLED_BY_DEFAULT};
 #endif
 
 const base::Feature kSavePreviousDocumentResources{
@@ -120,12 +120,12 @@
   }
   // The command line, which is set by the user, takes priority. Otherwise,
   // fall back to the feature flag.
-  if (base::FeatureList::IsEnabled(
+  if (!base::FeatureList::IsEnabled(
           kProgressBarCompletionResourcesBeforeDOMContentLoaded)) {
-    return ProgressBarCompletion::RESOURCES_BEFORE_DCL;
+    return ProgressBarCompletion::LOAD_EVENT;
   }
 #endif
-  return ProgressBarCompletion::LOAD_EVENT;
+  return ProgressBarCompletion::RESOURCES_BEFORE_DCL;
 }
 
 SavePreviousDocumentResources GetSavePreviousDocumentResources() {
diff --git a/content/common/devtools_messages.h b/content/common/devtools_messages.h
deleted file mode 100644
index c00f1330..0000000
--- a/content/common/devtools_messages.h
+++ /dev/null
@@ -1,121 +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 CONTENT_COMMON_DEVTOOLS_MESSAGES_H_
-#define CONTENT_COMMON_DEVTOOLS_MESSAGES_H_
-
-// Developer tools consist of the following parts:
-//
-// DevToolsAgent lives in the renderer of an inspected page and provides access
-// to the pages resources, DOM, v8 etc. by means of IPC messages.
-//
-// DevToolsClient is a thin delegate that lives in the tools front-end
-// renderer and converts IPC messages to frontend method calls and allows the
-// frontend to send messages to the DevToolsAgent.
-//
-// All the messages are routed through browser process. There is a
-// DevToolsManager living in the browser process that is responsible for
-// routing logistics. It is also capable of sending direct messages to the
-// agent rather than forwarding messages between agents and clients only.
-//
-// Chain of communication between the components may be described by the
-// following diagram:
-//  ----------------------------
-// | (tools frontend            |
-// | renderer process)          |
-// |                            |            --------------------
-// |tools    <--> DevToolsClient+<-- IPC -->+ (browser process)  |
-// |frontend                    |           |                    |
-//  ----------------------------             ---------+----------
-//                                                    ^
-//                                                    |
-//                                                   IPC
-//                                                    |
-//                                                    v
-//                          --------------------------+--------
-//                         | inspected page <--> DevToolsAgent |
-//                         |                                   |
-//                         | (inspected page renderer process) |
-//                          -----------------------------------
-//
-// This file describes developer tools message types.
-
-#include <map>
-#include <string>
-
-#include "content/common/content_export.h"
-#include "content/public/common/console_message_level.h"
-#include "ipc/ipc_message_macros.h"
-
-#undef IPC_MESSAGE_EXPORT
-#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
-
-#define IPC_MESSAGE_START DevToolsMsgStart
-
-// These are messages sent from DevToolsAgent to DevToolsClient through the
-// browser.
-
-// Agent -> Client message chunk.
-//   |is_first| marks the first chunk, comes with the |message_size| for
-//   total message size.
-//   |is_last| marks the last chunk. |call_id|, |session_id| and |post_state|
-//   are optional parameters passed with the last chunk of the protocol
-//   response.
-IPC_STRUCT_BEGIN(DevToolsMessageChunk)
-  IPC_STRUCT_MEMBER(bool, is_first)
-  IPC_STRUCT_MEMBER(bool, is_last)
-  IPC_STRUCT_MEMBER(int, message_size)
-  IPC_STRUCT_MEMBER(int, session_id)
-  IPC_STRUCT_MEMBER(int, call_id)
-  IPC_STRUCT_MEMBER(std::string, data)
-  IPC_STRUCT_MEMBER(std::string, post_state)
-IPC_STRUCT_END()
-
-// Sends response from the agent to the client. Supports chunked encoding.
-IPC_MESSAGE_ROUTED1(DevToolsClientMsg_DispatchOnInspectorFrontend,
-                    DevToolsMessageChunk /* message */)
-
-//-----------------------------------------------------------------------------
-// These are messages sent from DevToolsClient to DevToolsAgent through the
-// browser.
-// Tells agent that there is a client host connected to it.
-IPC_MESSAGE_ROUTED1(DevToolsAgentMsg_Attach, int /* session_id */)
-
-// Tells agent that a client host was disconnected from another agent and
-// connected to this one.
-IPC_MESSAGE_ROUTED2(DevToolsAgentMsg_Reattach,
-                    int /* session_id */,
-                    std::string /* agent_state */)
-
-// Tells agent that there is no longer a client host connected to it.
-IPC_MESSAGE_ROUTED1(DevToolsAgentMsg_Detach, int /* session_id */)
-
-// WebKit-level transport.
-IPC_MESSAGE_ROUTED4(DevToolsAgentMsg_DispatchOnInspectorBackend,
-                    int /* session_id */,
-                    int /* call_id */,
-                    std::string /* method */,
-                    std::string /* message */)
-
-// Inspect element with the given coordinates.
-IPC_MESSAGE_ROUTED3(DevToolsAgentMsg_InspectElement,
-                    int /* session_id */,
-                    int /* x */,
-                    int /* y */)
-
-// ACK for DevToolsAgentHostMsg_RequestNewWindow message.
-IPC_MESSAGE_ROUTED2(DevToolsAgentMsg_RequestNewWindow_ACK,
-                    int /* session_id */,
-                    bool /* success */)
-
-//-----------------------------------------------------------------------------
-// These are messages sent from renderer's DevToolsAgent to browser.
-
-// Requests new DevTools window being opened for frame in the same process
-// with given routing id.
-IPC_MESSAGE_ROUTED2(DevToolsAgentHostMsg_RequestNewWindow,
-                    int /* session_id */,
-                    int /* frame_route_id */)
-
-#endif  // CONTENT_COMMON_DEVTOOLS_MESSAGES_H_
diff --git a/content/common/frame.mojom b/content/common/frame.mojom
index bb99d34..539864c 100644
--- a/content/common/frame.mojom
+++ b/content/common/frame.mojom
@@ -8,10 +8,10 @@
 import "content/common/service_worker/controller_service_worker.mojom";
 import "content/common/url_loader_factory_bundle.mojom";
 import "content/public/common/resource_type.mojom";
-import "content/public/common/url_loader.mojom";
 import "content/public/common/window_container_type.mojom";
 import "mojo/common/unguessable_token.mojom";
 import "mojo/common/string16.mojom";
+import "services/network/public/interfaces/url_loader.mojom";
 import "services/service_manager/public/interfaces/interface_provider.mojom";
 import "third_party/WebKit/common/feature_policy/feature_policy.mojom";
 import "third_party/WebKit/public/platform/referrer.mojom";
@@ -77,11 +77,11 @@
   // TODO(crbug.com/783506): Replace devtools navigation token with the generic
   // navigation token that can be passed from renderer to the browser.
   CommitNavigation(
-      URLResponseHead head,
+      network.mojom.URLResponseHead head,
       url.mojom.Url body_url,
       CommonNavigationParams common_params,
       RequestNavigationParams request_params,
-      URLLoaderClientEndpoints? url_loader_client_endpoints,
+      network.mojom.URLLoaderClientEndpoints? url_loader_client_endpoints,
       URLLoaderFactoryBundle? subresource_loader_factories,
       ControllerServiceWorkerInfo? controller_service_worker_info,
       mojo.common.mojom.UnguessableToken devtools_navigation_token);
diff --git a/content/common/frame_messages.h b/content/common/frame_messages.h
index 84eeeb5e..91c390b 100644
--- a/content/common/frame_messages.h
+++ b/content/common/frame_messages.h
@@ -31,6 +31,7 @@
 #include "content/common/frame_replication_state.h"
 #include "content/common/navigation_gesture.h"
 #include "content/common/navigation_params.h"
+#include "content/common/resource_timing_info.h"
 #include "content/common/savable_subframe.h"
 #include "content/public/common/common_param_traits.h"
 #include "content/public/common/console_message_level.h"
@@ -223,6 +224,50 @@
   IPC_STRUCT_TRAITS_MEMBER(had_form_interaction)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(content::ResourceLoadTiming)
+  IPC_STRUCT_TRAITS_MEMBER(request_time)
+  IPC_STRUCT_TRAITS_MEMBER(proxy_start)
+  IPC_STRUCT_TRAITS_MEMBER(proxy_end)
+  IPC_STRUCT_TRAITS_MEMBER(dns_start)
+  IPC_STRUCT_TRAITS_MEMBER(dns_end)
+  IPC_STRUCT_TRAITS_MEMBER(connect_start)
+  IPC_STRUCT_TRAITS_MEMBER(connect_end)
+  IPC_STRUCT_TRAITS_MEMBER(worker_start)
+  IPC_STRUCT_TRAITS_MEMBER(worker_ready)
+  IPC_STRUCT_TRAITS_MEMBER(send_start)
+  IPC_STRUCT_TRAITS_MEMBER(send_end)
+  IPC_STRUCT_TRAITS_MEMBER(receive_headers_end)
+  IPC_STRUCT_TRAITS_MEMBER(ssl_start)
+  IPC_STRUCT_TRAITS_MEMBER(ssl_end)
+  IPC_STRUCT_TRAITS_MEMBER(push_start)
+  IPC_STRUCT_TRAITS_MEMBER(push_end)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(content::ResourceTimingInfo)
+  IPC_STRUCT_TRAITS_MEMBER(name)
+  IPC_STRUCT_TRAITS_MEMBER(start_time)
+  IPC_STRUCT_TRAITS_MEMBER(initiator_type)
+  IPC_STRUCT_TRAITS_MEMBER(alpn_negotiated_protocol)
+  IPC_STRUCT_TRAITS_MEMBER(connection_info)
+  IPC_STRUCT_TRAITS_MEMBER(timing)
+  IPC_STRUCT_TRAITS_MEMBER(last_redirect_end_time)
+  IPC_STRUCT_TRAITS_MEMBER(finish_time)
+  IPC_STRUCT_TRAITS_MEMBER(transfer_size)
+  IPC_STRUCT_TRAITS_MEMBER(encoded_body_size)
+  IPC_STRUCT_TRAITS_MEMBER(decoded_body_size)
+  IPC_STRUCT_TRAITS_MEMBER(did_reuse_connection)
+  IPC_STRUCT_TRAITS_MEMBER(allow_timing_details)
+  IPC_STRUCT_TRAITS_MEMBER(allow_redirect_details)
+  IPC_STRUCT_TRAITS_MEMBER(allow_negative_values)
+  IPC_STRUCT_TRAITS_MEMBER(server_timing)
+IPC_STRUCT_TRAITS_END()
+
+IPC_STRUCT_TRAITS_BEGIN(content::ServerTimingInfo)
+  IPC_STRUCT_TRAITS_MEMBER(name)
+  IPC_STRUCT_TRAITS_MEMBER(duration)
+  IPC_STRUCT_TRAITS_MEMBER(description)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_BEGIN(FrameHostMsg_DidFailProvisionalLoadWithError_Params)
   // Error code as reported in the DidFailProvisionalLoad callback.
   IPC_STRUCT_MEMBER(int, error_code)
@@ -429,7 +474,6 @@
   IPC_STRUCT_TRAITS_MEMBER(nav_entry_id)
   IPC_STRUCT_TRAITS_MEMBER(is_history_navigation_in_new_child)
   IPC_STRUCT_TRAITS_MEMBER(subframe_unique_names)
-  IPC_STRUCT_TRAITS_MEMBER(has_committed_real_load)
   IPC_STRUCT_TRAITS_MEMBER(intended_as_new_entry)
   IPC_STRUCT_TRAITS_MEMBER(pending_history_list_offset)
   IPC_STRUCT_TRAITS_MEMBER(current_history_list_offset)
@@ -836,7 +880,13 @@
 // Change the accessibility mode in the renderer process.
 IPC_MESSAGE_ROUTED1(FrameMsg_SetAccessibilityMode, ui::AXMode)
 
-// Dispatch a load event in the iframe element containing this frame.
+// Sent to a proxy to record the resource timing info for this frame in the
+// parent frame.
+IPC_MESSAGE_ROUTED1(FrameMsg_ForwardResourceTimingToParent,
+                    content::ResourceTimingInfo)
+
+// Sent to a proxy to dispatch a load event in the iframe element containing
+// this frame.
 IPC_MESSAGE_ROUTED0(FrameMsg_DispatchLoad)
 
 // Sent to a subframe to control whether to collapse its the frame owner element
@@ -1542,6 +1592,11 @@
                     bool /* present */,
                     blink::WebSuddenTerminationDisablerType /* disabler_type */)
 
+// Requests that the resource timing info be added to the performance entries of
+// a remote parent frame.
+IPC_MESSAGE_ROUTED1(FrameHostMsg_ForwardResourceTimingToParent,
+                    content::ResourceTimingInfo)
+
 // Dispatch a load event for this frame in the iframe element of an
 // out-of-process parent frame.
 IPC_MESSAGE_ROUTED0(FrameHostMsg_DispatchLoad)
diff --git a/content/common/navigation_params.cc b/content/common/navigation_params.cc
index 8a23dc071..66ff83a 100644
--- a/content/common/navigation_params.cc
+++ b/content/common/navigation_params.cc
@@ -94,7 +94,6 @@
       can_load_local_resources(false),
       nav_entry_id(0),
       is_history_navigation_in_new_child(false),
-      has_committed_real_load(false),
       intended_as_new_entry(false),
       pending_history_list_offset(-1),
       current_history_list_offset(-1),
@@ -115,7 +114,6 @@
     int nav_entry_id,
     bool is_history_navigation_in_new_child,
     std::map<std::string, bool> subframe_unique_names,
-    bool has_committed_real_load,
     bool intended_as_new_entry,
     int pending_history_list_offset,
     int current_history_list_offset,
@@ -131,7 +129,6 @@
       nav_entry_id(nav_entry_id),
       is_history_navigation_in_new_child(is_history_navigation_in_new_child),
       subframe_unique_names(subframe_unique_names),
-      has_committed_real_load(has_committed_real_load),
       intended_as_new_entry(intended_as_new_entry),
       pending_history_list_offset(pending_history_list_offset),
       current_history_list_offset(current_history_list_offset),
diff --git a/content/common/navigation_params.h b/content/common/navigation_params.h
index 5b408d1..cb5c45f 100644
--- a/content/common/navigation_params.h
+++ b/content/common/navigation_params.h
@@ -184,7 +184,6 @@
                           int nav_entry_id,
                           bool is_history_navigation_in_new_child,
                           std::map<std::string, bool> subframe_unique_names,
-                          bool has_committed_real_load,
                           bool intended_as_new_entry,
                           int pending_history_list_offset,
                           int current_history_list_offset,
@@ -244,12 +243,6 @@
   // same-process PageStates for the whole subtree in https://crbug.com/639842.
   std::map<std::string, bool> subframe_unique_names;
 
-  // Whether the frame being navigated has already committed a real page, which
-  // affects how new navigations are classified in the renderer process.
-  // This currently is only ever set to true in --site-per-process mode.
-  // TODO(creis): Create FrameNavigationEntries by default so this always works.
-  bool has_committed_real_load;
-
   // For browser-initiated navigations, this is true if this is a new entry
   // being navigated to. This is false otherwise. TODO(avi): Remove this when
   // the pending entry situation is made sane and the browser keeps them around
diff --git a/content/common/navigation_subresource_loader_params.h b/content/common/navigation_subresource_loader_params.h
index 5fdb07e..35268f0 100644
--- a/content/common/navigation_subresource_loader_params.h
+++ b/content/common/navigation_subresource_loader_params.h
@@ -6,7 +6,7 @@
 #define CONTENT_COMMON_NAVIGATION_SUBRESOURCE_LOADER_PARAMS_H_
 
 #include "content/common/service_worker/controller_service_worker.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -24,7 +24,7 @@
 
   // The subresource loader factory info that is to be used to create a
   // subresource loader in the renderer.
-  mojom::URLLoaderFactoryPtrInfo loader_factory_info;
+  network::mojom::URLLoaderFactoryPtrInfo loader_factory_info;
 
   // The controller service worker, non-null if the frame is to be
   // controlled by the service worker.
diff --git a/content/common/renderer.mojom b/content/common/renderer.mojom
index b0b1d4d..afee0da 100644
--- a/content/common/renderer.mojom
+++ b/content/common/renderer.mojom
@@ -75,6 +75,9 @@
   // Whether the window associated with this view was created with an opener.
   bool window_was_created_with_opener;
 
+  // Whether or not the frame has previously committed a real load.
+  bool has_committed_real_load;
+
   // The initial renderer size.
   ResizeParams initial_size;
 
@@ -155,6 +158,9 @@
   // Specifies properties for a new RenderWidget that will be attached to the
   // new RenderFrame (if one is needed).
   CreateFrameWidgetParams widget_params;
+
+  // Whether or not the frame has previously committed a real load.
+  bool has_committed_real_load;
 };
 
 struct UpdateScrollbarThemeParams {
diff --git a/content/common/renderer_host.mojom b/content/common/renderer_host.mojom
index d7d2c1bf..5e0374c 100644
--- a/content/common/renderer_host.mojom
+++ b/content/common/renderer_host.mojom
@@ -4,13 +4,13 @@
 
 module content.mojom;
 
-import "content/public/common/url_loader_factory.mojom";
+import "services/network/public/interfaces/url_loader_factory.mojom";
 
 // The primordial interface implemented by a render process host. This should be
 // used for implementing renderer-to-browser messages.
 interface RendererHost {
   // Requests a URLLoaderFactory for the blob scheme.
-  GetBlobURLLoaderFactory(URLLoaderFactory& loader);
+  GetBlobURLLoaderFactory(network.mojom.URLLoaderFactory& loader);
 
   // Request a histogram from the browser. The browser will send the histogram
   // data only if it has been passed the command line flag
diff --git a/content/common/resource_messages.cc b/content/common/resource_messages.cc
deleted file mode 100644
index 9085f6d8..0000000
--- a/content/common/resource_messages.cc
+++ /dev/null
@@ -1,233 +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 "content/common/resource_messages.h"
-
-#include "base/files/file.h"
-#include "base/files/platform_file.h"
-#include "ipc/ipc_mojo_param_traits.h"
-#include "ipc/ipc_platform_file.h"
-#include "net/base/load_timing_info.h"
-#include "net/http/http_response_headers.h"
-
-namespace IPC {
-
-void ParamTraits<network::DataElement>::Write(base::Pickle* m,
-                                              const param_type& p) {
-  WriteParam(m, static_cast<int>(p.type()));
-  switch (p.type()) {
-    case network::DataElement::TYPE_BYTES: {
-      m->WriteData(p.bytes(), static_cast<int>(p.length()));
-      break;
-    }
-    case network::DataElement::TYPE_BYTES_DESCRIPTION: {
-      WriteParam(m, p.length());
-      break;
-    }
-    case network::DataElement::TYPE_FILE: {
-      WriteParam(m, p.path());
-      WriteParam(m, p.offset());
-      WriteParam(m, p.length());
-      WriteParam(m, p.expected_modification_time());
-      break;
-    }
-    case network::DataElement::TYPE_RAW_FILE: {
-      WriteParam(
-          m, IPC::GetPlatformFileForTransit(p.file().GetPlatformFile(),
-                                            false /* close_source_handle */));
-      WriteParam(m, p.path());
-      WriteParam(m, p.offset());
-      WriteParam(m, p.length());
-      WriteParam(m, p.expected_modification_time());
-      break;
-    }
-    case network::DataElement::TYPE_FILE_FILESYSTEM: {
-      WriteParam(m, p.filesystem_url());
-      WriteParam(m, p.offset());
-      WriteParam(m, p.length());
-      WriteParam(m, p.expected_modification_time());
-      break;
-    }
-    case network::DataElement::TYPE_BLOB: {
-      WriteParam(m, p.blob_uuid());
-      WriteParam(m, p.offset());
-      WriteParam(m, p.length());
-      break;
-    }
-    case network::DataElement::TYPE_DISK_CACHE_ENTRY: {
-      NOTREACHED() << "Can't be sent by IPC.";
-      break;
-    }
-    case network::DataElement::TYPE_DATA_PIPE: {
-      WriteParam(m,
-                 const_cast<network::mojom::DataPipeGetterPtr&>(p.data_pipe())
-                     .PassInterface()
-                     .PassHandle()
-                     .release());
-      break;
-    }
-    case network::DataElement::TYPE_UNKNOWN: {
-      NOTREACHED();
-      break;
-    }
-  }
-}
-
-bool ParamTraits<network::DataElement>::Read(const base::Pickle* m,
-                                             base::PickleIterator* iter,
-                                             param_type* r) {
-  int type;
-  if (!ReadParam(m, iter, &type))
-    return false;
-  switch (type) {
-    case network::DataElement::TYPE_BYTES: {
-      const char* data;
-      int len;
-      if (!iter->ReadData(&data, &len))
-        return false;
-      r->SetToBytes(data, len);
-      return true;
-    }
-    case network::DataElement::TYPE_BYTES_DESCRIPTION: {
-      uint64_t length;
-      if (!ReadParam(m, iter, &length))
-        return false;
-      r->SetToBytesDescription(length);
-      return true;
-    }
-    case network::DataElement::TYPE_FILE: {
-      base::FilePath file_path;
-      uint64_t offset, length;
-      base::Time expected_modification_time;
-      if (!ReadParam(m, iter, &file_path))
-        return false;
-      if (!ReadParam(m, iter, &offset))
-        return false;
-      if (!ReadParam(m, iter, &length))
-        return false;
-      if (!ReadParam(m, iter, &expected_modification_time))
-        return false;
-      r->SetToFilePathRange(file_path, offset, length,
-                            expected_modification_time);
-      return true;
-    }
-    case network::DataElement::TYPE_RAW_FILE: {
-      IPC::PlatformFileForTransit platform_file_for_transit;
-      if (!ReadParam(m, iter, &platform_file_for_transit))
-        return false;
-      base::File file = PlatformFileForTransitToFile(platform_file_for_transit);
-      base::FilePath file_path;
-      if (!ReadParam(m, iter, &file_path))
-        return false;
-      uint64_t offset;
-      if (!ReadParam(m, iter, &offset))
-        return false;
-      uint64_t length;
-      if (!ReadParam(m, iter, &length))
-        return false;
-      base::Time expected_modification_time;
-      if (!ReadParam(m, iter, &expected_modification_time))
-        return false;
-      r->SetToFileRange(std::move(file), file_path, offset, length,
-                        expected_modification_time);
-      return true;
-    }
-    case network::DataElement::TYPE_FILE_FILESYSTEM: {
-      GURL file_system_url;
-      uint64_t offset, length;
-      base::Time expected_modification_time;
-      if (!ReadParam(m, iter, &file_system_url))
-        return false;
-      if (!ReadParam(m, iter, &offset))
-        return false;
-      if (!ReadParam(m, iter, &length))
-        return false;
-      if (!ReadParam(m, iter, &expected_modification_time))
-        return false;
-      r->SetToFileSystemUrlRange(file_system_url, offset, length,
-                                 expected_modification_time);
-      return true;
-    }
-    case network::DataElement::TYPE_BLOB: {
-      std::string blob_uuid;
-      uint64_t offset, length;
-      if (!ReadParam(m, iter, &blob_uuid))
-        return false;
-      if (!ReadParam(m, iter, &offset))
-        return false;
-      if (!ReadParam(m, iter, &length))
-        return false;
-      r->SetToBlobRange(blob_uuid, offset, length);
-      return true;
-    }
-    case network::DataElement::TYPE_DISK_CACHE_ENTRY: {
-      NOTREACHED() << "Can't be sent by IPC.";
-      return false;
-    }
-    case network::DataElement::TYPE_DATA_PIPE: {
-      network::mojom::DataPipeGetterPtr data_pipe_getter;
-      mojo::MessagePipeHandle message_pipe;
-      if (!ReadParam(m, iter, &message_pipe))
-        return false;
-      data_pipe_getter.Bind(network::mojom::DataPipeGetterPtrInfo(
-          mojo::ScopedMessagePipeHandle(message_pipe), 0u));
-      r->SetToDataPipe(std::move(data_pipe_getter));
-      return true;
-    }
-    case network::DataElement::TYPE_UNKNOWN: {
-      NOTREACHED();
-      return false;
-    }
-  }
-  return false;
-}
-
-void ParamTraits<network::DataElement>::Log(const param_type& p,
-                                            std::string* l) {
-  l->append("<network::DataElement>");
-}
-
-void ParamTraits<scoped_refptr<network::ResourceRequestBody>>::Write(
-    base::Pickle* m,
-    const param_type& p) {
-  WriteParam(m, p.get() != nullptr);
-  if (p.get()) {
-    WriteParam(m, *p->elements());
-    WriteParam(m, p->identifier());
-    WriteParam(m, p->contains_sensitive_info());
-  }
-}
-
-bool ParamTraits<scoped_refptr<network::ResourceRequestBody>>::Read(
-    const base::Pickle* m,
-    base::PickleIterator* iter,
-    param_type* r) {
-  bool has_object;
-  if (!ReadParam(m, iter, &has_object))
-    return false;
-  if (!has_object)
-    return true;
-  std::vector<network::DataElement> elements;
-  if (!ReadParam(m, iter, &elements))
-    return false;
-  int64_t identifier;
-  if (!ReadParam(m, iter, &identifier))
-    return false;
-  bool contains_sensitive_info;
-  if (!ReadParam(m, iter, &contains_sensitive_info))
-    return false;
-  *r = new network::ResourceRequestBody;
-  (*r)->swap_elements(&elements);
-  (*r)->set_identifier(identifier);
-  (*r)->set_contains_sensitive_info(contains_sensitive_info);
-  return true;
-}
-
-void ParamTraits<scoped_refptr<network::ResourceRequestBody>>::Log(
-    const param_type& p,
-    std::string* l) {
-  l->append("<ResourceRequestBody>");
-}
-
-}  // namespace IPC
diff --git a/content/common/resource_messages.h b/content/common/resource_messages.h
index 0d60dec9..db8a05e 100644
--- a/content/common/resource_messages.h
+++ b/content/common/resource_messages.h
@@ -23,107 +23,21 @@
 #include "net/http/http_response_info.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "services/network/public/cpp/network_param_ipc_traits.h"
-#include "services/network/public/cpp/resource_request.h"
-#include "services/network/public/cpp/resource_request_body.h"
 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h"
 
 #ifndef INTERNAL_CONTENT_COMMON_RESOURCE_MESSAGES_H_
 #define INTERNAL_CONTENT_COMMON_RESOURCE_MESSAGES_H_
 
-namespace IPC {
-
-template <>
-struct CONTENT_EXPORT ParamTraits<network::DataElement> {
-  typedef network::DataElement param_type;
-  static void Write(base::Pickle* m, const param_type& p);
-  static bool Read(const base::Pickle* m,
-                   base::PickleIterator* iter,
-                   param_type* r);
-  static void Log(const param_type& p, std::string* l);
-};
-
-template <>
-struct ParamTraits<scoped_refptr<network::ResourceRequestBody>> {
-  typedef scoped_refptr<network::ResourceRequestBody> param_type;
-  static void Write(base::Pickle* m, const param_type& p);
-  static bool Read(const base::Pickle* m,
-                   base::PickleIterator* iter,
-                   param_type* r);
-  static void Log(const param_type& p, std::string* l);
-};
-
-}  // namespace IPC
-
 #endif  // INTERNAL_CONTENT_COMMON_RESOURCE_MESSAGES_H_
 
 #define IPC_MESSAGE_START ResourceMsgStart
 #undef IPC_MESSAGE_EXPORT
 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
 
-IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchRequestMode,
-                          network::mojom::FetchRequestMode::kLast)
-
-IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchRedirectMode,
-                          network::mojom::FetchRedirectMode::kLast)
-
-IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchCredentialsMode,
-                          network::mojom::FetchCredentialsMode::kLast)
-
 IPC_ENUM_TRAITS_MAX_VALUE(content::ServiceWorkerMode,
                           content::ServiceWorkerMode::LAST)
 
 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebMixedContentContextType,
                           blink::WebMixedContentContextType::kLast)
 
-IPC_STRUCT_TRAITS_BEGIN(net::MutableNetworkTrafficAnnotationTag)
-  IPC_STRUCT_TRAITS_MEMBER(unique_id_hash_code)
-IPC_STRUCT_TRAITS_END()
-
-IPC_STRUCT_TRAITS_BEGIN(network::ResourceRequest)
-  IPC_STRUCT_TRAITS_MEMBER(method)
-  IPC_STRUCT_TRAITS_MEMBER(url)
-  IPC_STRUCT_TRAITS_MEMBER(site_for_cookies)
-  IPC_STRUCT_TRAITS_MEMBER(update_first_party_url_on_redirect)
-  IPC_STRUCT_TRAITS_MEMBER(request_initiator)
-  IPC_STRUCT_TRAITS_MEMBER(referrer)
-  IPC_STRUCT_TRAITS_MEMBER(referrer_policy)
-  IPC_STRUCT_TRAITS_MEMBER(is_prerendering)
-  IPC_STRUCT_TRAITS_MEMBER(headers)
-  IPC_STRUCT_TRAITS_MEMBER(load_flags)
-  IPC_STRUCT_TRAITS_MEMBER(plugin_child_id)
-  IPC_STRUCT_TRAITS_MEMBER(resource_type)
-  IPC_STRUCT_TRAITS_MEMBER(priority)
-  IPC_STRUCT_TRAITS_MEMBER(request_context)
-  IPC_STRUCT_TRAITS_MEMBER(appcache_host_id)
-  IPC_STRUCT_TRAITS_MEMBER(should_reset_appcache)
-  IPC_STRUCT_TRAITS_MEMBER(service_worker_provider_id)
-  IPC_STRUCT_TRAITS_MEMBER(originated_from_service_worker)
-  IPC_STRUCT_TRAITS_MEMBER(service_worker_mode)
-  IPC_STRUCT_TRAITS_MEMBER(fetch_request_mode)
-  IPC_STRUCT_TRAITS_MEMBER(fetch_credentials_mode)
-  IPC_STRUCT_TRAITS_MEMBER(fetch_redirect_mode)
-  IPC_STRUCT_TRAITS_MEMBER(fetch_integrity)
-  IPC_STRUCT_TRAITS_MEMBER(fetch_request_context_type)
-  IPC_STRUCT_TRAITS_MEMBER(fetch_frame_type)
-  IPC_STRUCT_TRAITS_MEMBER(request_body)
-  IPC_STRUCT_TRAITS_MEMBER(download_to_file)
-  IPC_STRUCT_TRAITS_MEMBER(keepalive)
-  IPC_STRUCT_TRAITS_MEMBER(has_user_gesture)
-  IPC_STRUCT_TRAITS_MEMBER(enable_load_timing)
-  IPC_STRUCT_TRAITS_MEMBER(enable_upload_progress)
-  IPC_STRUCT_TRAITS_MEMBER(do_not_prompt_for_login)
-  IPC_STRUCT_TRAITS_MEMBER(render_frame_id)
-  IPC_STRUCT_TRAITS_MEMBER(is_main_frame)
-  IPC_STRUCT_TRAITS_MEMBER(transition_type)
-  IPC_STRUCT_TRAITS_MEMBER(should_replace_current_entry)
-  IPC_STRUCT_TRAITS_MEMBER(transferred_request_child_id)
-  IPC_STRUCT_TRAITS_MEMBER(transferred_request_request_id)
-  IPC_STRUCT_TRAITS_MEMBER(allow_download)
-  IPC_STRUCT_TRAITS_MEMBER(report_raw_headers)
-  IPC_STRUCT_TRAITS_MEMBER(previews_state)
-  IPC_STRUCT_TRAITS_MEMBER(resource_body_stream_url)
-  IPC_STRUCT_TRAITS_MEMBER(initiated_in_secure_context)
-  IPC_STRUCT_TRAITS_MEMBER(download_to_network_cache_only)
-IPC_STRUCT_TRAITS_END()
-
 #endif  // CONTENT_COMMON_RESOURCE_MESSAGES_H_
diff --git a/content/common/resource_timing_info.cc b/content/common/resource_timing_info.cc
new file mode 100644
index 0000000..00ece37
--- /dev/null
+++ b/content/common/resource_timing_info.cc
@@ -0,0 +1,21 @@
+// Copyright 2017 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/common/resource_timing_info.h"
+
+namespace content {
+
+ServerTimingInfo::ServerTimingInfo() = default;
+ServerTimingInfo::ServerTimingInfo(const ServerTimingInfo&) = default;
+ServerTimingInfo::~ServerTimingInfo() = default;
+
+ResourceLoadTiming::ResourceLoadTiming() = default;
+ResourceLoadTiming::ResourceLoadTiming(const ResourceLoadTiming&) = default;
+ResourceLoadTiming::~ResourceLoadTiming() = default;
+
+ResourceTimingInfo::ResourceTimingInfo() = default;
+ResourceTimingInfo::ResourceTimingInfo(const ResourceTimingInfo&) = default;
+ResourceTimingInfo::~ResourceTimingInfo() = default;
+
+}  // namespace content
diff --git a/content/common/resource_timing_info.h b/content/common/resource_timing_info.h
new file mode 100644
index 0000000..78b9a61
--- /dev/null
+++ b/content/common/resource_timing_info.h
@@ -0,0 +1,86 @@
+// Copyright 2017 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_COMMON_RESOURCE_TIMING_INFO_H_
+#define CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
+
+#include <stdint.h>
+
+#include <string>
+#include <vector>
+
+#include "base/optional.h"
+
+namespace content {
+
+// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
+// duplicated in //content and //third_party/WebKit.
+// See blink::WebServerTimingInfo for more information about this struct's
+// fields.
+struct ServerTimingInfo {
+  ServerTimingInfo();
+  ServerTimingInfo(const ServerTimingInfo&);
+  ~ServerTimingInfo();
+
+  std::string name;
+  double duration = 0.0;
+  std::string description;
+};
+
+// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
+// duplicated in //content and //third_party/WebKit.
+// See blink::WebURLLoadTiming for more information about this struct's fields.
+struct ResourceLoadTiming {
+  ResourceLoadTiming();
+  ResourceLoadTiming(const ResourceLoadTiming&);
+  ~ResourceLoadTiming();
+
+  double request_time = 0.0;
+  double proxy_start = 0.0;
+  double proxy_end = 0.0;
+  double dns_start = 0.0;
+  double dns_end = 0.0;
+  double connect_start = 0.0;
+  double connect_end = 0.0;
+  double worker_start = 0.0;
+  double worker_ready = 0.0;
+  double send_start = 0.0;
+  double send_end = 0.0;
+  double receive_headers_end = 0.0;
+  double ssl_start = 0.0;
+  double ssl_end = 0.0;
+  double push_start = 0.0;
+  double push_end = 0.0;
+};
+
+// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
+// duplicated in //content and //third_party/WebKit.
+// See blink::WebResourceTimingInfo for more information about this struct's
+// fields.
+struct ResourceTimingInfo {
+  ResourceTimingInfo();
+  ResourceTimingInfo(const ResourceTimingInfo&);
+  ~ResourceTimingInfo();
+
+  std::string name;
+  double start_time = 0.0;
+  std::string initiator_type;
+  std::string alpn_negotiated_protocol;
+  std::string connection_info;
+  base::Optional<ResourceLoadTiming> timing;
+  double last_redirect_end_time = 0.0;
+  double finish_time = 0.0;
+  uint64_t transfer_size = 0;
+  uint64_t encoded_body_size = 0;
+  uint64_t decoded_body_size = 0;
+  bool did_reuse_connection = false;
+  bool allow_timing_details = false;
+  bool allow_redirect_details = false;
+  bool allow_negative_values = false;
+  std::vector<ServerTimingInfo> server_timing;
+};
+
+}  // namespace content
+
+#endif  // CONTENT_COMMON_RESOURCE_TIMING_INFO_H_
diff --git a/content/common/service_worker/controller_service_worker.mojom b/content/common/service_worker/controller_service_worker.mojom
index 2fd4b7a8..e06dfd75c 100644
--- a/content/common/service_worker/controller_service_worker.mojom
+++ b/content/common/service_worker/controller_service_worker.mojom
@@ -5,8 +5,8 @@
 module content.mojom;
 
 import "content/common/service_worker/service_worker_fetch_response_callback.mojom";
-import "content/public/common/url_loader.mojom";
 import "mojo/common/time.mojom";
+import "services/network/public/interfaces/url_loader.mojom";
 import "third_party/WebKit/common/service_worker/service_worker_event_status.mojom";
 import "third_party/WebKit/common/service_worker/service_worker_object.mojom";
 import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom";
@@ -36,7 +36,7 @@
   // handler ran and all outstanding respondWith() and waitUntil() promises have
   // settled. |response_callback| is called once the promise to respondWith()
   // settles, or when the event handler ran without calling respondWith().
-  DispatchFetchEvent(URLRequest request,
+  DispatchFetchEvent(network.mojom.URLRequest request,
                      ServiceWorkerFetchResponseCallback response_callback)
       => (blink.mojom.ServiceWorkerEventStatus status,
           mojo.common.mojom.Time dispatch_event_time);
diff --git a/content/common/service_worker/embedded_worker.mojom b/content/common/service_worker/embedded_worker.mojom
index dc2df526..c59043dc 100644
--- a/content/common/service_worker/embedded_worker.mojom
+++ b/content/common/service_worker/embedded_worker.mojom
@@ -90,7 +90,7 @@
   AddMessageToConsole(blink.mojom.ConsoleMessageLevel level, string message);
   // Returns a DevToolsAgent interface for this embedded worker, used for
   // remote debugging. See DevToolsAgent for details.
-  GetDevToolsAgent(associated blink.mojom.DevToolsAgent& devtools_agent);
+  BindDevToolsAgent(associated blink.mojom.DevToolsAgent& devtools_agent);
 };
 
 // EmbeddedWorkerInstanceHost is the browser-side ("Host") of
diff --git a/content/common/service_worker/service_worker.mojom b/content/common/service_worker/service_worker.mojom
index 334d46b..154f2af 100644
--- a/content/common/service_worker/service_worker.mojom
+++ b/content/common/service_worker/service_worker.mojom
@@ -5,7 +5,6 @@
 module content.mojom;
 
 import "content/common/service_worker/service_worker_provider.mojom";
-import "content/public/common/url_loader_factory.mojom";
 
 // Per-process browser-side interface.
 // The renderer uses this interface to tell the browser when potential service
diff --git a/content/common/service_worker/service_worker_event_dispatcher.mojom b/content/common/service_worker/service_worker_event_dispatcher.mojom
index 425ed1ca..15cacc59 100644
--- a/content/common/service_worker/service_worker_event_dispatcher.mojom
+++ b/content/common/service_worker/service_worker_event_dispatcher.mojom
@@ -5,9 +5,9 @@
 module content.mojom;
 
 import "content/common/service_worker/service_worker_fetch_response_callback.mojom";
-import "content/public/common/url_loader.mojom";
 import "mojo/common/string16.mojom";
 import "mojo/common/time.mojom";
+import "services/network/public/interfaces/url_loader.mojom";
 import "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom";
 import "third_party/WebKit/public/platform/modules/payments/payment_app.mojom";
 import "third_party/WebKit/common/service_worker/service_worker_client.mojom";
@@ -39,8 +39,8 @@
 };
 
 struct FetchEventPreloadHandle {
-  URLLoader url_loader;
-  URLLoaderClient& url_loader_client_request;
+  network.mojom.URLLoader url_loader;
+  network.mojom.URLLoaderClient& url_loader_client_request;
 };
 
 struct ExtendableMessageEvent {
@@ -106,7 +106,7 @@
       => (blink.mojom.ServiceWorkerEventStatus status,
           mojo.common.mojom.Time dispatch_event_time);
   // S13nServiceWorker
-  DispatchFetchEvent(URLRequest request,
+  DispatchFetchEvent(network.mojom.URLRequest request,
                      FetchEventPreloadHandle? preload_handle,
                      ServiceWorkerFetchResponseCallback response_callback)
       => (blink.mojom.ServiceWorkerEventStatus status,
diff --git a/content/common/service_worker/service_worker_provider.mojom b/content/common/service_worker/service_worker_provider.mojom
index 107fde0..bc77532d 100644
--- a/content/common/service_worker/service_worker_provider.mojom
+++ b/content/common/service_worker/service_worker_provider.mojom
@@ -5,7 +5,7 @@
 module content.mojom;
 
 import "content/common/service_worker/service_worker_container.mojom";
-import "content/public/common/url_loader_factory.mojom";
+import "services/network/public/interfaces/url_loader_factory.mojom";
 import "services/service_manager/public/interfaces/interface_provider.mojom";
 import "third_party/WebKit/common/service_worker/service_worker_provider_type.mojom";
 import "third_party/WebKit/common/service_worker/service_worker_registration.mojom";
@@ -30,7 +30,7 @@
   // For servicified service worker only.
   // The loader to use for loading the worker's main script and
   // importScripts().
-  associated URLLoaderFactory? script_loader_factory_ptr_info;
+  associated network.mojom.URLLoaderFactory? script_loader_factory_ptr_info;
 
   service_manager.mojom.InterfaceProvider interface_provider;
 };
diff --git a/content/common/shared_worker/shared_worker.mojom b/content/common/shared_worker/shared_worker.mojom
index 481ece5..ca8229b 100644
--- a/content/common/shared_worker/shared_worker.mojom
+++ b/content/common/shared_worker/shared_worker.mojom
@@ -17,7 +17,7 @@
   // closing its end of the mojo connection.
   Terminate();
 
-  // Returns a DevToolsAgent interface for this shared worker, used for
+  // Binds a DevToolsAgent interface for this shared worker, used for
   // remote debugging. See DevToolsAgent for details.
-  GetDevToolsAgent(associated blink.mojom.DevToolsAgent& devtools_agent);
+  BindDevToolsAgent(associated blink.mojom.DevToolsAgent& devtools_agent);
 };
diff --git a/content/common/throttling_url_loader.cc b/content/common/throttling_url_loader.cc
index d4fea331..890cd9d 100644
--- a/content/common/throttling_url_loader.cc
+++ b/content/common/throttling_url_loader.cc
@@ -114,7 +114,7 @@
 ThrottlingURLLoader::ResponseInfo::ResponseInfo(
     const network::ResourceResponseHead& in_response_head,
     const base::Optional<net::SSLInfo>& in_ssl_info,
-    mojom::DownloadedTempFilePtr in_downloaded_file)
+    network::mojom::DownloadedTempFilePtr in_downloaded_file)
     : response_head(in_response_head),
       ssl_info(in_ssl_info),
       downloaded_file(std::move(in_downloaded_file)) {}
@@ -143,7 +143,7 @@
     int32_t request_id,
     uint32_t options,
     network::ResourceRequest* url_request,
-    mojom::URLLoaderClient* client,
+    network::mojom::URLLoaderClient* client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
   std::unique_ptr<ThrottlingURLLoader> loader(new ThrottlingURLLoader(
@@ -159,12 +159,12 @@
     std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
     int32_t routing_id,
     network::ResourceRequest* url_request,
-    mojom::URLLoaderClient* client,
+    network::mojom::URLLoaderClient* client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
   std::unique_ptr<ThrottlingURLLoader> loader(new ThrottlingURLLoader(
       std::move(throttles), client, traffic_annotation));
-  loader->Start(nullptr, routing_id, 0, mojom::kURLLoadOptionNone,
+  loader->Start(nullptr, routing_id, 0, network::mojom::kURLLoadOptionNone,
                 std::move(start_loader_callback), url_request,
                 std::move(task_runner));
   return loader;
@@ -210,14 +210,14 @@
   loader_cancelled_ = true;
 }
 
-mojom::URLLoaderClientEndpointsPtr ThrottlingURLLoader::Unbind() {
-  return mojom::URLLoaderClientEndpoints::New(url_loader_.PassInterface(),
-                                              client_binding_.Unbind());
+network::mojom::URLLoaderClientEndpointsPtr ThrottlingURLLoader::Unbind() {
+  return network::mojom::URLLoaderClientEndpoints::New(
+      url_loader_.PassInterface(), client_binding_.Unbind());
 }
 
 ThrottlingURLLoader::ThrottlingURLLoader(
     std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
-    mojom::URLLoaderClient* client,
+    network::mojom::URLLoaderClient* client,
     const net::NetworkTrafficAnnotationTag& traffic_annotation)
     : forwarding_client_(client),
       client_binding_(this),
@@ -239,7 +239,7 @@
   DCHECK_EQ(DEFERRED_NONE, deferred_stage_);
   DCHECK(!loader_cancelled_);
 
-  if (options & mojom::kURLLoadOptionSynchronous)
+  if (options & network::mojom::kURLLoadOptionSynchronous)
     is_synchronous_ = true;
 
   DCHECK(deferring_throttles_.empty());
@@ -276,7 +276,7 @@
     StartLoaderCallback start_loader_callback,
     network::ResourceRequest* url_request,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
-  mojom::URLLoaderClientPtr client;
+  network::mojom::URLLoaderClientPtr client;
   client_binding_.Bind(mojo::MakeRequest(&client), std::move(task_runner));
   client_binding_.set_connection_error_handler(base::Bind(
       &ThrottlingURLLoader::OnClientConnectionError, base::Unretained(this)));
@@ -331,7 +331,7 @@
 void ThrottlingURLLoader::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   DCHECK_EQ(DEFERRED_NONE, deferred_stage_);
   DCHECK(!loader_cancelled_);
   DCHECK(deferring_throttles_.empty());
diff --git a/content/common/throttling_url_loader.h b/content/common/throttling_url_loader.h
index 3416297..2939fa4 100644
--- a/content/common/throttling_url_loader.h
+++ b/content/common/throttling_url_loader.h
@@ -14,10 +14,10 @@
 #include "content/common/content_export.h"
 #include "content/common/possibly_associated_interface_ptr.h"
 #include "content/public/common/shared_url_loader_factory.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/common/url_loader_throttle.h"
 #include "mojo/public/cpp/bindings/binding.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace base {
 class SingleThreadTaskRunner;
@@ -25,11 +25,17 @@
 
 namespace content {
 
-// ThrottlingURLLoader is a wrapper around the mojom::URLLoader interfaces. It
-// applies a list of URLLoaderThrottle instances which could defer, resume or
-// cancel the URL loading. If the Mojo connection fails during the request it is
-// canceled with net::ERR_ABORTED.
-class CONTENT_EXPORT ThrottlingURLLoader : public mojom::URLLoaderClient {
+namespace mojom {
+class URLLoaderFactory;
+}
+
+// ThrottlingURLLoader is a wrapper around the
+// network::mojom::URLLoader[Factory] interfaces. It applies a list of
+// URLLoaderThrottle instances which could defer, resume or cancel the URL
+// loading. If the Mojo connection fails during the request it is canceled with
+// net::ERR_ABORTED.
+class CONTENT_EXPORT ThrottlingURLLoader
+    : public network::mojom::URLLoaderClient {
  public:
   // |client| must stay alive during the lifetime of the returned object. Please
   // note that the request may not start immediately since it could be deferred
@@ -41,23 +47,23 @@
       int32_t request_id,
       uint32_t options,
       network::ResourceRequest* url_request,
-      mojom::URLLoaderClient* client,
+      network::mojom::URLLoaderClient* client,
       const net::NetworkTrafficAnnotationTag& traffic_annotation,
       scoped_refptr<base::SingleThreadTaskRunner> task_runner);
 
   using StartLoaderCallback =
-      base::OnceCallback<void(mojom::URLLoaderRequest request,
-                              mojom::URLLoaderClientPtr client)>;
+      base::OnceCallback<void(network::mojom::URLLoaderRequest request,
+                              network::mojom::URLLoaderClientPtr client)>;
 
   // Similar to the method above, but uses a |start_loader_callback| instead of
-  // a SharedURLLoaderFactory to start the loader. The callback must be safe
-  // to call during the lifetime of the returned object.
+  // a network::mojom::URLLoaderFactory to start the loader. The callback must
+  // be safe to call during the lifetime of the returned object.
   static std::unique_ptr<ThrottlingURLLoader> CreateLoaderAndStart(
       StartLoaderCallback start_loader_callback,
       std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
       int32_t routing_id,
       network::ResourceRequest* url_request,
-      mojom::URLLoaderClient* client,
+      network::mojom::URLLoaderClient* client,
       const net::NetworkTrafficAnnotationTag& traffic_annotation,
       scoped_refptr<base::SingleThreadTaskRunner> task_runner);
 
@@ -71,10 +77,10 @@
 
   // Disconnect the forwarding URLLoaderClient and the URLLoader. Returns the
   // datapipe endpoints.
-  mojom::URLLoaderClientEndpointsPtr Unbind();
+  network::mojom::URLLoaderClientEndpointsPtr Unbind();
 
   // Sets the forwarding client to receive all subsequent notifications.
-  void set_forwarding_client(mojom::URLLoaderClient* client) {
+  void set_forwarding_client(network::mojom::URLLoaderClient* client) {
     forwarding_client_ = client;
   }
 
@@ -83,7 +89,7 @@
 
   ThrottlingURLLoader(
       std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
-      mojom::URLLoaderClient* client,
+      network::mojom::URLLoaderClient* client,
       const net::NetworkTrafficAnnotationTag& traffic_annotation);
 
   // Either of the two sets of arguments below is valid but not both:
@@ -118,10 +124,11 @@
   // progress.
   void StopDeferringForThrottle(URLLoaderThrottle* throttle);
 
-  // mojom::URLLoaderClient implementation:
-  void OnReceiveResponse(const network::ResourceResponseHead& response_head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  // network::mojom::URLLoaderClient implementation:
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& response_head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(
       const net::RedirectInfo& redirect_info,
       const network::ResourceResponseHead& response_head) override;
@@ -175,10 +182,10 @@
   // NOTE: This may point to a native implementation (instead of a Mojo proxy
   // object). And it is possible that the implementation of |forwarding_client_|
   // destroys this object synchronously when this object is calling into it.
-  mojom::URLLoaderClient* forwarding_client_;
-  mojo::Binding<mojom::URLLoaderClient> client_binding_;
+  network::mojom::URLLoaderClient* forwarding_client_;
+  mojo::Binding<network::mojom::URLLoaderClient> client_binding_;
 
-  mojom::URLLoaderPtr url_loader_;
+  network::mojom::URLLoaderPtr url_loader_;
 
   struct StartInfo {
     StartInfo(scoped_refptr<SharedURLLoaderFactory> in_url_loader_factory,
@@ -207,12 +214,12 @@
   struct ResponseInfo {
     ResponseInfo(const network::ResourceResponseHead& in_response_head,
                  const base::Optional<net::SSLInfo>& in_ssl_info,
-                 mojom::DownloadedTempFilePtr in_downloaded_file);
+                 network::mojom::DownloadedTempFilePtr in_downloaded_file);
     ~ResponseInfo();
 
     network::ResourceResponseHead response_head;
     base::Optional<net::SSLInfo> ssl_info;
-    mojom::DownloadedTempFilePtr downloaded_file;
+    network::mojom::DownloadedTempFilePtr downloaded_file;
   };
   // Set if response is deferred.
   std::unique_ptr<ResponseInfo> response_info_;
diff --git a/content/common/throttling_url_loader_unittest.cc b/content/common/throttling_url_loader_unittest.cc
index 46a3644..d63d6fe4 100644
--- a/content/common/throttling_url_loader_unittest.cc
+++ b/content/common/throttling_url_loader_unittest.cc
@@ -9,10 +9,10 @@
 #include "base/test/scoped_task_environment.h"
 #include "content/common/weak_wrapper_shared_url_loader_factory.h"
 #include "content/public/common/browser_side_navigation_policy.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/common/url_loader_throttle.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace content {
@@ -21,8 +21,8 @@
 GURL request_url = GURL("http://example.org");
 GURL redirect_url = GURL("http://example.com");
 
-class TestURLLoaderFactory : public mojom::URLLoaderFactory,
-                             public mojom::URLLoader {
+class TestURLLoaderFactory : public network::mojom::URLLoaderFactory,
+                             public network::mojom::URLLoader {
  public:
   TestURLLoaderFactory() : binding_(this), url_loader_binding_(this) {
     binding_.Bind(mojo::MakeRequest(&factory_ptr_));
@@ -32,9 +32,9 @@
 
   ~TestURLLoaderFactory() override { shared_factory_->Detach(); }
 
-  mojom::URLLoaderFactoryPtr& factory_ptr() { return factory_ptr_; }
-  mojom::URLLoaderClientPtr& client_ptr() { return client_ptr_; }
-  mojo::Binding<mojom::URLLoader>& url_loader_binding() {
+  network::mojom::URLLoaderFactoryPtr& factory_ptr() { return factory_ptr_; }
+  network::mojom::URLLoaderClientPtr& client_ptr() { return client_ptr_; }
+  mojo::Binding<network::mojom::URLLoader>& url_loader_binding() {
     return url_loader_binding_;
   }
   scoped_refptr<SharedURLLoaderFactory> shared_factory() {
@@ -73,13 +73,13 @@
   void CloseClientPipe() { client_ptr_.reset(); }
 
  private:
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     create_loader_and_start_called_++;
@@ -90,9 +90,11 @@
     client_ptr_ = std::move(client);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
-  // mojom::URLLoader implementation.
+  // network::mojom::URLLoader implementation.
   void FollowRedirect() override {}
   void ProceedWithResponse() override {}
 
@@ -111,15 +113,15 @@
   size_t pause_reading_body_from_net_called_ = 0;
   size_t resume_reading_body_from_net_called_ = 0;
 
-  mojo::Binding<mojom::URLLoaderFactory> binding_;
-  mojo::Binding<mojom::URLLoader> url_loader_binding_;
-  mojom::URLLoaderFactoryPtr factory_ptr_;
-  mojom::URLLoaderClientPtr client_ptr_;
+  mojo::Binding<network::mojom::URLLoaderFactory> binding_;
+  mojo::Binding<network::mojom::URLLoader> url_loader_binding_;
+  network::mojom::URLLoaderFactoryPtr factory_ptr_;
+  network::mojom::URLLoaderClientPtr client_ptr_;
   scoped_refptr<WeakWrapperSharedURLLoaderFactory> shared_factory_;
   DISALLOW_COPY_AND_ASSIGN(TestURLLoaderFactory);
 };
 
-class TestURLLoaderClient : public mojom::URLLoaderClient {
+class TestURLLoaderClient : public network::mojom::URLLoaderClient {
  public:
   TestURLLoaderClient() {}
 
@@ -143,11 +145,11 @@
   }
 
  private:
-  // mojom::URLLoaderClient implementation:
+  // network::mojom::URLLoaderClient implementation:
   void OnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     on_received_response_called_++;
     if (on_received_response_callback_)
       on_received_response_callback_.Run();
@@ -284,7 +286,7 @@
   void CreateLoaderAndStart(bool sync = false) {
     uint32_t options = 0;
     if (sync)
-      options |= mojom::kURLLoadOptionSynchronous;
+      options |= network::mojom::kURLLoadOptionSynchronous;
     network::ResourceRequest request;
     request.url = request_url;
     loader_ = ThrottlingURLLoader::CreateLoaderAndStart(
diff --git a/content/common/url_loader_factory_bundle.cc b/content/common/url_loader_factory_bundle.cc
index a0128c84..af3f4d01 100644
--- a/content/common/url_loader_factory_bundle.cc
+++ b/content/common/url_loader_factory_bundle.cc
@@ -8,7 +8,7 @@
 #include <string>
 
 #include "base/macros.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "url/gurl.h"
 
 class GURL;
@@ -19,8 +19,9 @@
     URLLoaderFactoryBundleInfo&&) = default;
 
 URLLoaderFactoryBundleInfo::URLLoaderFactoryBundleInfo(
-    mojom::URLLoaderFactoryPtrInfo default_factory_info,
-    std::map<std::string, mojom::URLLoaderFactoryPtrInfo> factories_info)
+    network::mojom::URLLoaderFactoryPtrInfo default_factory_info,
+    std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo>
+        factories_info)
     : default_factory_info(std::move(default_factory_info)),
       factories_info(std::move(factories_info)) {}
 
@@ -44,19 +45,19 @@
     URLLoaderFactoryBundle&&) = default;
 
 void URLLoaderFactoryBundle::SetDefaultFactory(
-    mojom::URLLoaderFactoryPtr factory) {
+    network::mojom::URLLoaderFactoryPtr factory) {
   default_factory_ = std::move(factory);
 }
 
 void URLLoaderFactoryBundle::RegisterFactory(
     const base::StringPiece& scheme,
-    mojom::URLLoaderFactoryPtr factory) {
+    network::mojom::URLLoaderFactoryPtr factory) {
   DCHECK(factory.is_bound());
   auto result = factories_.emplace(std::string(scheme), std::move(factory));
   DCHECK(result.second);
 }
 
-mojom::URLLoaderFactory* URLLoaderFactoryBundle::GetFactoryForRequest(
+network::mojom::URLLoaderFactory* URLLoaderFactoryBundle::GetFactoryForRequest(
     const GURL& url) {
   auto it = factories_.find(url.scheme());
   if (it == factories_.end()) {
@@ -67,7 +68,7 @@
 }
 
 URLLoaderFactoryBundleInfo URLLoaderFactoryBundle::PassInfo() {
-  std::map<std::string, mojom::URLLoaderFactoryPtrInfo> factories_info;
+  std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo> factories_info;
   for (auto& factory : factories_)
     factories_info.emplace(factory.first, factory.second.PassInterface());
   DCHECK(default_factory_.is_bound());
@@ -77,13 +78,13 @@
 
 URLLoaderFactoryBundle URLLoaderFactoryBundle::Clone() {
   DCHECK(default_factory_.is_bound());
-  mojom::URLLoaderFactoryPtr cloned_default_factory;
+  network::mojom::URLLoaderFactoryPtr cloned_default_factory;
   default_factory_->Clone(mojo::MakeRequest(&cloned_default_factory));
 
   URLLoaderFactoryBundle new_bundle;
   new_bundle.SetDefaultFactory(std::move(cloned_default_factory));
   for (auto& factory : factories_) {
-    mojom::URLLoaderFactoryPtr cloned_factory;
+    network::mojom::URLLoaderFactoryPtr cloned_factory;
     factory.second->Clone(mojo::MakeRequest(&cloned_factory));
     new_bundle.RegisterFactory(factory.first, std::move(cloned_factory));
   }
diff --git a/content/common/url_loader_factory_bundle.h b/content/common/url_loader_factory_bundle.h
index 0147254..3c18c3c 100644
--- a/content/common/url_loader_factory_bundle.h
+++ b/content/common/url_loader_factory_bundle.h
@@ -10,7 +10,7 @@
 
 #include "base/macros.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 class GURL;
 
@@ -20,7 +20,6 @@
 }
 
 namespace content {
-
 namespace mojom {
 class URLLoaderFactoryBundleDataView;
 }
@@ -30,12 +29,13 @@
 struct CONTENT_EXPORT URLLoaderFactoryBundleInfo {
   URLLoaderFactoryBundleInfo(URLLoaderFactoryBundleInfo&&);
   URLLoaderFactoryBundleInfo(
-      mojom::URLLoaderFactoryPtrInfo default_factory_info,
-      std::map<std::string, mojom::URLLoaderFactoryPtrInfo> factories_info);
+      network::mojom::URLLoaderFactoryPtrInfo default_factory_info,
+      std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo>
+          factories_info);
   ~URLLoaderFactoryBundleInfo();
 
-  mojom::URLLoaderFactoryPtrInfo default_factory_info;
-  std::map<std::string, mojom::URLLoaderFactoryPtrInfo> factories_info;
+  network::mojom::URLLoaderFactoryPtrInfo default_factory_info;
+  std::map<std::string, network::mojom::URLLoaderFactoryPtrInfo> factories_info;
 };
 
 // Encapsulates a collection of URLLoaderFactoryPtrs which can be usd to acquire
@@ -51,16 +51,16 @@
 
   // Sets the default factory to use when no registered factories match a given
   // |url|.
-  void SetDefaultFactory(mojom::URLLoaderFactoryPtr factory);
+  void SetDefaultFactory(network::mojom::URLLoaderFactoryPtr factory);
 
   // Registers a new factory to handle requests matching scheme |scheme|.
   void RegisterFactory(const base::StringPiece& scheme,
-                       mojom::URLLoaderFactoryPtr factory);
+                       network::mojom::URLLoaderFactoryPtr factory);
 
   // Returns a factory which can be used to acquire a loader for |url|. If no
   // registered factory matches |url|'s scheme, the default factory is used. It
   // is undefined behavior to call this when no default factory is set.
-  mojom::URLLoaderFactory* GetFactoryForRequest(const GURL& url);
+  network::mojom::URLLoaderFactory* GetFactoryForRequest(const GURL& url);
 
   // Passes out a structure which captures the internal state of this bundle in
   // a form that is safe to pass across sequences. Effectively resets |this|
@@ -73,11 +73,12 @@
   URLLoaderFactoryBundle Clone();
 
  private:
-  friend struct mojo::StructTraits<mojom::URLLoaderFactoryBundleDataView,
-                                   URLLoaderFactoryBundle>;
+  friend struct mojo::StructTraits<
+      content::mojom::URLLoaderFactoryBundleDataView,
+      URLLoaderFactoryBundle>;
 
-  mojom::URLLoaderFactoryPtr default_factory_;
-  std::map<std::string, mojom::URLLoaderFactoryPtr> factories_;
+  network::mojom::URLLoaderFactoryPtr default_factory_;
+  std::map<std::string, network::mojom::URLLoaderFactoryPtr> factories_;
 
   DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryBundle);
 };
diff --git a/content/common/url_loader_factory_bundle.mojom b/content/common/url_loader_factory_bundle.mojom
index 1f0f9e2b..31d166a5 100644
--- a/content/common/url_loader_factory_bundle.mojom
+++ b/content/common/url_loader_factory_bundle.mojom
@@ -4,13 +4,13 @@
 
 module content.mojom;
 
-import "content/public/common/url_loader_factory.mojom";
+import "services/network/public/interfaces/url_loader_factory.mojom";
 
 // Serializes a collection of URLLoaderFactory interfaces.
 struct URLLoaderFactoryBundle {
   // The default factory to be used when no others apply.
-  URLLoaderFactory default_factory;
+  network.mojom.URLLoaderFactory default_factory;
 
   // A mapping from URL scheme to factory interface.
-  map<string, URLLoaderFactory> factories;
+  map<string, network.mojom.URLLoaderFactory> factories;
 };
diff --git a/content/common/url_loader_factory_bundle_struct_traits.cc b/content/common/url_loader_factory_bundle_struct_traits.cc
index 917d12a..0c84988 100644
--- a/content/common/url_loader_factory_bundle_struct_traits.cc
+++ b/content/common/url_loader_factory_bundle_struct_traits.cc
@@ -10,13 +10,13 @@
                             content::URLLoaderFactoryBundle>;
 
 // static
-content::mojom::URLLoaderFactoryPtr Traits::default_factory(
+network::mojom::URLLoaderFactoryPtr Traits::default_factory(
     content::URLLoaderFactoryBundle& bundle) {
   return std::move(bundle.default_factory_);
 }
 
 // static
-std::map<std::string, content::mojom::URLLoaderFactoryPtr> Traits::factories(
+std::map<std::string, network::mojom::URLLoaderFactoryPtr> Traits::factories(
     content::URLLoaderFactoryBundle& bundle) {
   return std::move(bundle.factories_);
 }
@@ -25,7 +25,7 @@
 bool Traits::Read(content::mojom::URLLoaderFactoryBundleDataView data,
                   content::URLLoaderFactoryBundle* out_bundle) {
   out_bundle->SetDefaultFactory(
-      data.TakeDefaultFactory<content::mojom::URLLoaderFactoryPtr>());
+      data.TakeDefaultFactory<network::mojom::URLLoaderFactoryPtr>());
   if (!data.ReadFactories(&out_bundle->factories_))
     return false;
   return true;
diff --git a/content/common/url_loader_factory_bundle_struct_traits.h b/content/common/url_loader_factory_bundle_struct_traits.h
index f263049..772e637 100644
--- a/content/common/url_loader_factory_bundle_struct_traits.h
+++ b/content/common/url_loader_factory_bundle_struct_traits.h
@@ -14,10 +14,10 @@
 template <>
 struct StructTraits<content::mojom::URLLoaderFactoryBundleDataView,
                     content::URLLoaderFactoryBundle> {
-  static content::mojom::URLLoaderFactoryPtr default_factory(
+  static network::mojom::URLLoaderFactoryPtr default_factory(
       content::URLLoaderFactoryBundle& bundle);
 
-  static std::map<std::string, content::mojom::URLLoaderFactoryPtr> factories(
+  static std::map<std::string, network::mojom::URLLoaderFactoryPtr> factories(
       content::URLLoaderFactoryBundle& bundle);
 
   static bool Read(content::mojom::URLLoaderFactoryBundleDataView data,
diff --git a/content/common/url_request_struct_traits.cc b/content/common/url_request_struct_traits.cc
deleted file mode 100644
index be0a3e4..0000000
--- a/content/common/url_request_struct_traits.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2017 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/common/url_request_struct_traits.h"
-
-#include "base/logging.h"
-
-namespace mojo {
-
-content::mojom::RequestPriority
-EnumTraits<content::mojom::RequestPriority, net::RequestPriority>::ToMojom(
-    net::RequestPriority priority) {
-  switch (priority) {
-    case net::THROTTLED:
-      return content::mojom::RequestPriority::kThrottled;
-    case net::IDLE:
-      return content::mojom::RequestPriority::kIdle;
-    case net::LOWEST:
-      return content::mojom::RequestPriority::kLowest;
-    case net::LOW:
-      return content::mojom::RequestPriority::kLow;
-    case net::MEDIUM:
-      return content::mojom::RequestPriority::kMedium;
-    case net::HIGHEST:
-      return content::mojom::RequestPriority::kHighest;
-  }
-  NOTREACHED();
-  return static_cast<content::mojom::RequestPriority>(priority);
-}
-
-bool EnumTraits<content::mojom::RequestPriority, net::RequestPriority>::
-    FromMojom(content::mojom::RequestPriority in, net::RequestPriority* out) {
-  switch (in) {
-    case content::mojom::RequestPriority::kThrottled:
-      *out = net::THROTTLED;
-      return true;
-    case content::mojom::RequestPriority::kIdle:
-      *out = net::IDLE;
-      return true;
-    case content::mojom::RequestPriority::kLowest:
-      *out = net::LOWEST;
-      return true;
-    case content::mojom::RequestPriority::kLow:
-      *out = net::LOW;
-      return true;
-    case content::mojom::RequestPriority::kMedium:
-      *out = net::MEDIUM;
-      return true;
-    case content::mojom::RequestPriority::kHighest:
-      *out = net::HIGHEST;
-      return true;
-  }
-
-  NOTREACHED();
-  *out = static_cast<net::RequestPriority>(in);
-  return true;
-}
-
-}  // namespace mojo
diff --git a/content/common/url_request_struct_traits.h b/content/common/url_request_struct_traits.h
deleted file mode 100644
index 0326632..0000000
--- a/content/common/url_request_struct_traits.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2017 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_COMMON_URL_REQUEST_STRUCT_TRAITS_H_
-#define CONTENT_COMMON_URL_REQUEST_STRUCT_TRAITS_H_
-
-#include "content/public/common/url_loader.mojom.h"
-#include "mojo/public/cpp/bindings/enum_traits.h"
-#include "net/base/request_priority.h"
-
-namespace mojo {
-
-template <>
-struct EnumTraits<content::mojom::RequestPriority, net::RequestPriority> {
-  static content::mojom::RequestPriority ToMojom(net::RequestPriority priority);
-  static bool FromMojom(content::mojom::RequestPriority in,
-                        net::RequestPriority* out);
-};
-
-}  // namespace mojo
-
-#endif  // CONTENT_COMMON_URL_REQUEST_STRUCT_TRAITS_H_
diff --git a/content/common/weak_wrapper_shared_url_loader_factory.cc b/content/common/weak_wrapper_shared_url_loader_factory.cc
index 18385088..23ff324 100644
--- a/content/common/weak_wrapper_shared_url_loader_factory.cc
+++ b/content/common/weak_wrapper_shared_url_loader_factory.cc
@@ -10,7 +10,7 @@
 namespace content {
 
 WeakWrapperSharedURLLoaderFactory::WeakWrapperSharedURLLoaderFactory(
-    mojom::URLLoaderFactory* factory_ptr)
+    network::mojom::URLLoaderFactory* factory_ptr)
     : factory_ptr_(factory_ptr) {}
 
 void WeakWrapperSharedURLLoaderFactory::Detach() {
@@ -18,12 +18,12 @@
 }
 
 void WeakWrapperSharedURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderRequest loader,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
     const Constraints& constraints) {
   if (!factory_ptr_)
@@ -35,7 +35,7 @@
 
 std::unique_ptr<SharedURLLoaderFactoryInfo>
 WeakWrapperSharedURLLoaderFactory::Clone() {
-  mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
+  network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
   if (factory_ptr_)
     factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info));
   return std::make_unique<WrapperSharedURLLoaderFactoryInfo>(
diff --git a/content/common/weak_wrapper_shared_url_loader_factory.h b/content/common/weak_wrapper_shared_url_loader_factory.h
index 21e0ba83..f8f2f98 100644
--- a/content/common/weak_wrapper_shared_url_loader_factory.h
+++ b/content/common/weak_wrapper_shared_url_loader_factory.h
@@ -7,7 +7,7 @@
 
 #include "content/common/content_export.h"
 #include "content/public/common/shared_url_loader_factory.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -17,7 +17,7 @@
     : public SharedURLLoaderFactory {
  public:
   explicit WeakWrapperSharedURLLoaderFactory(
-      mojom::URLLoaderFactory* factory_ptr);
+      network::mojom::URLLoaderFactory* factory_ptr);
 
   // Detaches from the raw mojom::URLLoaderFactory pointer. All subsequent calls
   // to CreateLoaderAndStart() will fail silently.
@@ -25,12 +25,12 @@
 
   // SharedURLLoaderFactory implementation.
   void CreateLoaderAndStart(
-      mojom::URLLoaderRequest loader,
+      network::mojom::URLLoaderRequest loader,
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
       const Constraints& constraints) override;
 
@@ -40,7 +40,7 @@
   ~WeakWrapperSharedURLLoaderFactory() override;
 
   // Not owned.
-  mojom::URLLoaderFactory* factory_ptr_ = nullptr;
+  network::mojom::URLLoaderFactory* factory_ptr_ = nullptr;
 };
 
 }  // namespace content
diff --git a/content/common/wrapper_shared_url_loader_factory.cc b/content/common/wrapper_shared_url_loader_factory.cc
index 76df984..35531e5 100644
--- a/content/common/wrapper_shared_url_loader_factory.cc
+++ b/content/common/wrapper_shared_url_loader_factory.cc
@@ -12,7 +12,7 @@
     default;
 
 WrapperSharedURLLoaderFactoryInfo::WrapperSharedURLLoaderFactoryInfo(
-    mojom::URLLoaderFactoryPtrInfo factory_ptr_info)
+    network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info)
     : factory_ptr_info_(std::move(factory_ptr_info)) {}
 
 WrapperSharedURLLoaderFactoryInfo::~WrapperSharedURLLoaderFactoryInfo() =
@@ -25,20 +25,20 @@
 }
 
 WrapperSharedURLLoaderFactory::WrapperSharedURLLoaderFactory(
-    mojom::URLLoaderFactoryPtr factory_ptr)
+    network::mojom::URLLoaderFactoryPtr factory_ptr)
     : factory_ptr_(std::move(factory_ptr)) {}
 
 WrapperSharedURLLoaderFactory::WrapperSharedURLLoaderFactory(
-    mojom::URLLoaderFactoryPtrInfo factory_ptr_info)
+    network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info)
     : factory_ptr_(std::move(factory_ptr_info)) {}
 
 void WrapperSharedURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderRequest loader,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
     const Constraints& constraints) {
   if (!factory_ptr_)
@@ -50,7 +50,7 @@
 
 std::unique_ptr<SharedURLLoaderFactoryInfo>
 WrapperSharedURLLoaderFactory::Clone() {
-  mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
+  network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info;
   if (factory_ptr_)
     factory_ptr_->Clone(mojo::MakeRequest(&factory_ptr_info));
   return std::make_unique<WrapperSharedURLLoaderFactoryInfo>(
diff --git a/content/common/wrapper_shared_url_loader_factory.h b/content/common/wrapper_shared_url_loader_factory.h
index fbd9c3e..485b941 100644
--- a/content/common/wrapper_shared_url_loader_factory.h
+++ b/content/common/wrapper_shared_url_loader_factory.h
@@ -7,7 +7,7 @@
 
 #include "content/common/content_export.h"
 #include "content/public/common/shared_url_loader_factory.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -18,7 +18,7 @@
  public:
   WrapperSharedURLLoaderFactoryInfo();
   explicit WrapperSharedURLLoaderFactoryInfo(
-      mojom::URLLoaderFactoryPtrInfo factory_ptr_info);
+      network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info);
 
   ~WrapperSharedURLLoaderFactoryInfo() override;
 
@@ -26,7 +26,7 @@
   // SharedURLLoaderFactoryInfo implementation.
   scoped_refptr<SharedURLLoaderFactory> CreateFactory() override;
 
-  mojom::URLLoaderFactoryPtrInfo factory_ptr_info_;
+  network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info_;
 };
 
 // A SharedURLLoaderFactory implementation that wraps a
@@ -35,18 +35,18 @@
     : public SharedURLLoaderFactory {
  public:
   explicit WrapperSharedURLLoaderFactory(
-      mojom::URLLoaderFactoryPtr factory_ptr);
+      network::mojom::URLLoaderFactoryPtr factory_ptr);
   explicit WrapperSharedURLLoaderFactory(
-      mojom::URLLoaderFactoryPtrInfo factory_ptr_info);
+      network::mojom::URLLoaderFactoryPtrInfo factory_ptr_info);
 
   // SharedURLLoaderFactory implementation.
   void CreateLoaderAndStart(
-      mojom::URLLoaderRequest loader,
+      network::mojom::URLLoaderRequest loader,
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
       const Constraints& constraints) override;
 
@@ -55,7 +55,7 @@
  private:
   ~WrapperSharedURLLoaderFactory() override;
 
-  mojom::URLLoaderFactoryPtr factory_ptr_;
+  network::mojom::URLLoaderFactoryPtr factory_ptr_;
 };
 
 }  // namespace content
diff --git a/content/network/DEPS b/content/network/DEPS
index ade8a7cc..222cc03 100644
--- a/content/network/DEPS
+++ b/content/network/DEPS
@@ -15,8 +15,6 @@
   "+content/public/common/content_switches.h",
   "+content/public/common/network_service.mojom.h",
   "+content/public/common/url_constants.h",
-  "+content/public/common/url_loader.mojom.h",
-  "+content/public/common/url_loader_factory.mojom.h",
   "+content/public/network",
   "+services/network",
   "+services/service_manager/public",
diff --git a/content/network/cache_url_loader.cc b/content/network/cache_url_loader.cc
index 96794199..f144b03 100644
--- a/content/network/cache_url_loader.cc
+++ b/content/network/cache_url_loader.cc
@@ -20,7 +20,7 @@
  public:
   CacheURLLoader(const GURL& url,
                  net::URLRequestContext* request_context,
-                 mojom::URLLoaderClientPtr client)
+                 network::mojom::URLLoaderClientPtr client)
       : client_(std::move(client)) {
     scoped_refptr<net::HttpResponseHeaders> headers(
         new net::HttpResponseHeaders("HTTP/1.1 200 OK"));
@@ -71,7 +71,7 @@
   }
 
   std::string data_;
-  mojom::URLLoaderClientPtr client_;
+  network::mojom::URLLoaderClientPtr client_;
   net::ViewCacheHelper cache_helper_;
 
   DISALLOW_COPY_AND_ASSIGN(CacheURLLoader);
@@ -80,7 +80,7 @@
 
 void StartCacheURLLoader(const GURL& url,
                          net::URLRequestContext* request_context,
-                         mojom::URLLoaderClientPtr client) {
+                         network::mojom::URLLoaderClientPtr client) {
   new CacheURLLoader(url, request_context, std::move(client));
 }
 
diff --git a/content/network/cache_url_loader.h b/content/network/cache_url_loader.h
index 28d9d4b..9d65de284 100644
--- a/content/network/cache_url_loader.h
+++ b/content/network/cache_url_loader.h
@@ -5,7 +5,7 @@
 #ifndef CONTENT_NETWORK_CACHE_URL_LOADER_H_
 #define CONTENT_NETWORK_CACHE_URL_LOADER_H_
 
-#include "content/public/common/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace net {
 class URLRequestContext;
@@ -16,7 +16,7 @@
 // Creates a URLLoader that responds to developer requests to view the cache.
 void StartCacheURLLoader(const GURL& url,
                          net::URLRequestContext* request_context,
-                         mojom::URLLoaderClientPtr client);
+                         network::mojom::URLLoaderClientPtr client);
 
 }  // namespace content
 
diff --git a/content/network/manifest.json b/content/network/manifest.json
index 5f1f505..c9323b1 100644
--- a/content/network/manifest.json
+++ b/content/network/manifest.json
@@ -12,7 +12,7 @@
           "content::mojom::NetworkServiceTest"
         ],
         "url_loader": [
-          "content::mojom::URLLoaderFactory"
+          "network::mojom::URLLoaderFactory"
         ]
       },
       "requires": {
diff --git a/content/network/network_context.cc b/content/network/network_context.cc
index fcdaee33..c81f18a 100644
--- a/content/network/network_context.cc
+++ b/content/network/network_context.cc
@@ -164,15 +164,16 @@
 }
 
 void NetworkContext::CreateURLLoaderFactory(
-    mojom::URLLoaderFactoryRequest request,
+    network::mojom::URLLoaderFactoryRequest request,
     uint32_t process_id) {
   loader_factory_bindings_.AddBinding(
       std::make_unique<NetworkServiceURLLoaderFactory>(this, process_id),
       std::move(request));
 }
 
-void NetworkContext::HandleViewCacheRequest(const GURL& url,
-                                            mojom::URLLoaderClientPtr client) {
+void NetworkContext::HandleViewCacheRequest(
+    const GURL& url,
+    network::mojom::URLLoaderClientPtr client) {
   StartCacheURLLoader(url, url_request_context_, std::move(client));
 }
 
diff --git a/content/network/network_context.h b/content/network/network_context.h
index 2487765..42064836 100644
--- a/content/network/network_context.h
+++ b/content/network/network_context.h
@@ -15,11 +15,11 @@
 #include "base/time/time.h"
 #include "content/common/content_export.h"
 #include "content/public/common/network_service.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/network/url_request_context_owner.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/strong_binding_set.h"
 #include "services/network/cookie_manager.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace net {
 class CertVerifier;
@@ -82,10 +82,11 @@
   void DeregisterURLLoader(URLLoader* url_loader);
 
   // mojom::NetworkContext implementation:
-  void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
+  void CreateURLLoaderFactory(network::mojom::URLLoaderFactoryRequest request,
                               uint32_t process_id) override;
-  void HandleViewCacheRequest(const GURL& url,
-                              mojom::URLLoaderClientPtr client) override;
+  void HandleViewCacheRequest(
+      const GURL& url,
+      network::mojom::URLLoaderClientPtr client) override;
   void GetCookieManager(network::mojom::CookieManagerRequest request) override;
   void GetRestrictedCookieManager(
       network::mojom::RestrictedCookieManagerRequest request,
@@ -138,7 +139,8 @@
 
   // Put it below |url_request_context_| so that it outlives all the
   // NetworkServiceURLLoaderFactory instances.
-  mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
+  mojo::StrongBindingSet<network::mojom::URLLoaderFactory>
+      loader_factory_bindings_;
 
   // URLLoaders register themselves with the NetworkContext so that they can
   // be cleaned up when the NetworkContext goes away. This is needed as
diff --git a/content/network/network_service_unittest.cc b/content/network/network_service_unittest.cc
index 41d3422f..2a5c2bec 100644
--- a/content/network/network_service_unittest.cc
+++ b/content/network/network_service_unittest.cc
@@ -144,19 +144,19 @@
   void StartLoadingURL(const network::ResourceRequest& request,
                        uint32_t process_id) {
     client_.reset(new TestURLLoaderClient());
-    mojom::URLLoaderFactoryPtr loader_factory;
+    network::mojom::URLLoaderFactoryPtr loader_factory;
     network_context_->CreateURLLoaderFactory(mojo::MakeRequest(&loader_factory),
                                              process_id);
 
     loader_factory->CreateLoaderAndStart(
-        mojo::MakeRequest(&loader_), 1, 1, mojom::kURLLoadOptionNone, request,
-        client_->CreateInterfacePtr(),
+        mojo::MakeRequest(&loader_), 1, 1, network::mojom::kURLLoadOptionNone,
+        request, client_->CreateInterfacePtr(),
         net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
   }
 
   net::EmbeddedTestServer* test_server() { return &test_server_; }
   TestURLLoaderClient* client() { return client_.get(); }
-  mojom::URLLoader* loader() { return loader_.get(); }
+  network::mojom::URLLoader* loader() { return loader_.get(); }
   mojom::NetworkService* service() { return network_service_.get(); }
   mojom::NetworkContext* context() { return network_context_.get(); }
 
@@ -181,7 +181,7 @@
   std::unique_ptr<TestURLLoaderClient> client_;
   mojom::NetworkServicePtr network_service_;
   mojom::NetworkContextPtr network_context_;
-  mojom::URLLoaderPtr loader_;
+  network::mojom::URLLoaderPtr loader_;
 
   DISALLOW_COPY_AND_ASSIGN(NetworkServiceTestWithService);
 };
diff --git a/content/network/network_service_url_loader_factory.cc b/content/network/network_service_url_loader_factory.cc
index d428a16..2cfb4472 100644
--- a/content/network/network_service_url_loader_factory.cc
+++ b/content/network/network_service_url_loader_factory.cc
@@ -22,12 +22,12 @@
 NetworkServiceURLLoaderFactory::~NetworkServiceURLLoaderFactory() = default;
 
 void NetworkServiceURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& url_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   bool report_raw_headers = false;
   if (url_request.report_raw_headers) {
@@ -44,7 +44,7 @@
 }
 
 void NetworkServiceURLLoaderFactory::Clone(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   context_->CreateURLLoaderFactory(std::move(request), process_id_);
 }
 
diff --git a/content/network/network_service_url_loader_factory.h b/content/network/network_service_url_loader_factory.h
index 92df5d8d..f6c71660 100644
--- a/content/network/network_service_url_loader_factory.h
+++ b/content/network/network_service_url_loader_factory.h
@@ -6,32 +6,32 @@
 #define CONTENT_NETWORK_NETWORK_SERVICE_URL_LOADER_FACTORY_H_
 
 #include "base/macros.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
 class NetworkContext;
 
-// This class is an implementation of mojom::URLLoaderFactory that creates
-// a mojom::URLLoader.
-class NetworkServiceURLLoaderFactory : public mojom::URLLoaderFactory {
+// This class is an implementation of network::mojom::URLLoaderFactory that
+// creates a network::mojom::URLLoader.
+class NetworkServiceURLLoaderFactory : public network::mojom::URLLoaderFactory {
  public:
   // NOTE: |context| must outlive this instance.
   NetworkServiceURLLoaderFactory(NetworkContext* context, uint32_t process_id);
 
   ~NetworkServiceURLLoaderFactory() override;
 
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
  private:
   // Not owned.
diff --git a/content/network/url_loader.cc b/content/network/url_loader.cc
index b825e629..752304c 100644
--- a/content/network/url_loader.cc
+++ b/content/network/url_loader.cc
@@ -16,7 +16,6 @@
 #include "content/network/data_pipe_element_reader.h"
 #include "content/network/network_context.h"
 #include "content/network/network_service_impl.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/system/simple_watcher.h"
 #include "net/base/elements_upload_data_stream.h"
 #include "net/base/mime_sniffer.h"
@@ -27,6 +26,7 @@
 #include "services/network/public/cpp/net_adapters.h"
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -190,11 +190,11 @@
 }  // namespace
 
 URLLoader::URLLoader(NetworkContext* context,
-                     mojom::URLLoaderRequest url_loader_request,
+                     network::mojom::URLLoaderRequest url_loader_request,
                      int32_t options,
                      const network::ResourceRequest& request,
                      bool report_raw_headers,
-                     mojom::URLLoaderClientPtr url_loader_client,
+                     network::mojom::URLLoaderClientPtr url_loader_client,
                      const net::NetworkTrafficAnnotationTag& traffic_annotation,
                      uint32_t process_id)
     : context_(context),
@@ -426,7 +426,7 @@
       base::Bind(&URLLoader::OnResponseBodyStreamReady,
                  base::Unretained(this)));
 
-  if (!(options_ & mojom::kURLLoadOptionSniffMimeType) ||
+  if (!(options_ & network::mojom::kURLLoadOptionSniffMimeType) ||
       !ShouldSniffContent(url_request_.get(), response_.get()))
     SendResponseToClient();
 
@@ -563,7 +563,8 @@
   status.encoded_body_length = url_request_->GetRawBodyBytes();
   status.decoded_body_length = total_written_bytes_;
 
-  if ((options_ & mojom::kURLLoadOptionSendSSLInfoForCertificateError) &&
+  if ((options_ &
+       network::mojom::kURLLoadOptionSendSSLInfoForCertificateError) &&
       net::IsCertStatusError(url_request_->ssl_info().cert_status) &&
       !net::IsCertStatusMinorError(url_request_->ssl_info().cert_status)) {
     status.ssl_info = url_request_->ssl_info();
@@ -617,9 +618,9 @@
 
 void URLLoader::SendResponseToClient() {
   base::Optional<net::SSLInfo> ssl_info;
-  if (options_ & mojom::kURLLoadOptionSendSSLInfoWithResponse)
+  if (options_ & network::mojom::kURLLoadOptionSendSSLInfoWithResponse)
     ssl_info = url_request_->ssl_info();
-  mojom::DownloadedTempFilePtr downloaded_file_ptr;
+  network::mojom::DownloadedTempFilePtr downloaded_file_ptr;
   url_loader_client_->OnReceiveResponse(response_->head, ssl_info,
                                         std::move(downloaded_file_ptr));
 
diff --git a/content/network/url_loader.h b/content/network/url_loader.h
index 7a202fa..cab5508 100644
--- a/content/network/url_loader.h
+++ b/content/network/url_loader.h
@@ -12,13 +12,13 @@
 #include "base/memory/weak_ptr.h"
 #include "content/common/content_export.h"
 #include "content/network/upload_progress_tracker.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "mojo/public/cpp/system/simple_watcher.h"
 #include "net/http/http_raw_request_headers.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "net/url_request/url_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace net {
 class HttpResponseHeaders;
@@ -33,15 +33,15 @@
 
 class NetworkContext;
 
-class CONTENT_EXPORT URLLoader : public mojom::URLLoader,
+class CONTENT_EXPORT URLLoader : public network::mojom::URLLoader,
                                  public net::URLRequest::Delegate {
  public:
   URLLoader(NetworkContext* context,
-            mojom::URLLoaderRequest url_loader_request,
+            network::mojom::URLLoaderRequest url_loader_request,
             int32_t options,
             const network::ResourceRequest& request,
             bool report_raw_headers,
-            mojom::URLLoaderClientPtr url_loader_client,
+            network::mojom::URLLoaderClientPtr url_loader_client,
             const net::NetworkTrafficAnnotationTag& traffic_annotation,
             uint32_t process_id);
   ~URLLoader() override;
@@ -49,7 +49,7 @@
   // Called when the associated NetworkContext is going away.
   void Cleanup();
 
-  // mojom::URLLoader implementation:
+  // network::mojom::URLLoader implementation:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -100,8 +100,8 @@
   uint32_t render_frame_id_;
   bool connected_;
   std::unique_ptr<net::URLRequest> url_request_;
-  mojo::Binding<mojom::URLLoader> binding_;
-  mojom::URLLoaderClientPtr url_loader_client_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
+  network::mojom::URLLoaderClientPtr url_loader_client_;
   int64_t total_written_bytes_ = 0;
 
   mojo::ScopedDataPipeProducerHandle response_body_stream_;
diff --git a/content/network/url_loader_unittest.cc b/content/network/url_loader_unittest.cc
index 0b47b36..930871b7 100644
--- a/content/network/url_loader_unittest.cc
+++ b/content/network/url_loader_unittest.cc
@@ -205,17 +205,17 @@
   // block on trying to write the body buffer.
   int Load(const GURL& url, std::string* body = nullptr) WARN_UNUSED_RESULT {
     DCHECK(!ran_);
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
 
     network::ResourceRequest request =
         CreateResourceRequest(!request_body_ ? "GET" : "POST", url);
-    uint32_t options = mojom::kURLLoadOptionNone;
+    uint32_t options = network::mojom::kURLLoadOptionNone;
     if (send_ssl_with_response_)
-      options |= mojom::kURLLoadOptionSendSSLInfoWithResponse;
+      options |= network::mojom::kURLLoadOptionSendSSLInfoWithResponse;
     if (sniff_)
-      options |= mojom::kURLLoadOptionSniffMimeType;
+      options |= network::mojom::kURLLoadOptionSniffMimeType;
     if (send_ssl_for_cert_error_)
-      options |= mojom::kURLLoadOptionSendSSLInfoForCertificateError;
+      options |= network::mojom::kURLLoadOptionSendSSLInfoForCertificateError;
 
     if (request_body_)
       request.request_body = request_body_;
@@ -562,7 +562,7 @@
   GURL url = test_server()->GetURL("/hung-after-headers");
   network::ResourceRequest request = CreateResourceRequest("GET", url);
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   // The loader is implicitly owned by the client and the NetworkContext, so
   // don't hold on to a pointer to it.
   base::WeakPtr<URLLoader> loader_impl =
@@ -721,7 +721,7 @@
   network::ResourceRequest request =
       CreateResourceRequest("GET", server.GetURL("/hello.html"));
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   // The loader is implicitly owned by the client and the NetworkContext.
   new URLLoader(context(), mojo::MakeRequest(&loader), 0, request, false,
                 client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS,
@@ -762,7 +762,7 @@
   network::ResourceRequest request =
       CreateResourceRequest("GET", server.GetURL(kPath));
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   // The loader is implicitly owned by the client and the NetworkContext.
   new URLLoader(context(), mojo::MakeRequest(&loader), 0, request, false,
                 client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS,
@@ -819,7 +819,7 @@
   network::ResourceRequest request =
       CreateResourceRequest("GET", server.GetURL(kPath));
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   // The loader is implicitly owned by the client and the NetworkContext.
   new URLLoader(context(), mojo::MakeRequest(&loader), 0, request, false,
                 client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS,
@@ -865,7 +865,7 @@
   network::ResourceRequest request =
       CreateResourceRequest("GET", server.GetURL(kPath));
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   // The loader is implicitly owned by the client and the NetworkContext.
   new URLLoader(context(), mojo::MakeRequest(&loader), 0, request, false,
                 client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS,
@@ -905,7 +905,7 @@
   network::ResourceRequest request =
       CreateResourceRequest("GET", server.GetURL(kPath));
 
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   // The loader is implicitly owned by the client and the NetworkContext.
   new URLLoader(context(), mojo::MakeRequest(&loader), 0, request, false,
                 client()->CreateInterfacePtr(), TRAFFIC_ANNOTATION_FOR_TESTS,
diff --git a/content/public/app/content_main.h b/content/public/app/content_main.h
index 3ae55883..230001c 100644
--- a/content/public/app/content_main.h
+++ b/content/public/app/content_main.h
@@ -30,8 +30,12 @@
 }
 
 namespace content {
+
+class BrowserMainParts;
 class ContentMainDelegate;
 
+using CreatedMainPartsClosure = base::Callback<void(BrowserMainParts*)>;
+
 struct ContentMainParams {
   explicit ContentMainParams(ContentMainDelegate* delegate)
       : delegate(delegate) {}
@@ -53,6 +57,10 @@
   // on the MessageLoop. It's owned by the test code.
   base::Closure* ui_task = nullptr;
 
+  // Used by InProcessBrowserTest. If non-null this is Run() after
+  // BrowserMainParts has been created and before PreEarlyInitialization().
+  CreatedMainPartsClosure* created_main_parts_closure = nullptr;
+
 #if defined(USE_AURA)
   aura::Env::Mode env_mode = aura::Env::Mode::LOCAL;
 #endif
diff --git a/content/public/app/mojo/content_browser_manifest.json b/content/public/app/mojo/content_browser_manifest.json
index 3961447..24c1e00 100644
--- a/content/public/app/mojo/content_browser_manifest.json
+++ b/content/public/app/mojo/content_browser_manifest.json
@@ -49,7 +49,6 @@
           "content::mojom::ReportingServiceProxy",
           "content::mojom::ServiceWorkerDispatcherHost",
           "content::mojom::StoragePartitionService",
-          "content::mojom::URLLoaderFactory",
           "content::mojom::VideoCaptureHost",
           "content::mojom::WorkerURLLoaderFactoryProvider",
           "device::mojom::BatteryMonitor",
@@ -60,6 +59,7 @@
           "media::mojom::VideoDecodePerfHistory",
           "memory_coordinator::mojom::MemoryCoordinatorHandle",
           "metrics::mojom::SingleSampleMetricsProvider",
+          "network::mojom::URLLoaderFactory",
           "resource_coordinator::mojom::ProcessCoordinationUnit",
           "ui::mojom::Gpu",
           "viz::mojom::SharedBitmapAllocationNotifier",
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 6bfa864..3cb34e7 100644
--- a/content/public/browser/content_browser_client.cc
+++ b/content/public/browser/content_browser_client.cc
@@ -632,7 +632,7 @@
 bool ContentBrowserClient::ShowPaymentHandlerWindow(
     content::BrowserContext* browser_context,
     const GURL& url,
-    base::OnceCallback<void(bool)> callback) {
+    base::OnceCallback<void(bool, int, int)> callback) {
   return false;
 }
 
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index 0454b4aa..c3c6502 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -942,7 +942,7 @@
   // to handle navigation URL requests for schemes not handled by the Network
   // Service. Only called when the Network Service is enabled.
   using NonNetworkURLLoaderFactoryMap =
-      std::map<std::string, std::unique_ptr<mojom::URLLoaderFactory>>;
+      std::map<std::string, std::unique_ptr<network::mojom::URLLoaderFactory>>;
   virtual void RegisterNonNetworkNavigationURLLoaderFactories(
       RenderFrameHost* frame_host,
       NonNetworkURLLoaderFactoryMap* factories);
@@ -1012,11 +1012,14 @@
   // PaymentRequest UI surface. Returns true if the ContentBrowserClient
   // implementation supports this operation (desktop Chrome) or false otherwise.
   // |callback| is invoked with true if the window opened successfully, false if
-  // the attempt failed.
+  // the attempt failed. Both the render process and frame IDs are also passed
+  // to |callback|.
   virtual bool ShowPaymentHandlerWindow(
       content::BrowserContext* browser_context,
       const GURL& url,
-      base::OnceCallback<void(bool)> callback);
+      base::OnceCallback<void(bool /* success */,
+                              int /* render_process_id */,
+                              int /* render_frame_id */)> callback);
 
   // Returns whether a base::TaskScheduler should be created when
   // BrowserMainLoop starts.
diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h
index 63fcacb..fbd510d4 100644
--- a/content/public/browser/download_manager.h
+++ b/content/public/browser/download_manager.h
@@ -40,7 +40,6 @@
 #include "content/public/browser/download_item.h"
 #include "content/public/browser/download_url_parameters.h"
 #include "content/public/common/download_stream.mojom.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "net/base/net_errors.h"
 
 class GURL;
diff --git a/content/public/browser/file_url_loader.h b/content/public/browser/file_url_loader.h
index 9b12645..801e7a93 100644
--- a/content/public/browser/file_url_loader.h
+++ b/content/public/browser/file_url_loader.h
@@ -8,8 +8,8 @@
 #include <memory>
 
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/system/file_data_pipe_producer.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
@@ -43,8 +43,8 @@
 // A directory path will always yield a FILE_NOT_FOUND network error.
 CONTENT_EXPORT void CreateFileURLLoader(
     const network::ResourceRequest& request,
-    mojom::URLLoaderRequest loader,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderClientPtr client,
     std::unique_ptr<FileURLLoaderObserver> observer);
 
 }  // namespace content
diff --git a/content/public/browser/ssl_status.cc b/content/public/browser/ssl_status.cc
index 132844a..a3a5838 100644
--- a/content/public/browser/ssl_status.cc
+++ b/content/public/browser/ssl_status.cc
@@ -16,7 +16,9 @@
       key_exchange_group(0),
       connection_status(0),
       content_status(NORMAL_CONTENT),
-      pkp_bypassed(false) {}
+      pkp_bypassed(false),
+      ct_policy_compliance(net::ct::CTPolicyCompliance::
+                               CT_POLICY_COMPLIANCE_DETAILS_NOT_AVAILABLE) {}
 
 SSLStatus::SSLStatus(const net::SSLInfo& ssl_info)
     : initialized(true),
@@ -27,7 +29,8 @@
       key_exchange_group(ssl_info.key_exchange_group),
       connection_status(ssl_info.connection_status),
       content_status(NORMAL_CONTENT),
-      pkp_bypassed(ssl_info.pkp_bypassed) {}
+      pkp_bypassed(ssl_info.pkp_bypassed),
+      ct_policy_compliance(ssl_info.ct_policy_compliance) {}
 
 SSLStatus::SSLStatus(const SSLStatus& other)
     : initialized(other.initialized),
@@ -39,6 +42,7 @@
       connection_status(other.connection_status),
       content_status(other.content_status),
       pkp_bypassed(other.pkp_bypassed),
+      ct_policy_compliance(other.ct_policy_compliance),
       user_data(other.user_data ? other.user_data->Clone() : nullptr) {}
 
 SSLStatus& SSLStatus::operator=(SSLStatus other) {
@@ -51,6 +55,7 @@
   connection_status = other.connection_status;
   content_status = other.content_status;
   pkp_bypassed = other.pkp_bypassed;
+  ct_policy_compliance = other.ct_policy_compliance;
   user_data = other.user_data ? other.user_data->Clone() : nullptr;
   return *this;
 }
diff --git a/content/public/browser/ssl_status.h b/content/public/browser/ssl_status.h
index 3e6ae04..d3dc5b8e 100644
--- a/content/public/browser/ssl_status.h
+++ b/content/public/browser/ssl_status.h
@@ -12,6 +12,7 @@
 
 #include "content/common/content_export.h"
 #include "net/cert/cert_status_flags.h"
+#include "net/cert/ct_policy_status.h"
 #include "net/cert/sct_status_flags.h"
 #include "net/cert/x509_certificate.h"
 
@@ -81,6 +82,9 @@
   int content_status;
   // True if PKP was bypassed due to a local trust anchor.
   bool pkp_bypassed;
+  // Whether the page's main resource complied with the Certificate Transparency
+  // policy.
+  net::ct::CTPolicyCompliance ct_policy_compliance;
   // Embedder-specific data attached to the SSLStatus is cloned when an
   // |SSLStatus| is assigned or copy-constructed, and is cleared when a
   // navigation commits.
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h
index d481b30..9698d33c 100644
--- a/content/public/browser/storage_partition.h
+++ b/content/public/browser/storage_partition.h
@@ -32,6 +32,7 @@
 namespace network {
 namespace mojom {
 class CookieManager;
+class URLLoaderFactory;
 }
 }  // namespace network
 
@@ -63,7 +64,6 @@
 
 namespace mojom {
 class NetworkContext;
-class URLLoaderFactory;
 }
 
 // Defines what persistent state a child process can access.
@@ -82,7 +82,8 @@
   // storage partition.  Prefer to use this instead of creating a new
   // URLLoaderFactory when issuing requests from the Browser process, to
   // share resources and preserve ordering.
-  virtual mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() = 0;
+  virtual network::mojom::URLLoaderFactory*
+  GetURLLoaderFactoryForBrowserProcess() = 0;
   virtual network::mojom::CookieManager*
   GetCookieManagerForBrowserProcess() = 0;
   virtual storage::QuotaManager* GetQuotaManager() = 0;
diff --git a/content/public/common/BUILD.gn b/content/public/common/BUILD.gn
index a8082a70..84d3212 100644
--- a/content/public/common/BUILD.gn
+++ b/content/public/common/BUILD.gn
@@ -372,8 +372,6 @@
     "network_service.mojom",
     "network_service_test.mojom",
     "push_messaging_status.mojom",
-    "url_loader.mojom",
-    "url_loader_factory.mojom",
     "webplugininfo.mojom",
     "window_container_type.mojom",
   ]
diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc
index 345852f..d4862b7c 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -16,46 +16,6 @@
 
 namespace IPC {
 
-void ParamTraits<url::Origin>::Write(base::Pickle* m, const url::Origin& p) {
-  WriteParam(m, p.unique());
-  WriteParam(m, p.scheme());
-  WriteParam(m, p.host());
-  WriteParam(m, p.port());
-  WriteParam(m, p.suborigin());
-}
-
-bool ParamTraits<url::Origin>::Read(const base::Pickle* m,
-                                    base::PickleIterator* iter,
-                                    url::Origin* p) {
-  bool unique;
-  std::string scheme;
-  std::string host;
-  uint16_t port;
-  std::string suborigin;
-  if (!ReadParam(m, iter, &unique) || !ReadParam(m, iter, &scheme) ||
-      !ReadParam(m, iter, &host) || !ReadParam(m, iter, &port) ||
-      !ReadParam(m, iter, &suborigin)) {
-    *p = url::Origin();
-    return false;
-  }
-
-  *p = unique ? url::Origin()
-              : url::Origin::UnsafelyCreateOriginWithoutNormalization(
-                    scheme, host, port, suborigin);
-
-  // If a unique origin was created, but the unique flag wasn't set, then
-  // the values provided to 'UnsafelyCreateOriginWithoutNormalization' were
-  // invalid; kill the renderer.
-  if (!unique && p->unique())
-    return false;
-
-  return true;
-}
-
-void ParamTraits<url::Origin>::Log(const url::Origin& p, std::string* l) {
-  l->append(p.Serialize());
-}
-
 void ParamTraits<net::IPEndPoint>::Write(base::Pickle* m, const param_type& p) {
   WriteParam(m, p.address());
   WriteParam(m, p.port());
diff --git a/content/public/common/common_param_traits.h b/content/public/common/common_param_traits.h
index 52a901e..89e5037 100644
--- a/content/public/common/common_param_traits.h
+++ b/content/public/common/common_param_traits.h
@@ -26,7 +26,6 @@
 #include "ui/gfx/native_widget_types.h"
 #include "ui/surface/transport_dib.h"
 #include "url/ipc/url_param_traits.h"
-#include "url/origin.h"
 
 #if defined(OS_WIN)
 #include "base/win/win_util.h"
@@ -44,16 +43,6 @@
 namespace IPC {
 
 template <>
-struct CONTENT_EXPORT ParamTraits<url::Origin> {
-  typedef url::Origin param_type;
-  static void Write(base::Pickle* m, const param_type& p);
-  static bool Read(const base::Pickle* m,
-                   base::PickleIterator* iter,
-                   param_type* p);
-  static void Log(const param_type& p, std::string* l);
-};
-
-template <>
 struct CONTENT_EXPORT ParamTraits<net::IPEndPoint> {
   typedef net::IPEndPoint param_type;
   static void Write(base::Pickle* m, const param_type& p);
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h
index d75f730..a714130a 100644
--- a/content/public/common/common_param_traits_macros.h
+++ b/content/public/common/common_param_traits_macros.h
@@ -15,7 +15,6 @@
 #include "content/public/common/webplugininfo_param_traits.h"
 #include "ipc/ipc_message_macros.h"
 #include "net/base/network_change_notifier.h"
-#include "net/base/request_priority.h"
 #include "services/network/public/cpp/network_param_ipc_traits.h"
 #include "third_party/WebKit/public/platform/WebHistoryScrollRestorationType.h"
 #include "third_party/WebKit/public/platform/WebPoint.h"
@@ -60,7 +59,6 @@
                           content::EDITING_BEHAVIOR_LAST)
 IPC_ENUM_TRAITS_MAX_VALUE(WindowOpenDisposition,
                           WindowOpenDisposition::MAX_VALUE)
-IPC_ENUM_TRAITS_MAX_VALUE(net::RequestPriority, net::MAXIMUM_PRIORITY)
 IPC_ENUM_TRAITS_MAX_VALUE(content::V8CacheOptions,
                           content::V8_CACHE_OPTIONS_LAST)
 #if defined(OS_ANDROID)
diff --git a/content/public/common/main_function_params.h b/content/public/common/main_function_params.h
index 9a99f18..f88205ed 100644
--- a/content/public/common/main_function_params.h
+++ b/content/public/common/main_function_params.h
@@ -13,6 +13,10 @@
 #include "base/command_line.h"
 #include "build/build_config.h"
 
+#if defined(USE_AURA)
+#include "ui/aura/env.h"
+#endif
+
 #if defined(OS_WIN)
 namespace sandbox {
 struct SandboxInterfaceInfo;
@@ -25,33 +29,23 @@
 }
 #endif
 
-#if defined(USE_AURA)
-#include "ui/aura/env.h"
-#endif
-
 namespace content {
 
+class BrowserMainParts;
+
+using CreatedMainPartsClosure = base::Callback<void(BrowserMainParts*)>;
+
 struct MainFunctionParams {
-  explicit MainFunctionParams(const base::CommandLine& cl)
-      : command_line(cl),
-#if defined(OS_WIN)
-        sandbox_info(NULL),
-#elif defined(OS_MACOSX)
-        autorelease_pool(NULL),
-#elif defined(OS_POSIX) && !defined(OS_ANDROID)
-        zygote_child(false),
-#endif
-        ui_task(NULL) {
-  }
+  explicit MainFunctionParams(const base::CommandLine& cl) : command_line(cl) {}
 
   const base::CommandLine& command_line;
 
 #if defined(OS_WIN)
-  sandbox::SandboxInterfaceInfo* sandbox_info;
+  sandbox::SandboxInterfaceInfo* sandbox_info = nullptr;
 #elif defined(OS_MACOSX)
-  base::mac::ScopedNSAutoreleasePool* autorelease_pool;
+  base::mac::ScopedNSAutoreleasePool* autorelease_pool = nullptr;
 #elif defined(OS_POSIX) && !defined(OS_ANDROID)
-  bool zygote_child;
+  bool zygote_child = false;
 #endif
 
 #if defined(USE_AURA)
@@ -61,9 +55,18 @@
   // Whether DiscardableSharedMemoryManager should be created.
   bool create_discardable_memory = true;
 
+  // TODO(sky): fix ownership of these tasks. MainFunctionParams should really
+  // be passed as an r-value, at which point these can be unique_ptrs. For the
+  // time ownership is passed with MainFunctionParams (meaning these are deleted
+  // in content or client code).
+
   // Used by InProcessBrowserTest. If non-null BrowserMain schedules this
   // task to run on the MessageLoop and BrowserInit is not invoked.
-  base::Closure* ui_task;
+  base::Closure* ui_task = nullptr;
+
+  // Used by InProcessBrowserTest. If non-null this is Run() after
+  // BrowserMainParts has been created and before PreEarlyInitialization().
+  CreatedMainPartsClosure* created_main_parts_closure = nullptr;
 };
 
 }  // namespace content
diff --git a/content/public/common/network_param.typemap b/content/public/common/network_param.typemap
deleted file mode 100644
index 173ef3a..0000000
--- a/content/public/common/network_param.typemap
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2017 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.
-
-mojom = "//content/public/common/url_loader.mojom"
-public_headers = [
-  "//net/base/host_port_pair.h",
-  "//net/cert/cert_verify_result.h",
-  "//net/cert/x509_certificate.h",
-  "//net/http/http_request_headers.h",
-  "//net/ssl/ssl_info.h",
-]
-traits_headers = [ "//services/network/public/cpp/network_param_ipc_traits.h" ]
-deps = [
-  "//content:export",
-  "//net",
-  "//services/network/public/cpp",
-]
-type_mappings = [
-  "content.mojom.CertVerifyResult=net::CertVerifyResult",
-  "content.mojom.HostPortPair=net::HostPortPair",
-  "content.mojom.HttpRequestHeaders=net::HttpRequestHeaders",
-  "content.mojom.SSLInfo=net::SSLInfo",
-  "content.mojom.X509Certificate=scoped_refptr<net::X509Certificate>[nullable_is_same_type]",
-]
diff --git a/content/public/common/network_service.mojom b/content/public/common/network_service.mojom
index b848e4c..f6cf351 100644
--- a/content/public/common/network_service.mojom
+++ b/content/public/common/network_service.mojom
@@ -6,18 +6,15 @@
 
 import "mojo/common/file_path.mojom";
 import "mojo/common/time.mojom";
-import "url_loader.mojom";
-import "url_loader_factory.mojom";
 import "url/mojo/url.mojom";
 import "services/network/public/interfaces/cookie_manager.mojom";
 import "services/network/public/interfaces/network_change_manager.mojom";
 import "services/network/public/interfaces/proxy_config.mojom";
+import "services/network/public/interfaces/url_loader.mojom";
+import "services/network/public/interfaces/url_loader_factory.mojom";
 import "services/network/public/interfaces/restricted_cookie_manager.mojom";
 import "services/proxy_resolver/public/interfaces/proxy_resolver.mojom";
 
-[Native]
-struct SSLInfo;
-
 // Parameters for constructing a network context.
 struct NetworkContextParams {
   // Name used by memory tools to identify the context.
@@ -118,13 +115,13 @@
 interface NetworkContext {
   // |process_id| is 0 for requests initiated in the browser process, otherwise
   // it's the child process ID.
-  CreateURLLoaderFactory(URLLoaderFactory& url_loader_factory,
+  CreateURLLoaderFactory(network.mojom.URLLoaderFactory& url_loader_factory,
                          uint32 process_id);
 
   // Handles a request to display cache data to the user. |url| is parsed to
   // display different parts of the cache.
   HandleViewCacheRequest(url.mojom.Url url,
-                         URLLoaderClient client);
+                         network.mojom.URLLoaderClient client);
 
   // Gets the CookieManager associated with this network context.
   GetCookieManager(network.mojom.CookieManager& cookie_manager);
@@ -169,7 +166,7 @@
                         url.mojom.Url url,
                         uint32 process_id,
                         uint32 routing_id,
-                        SSLInfo ssl_info,
+                        network.mojom.SSLInfo ssl_info,
                         bool fatal) => (int32 net_error);
 };
 
diff --git a/content/public/common/network_service_test.mojom b/content/public/common/network_service_test.mojom
index 1655330..812827c 100644
--- a/content/public/common/network_service_test.mojom
+++ b/content/public/common/network_service_test.mojom
@@ -5,12 +5,7 @@
 module content.mojom;
 
 import "services/network/public/interfaces/network_change_manager.mojom";
-
-[Native]
-struct CertVerifyResult;
-
-[Native]
-struct X509Certificate;
+import "services/network/public/interfaces/url_loader.mojom";
 
 struct Rule {
   string host_pattern;
@@ -40,8 +35,8 @@
 
   [Sync]
   MockCertVerifierAddResultForCertAndHost(
-      X509Certificate cert,
+      network.mojom.X509Certificate cert,
       string host_pattern,
-      CertVerifyResult verify_result,
+      network.mojom.CertVerifyResult verify_result,
       int32 rv) => ();
 };
diff --git a/content/public/common/shared_url_loader_factory.h b/content/public/common/shared_url_loader_factory.h
index 36b511c7..0871edc 100644
--- a/content/public/common/shared_url_loader_factory.h
+++ b/content/public/common/shared_url_loader_factory.h
@@ -10,9 +10,9 @@
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
@@ -55,12 +55,12 @@
       std::unique_ptr<SharedURLLoaderFactoryInfo> info);
 
   virtual void CreateLoaderAndStart(
-      mojom::URLLoaderRequest loader,
+      network::mojom::URLLoaderRequest loader,
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
       const Constraints& constaints = kDefaultConstraints) = 0;
 
diff --git a/content/public/common/simple_url_loader.cc b/content/public/common/simple_url_loader.cc
index 46b1427..b3c94aa 100644
--- a/content/public/common/simple_url_loader.cc
+++ b/content/public/common/simple_url_loader.cc
@@ -23,8 +23,6 @@
 #include "base/task_scheduler/post_task.h"
 #include "base/task_scheduler/task_traits.h"
 #include "base/threading/sequenced_task_runner_handle.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/system/data_pipe.h"
@@ -37,6 +35,8 @@
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/interfaces/data_pipe_getter.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -173,7 +173,7 @@
 class BodyHandler;
 
 class SimpleURLLoaderImpl : public SimpleURLLoader,
-                            public mojom::URLLoaderClient {
+                            public network::mojom::URLLoaderClient {
  public:
   SimpleURLLoaderImpl(
       std::unique_ptr<network::ResourceRequest> resource_request,
@@ -181,19 +181,19 @@
   ~SimpleURLLoaderImpl() override;
 
   // SimpleURLLoader implementation.
-  void DownloadToString(mojom::URLLoaderFactory* url_loader_factory,
+  void DownloadToString(network::mojom::URLLoaderFactory* url_loader_factory,
                         BodyAsStringCallback body_as_string_callback,
                         size_t max_body_size) override;
   void DownloadToStringOfUnboundedSizeUntilCrashAndDie(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       BodyAsStringCallback body_as_string_callback) override;
   void DownloadToFile(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       DownloadToFileCompleteCallback download_to_file_complete_callback,
       const base::FilePath& file_path,
       int64_t max_body_size) override;
   void DownloadToTempFile(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       DownloadToFileCompleteCallback download_to_file_complete_callback,
       int64_t max_body_size) override;
   void SetOnRedirectCallback(
@@ -251,19 +251,20 @@
 
   // Prepares internal state to start a request, and then calls StartRequest().
   // Only used for the initial request (Not retries).
-  void Start(mojom::URLLoaderFactory* url_loader_factory);
+  void Start(network::mojom::URLLoaderFactory* url_loader_factory);
 
   // Starts a request. Used for both the initial request and retries, if any.
-  void StartRequest(mojom::URLLoaderFactory* url_loader_factory);
+  void StartRequest(network::mojom::URLLoaderFactory* url_loader_factory);
 
   // Re-initializes state of |this| and |body_handler_| prior to retrying a
   // request.
   void Retry();
 
-  // mojom::URLLoaderClient implementation;
-  void OnReceiveResponse(const network::ResourceResponseHead& response_head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  // network::mojom::URLLoaderClient implementation;
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& response_head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(
       const net::RedirectInfo& redirect_info,
       const network::ResourceResponseHead& response_head) override;
@@ -317,11 +318,11 @@
   const net::NetworkTrafficAnnotationTag annotation_tag_;
   // Cloned from the input URLLoaderFactory if it may be needed to follow
   // redirects.
-  content::mojom::URLLoaderFactoryPtr url_loader_factory_ptr_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_ptr_;
   std::unique_ptr<BodyHandler> body_handler_;
 
-  mojo::Binding<mojom::URLLoaderClient> client_binding_;
-  mojom::URLLoaderPtr url_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> client_binding_;
+  network::mojom::URLLoaderPtr url_loader_;
 
   std::unique_ptr<StringUploadDataPipeGetter> string_upload_data_pipe_getter_;
 
@@ -904,7 +905,7 @@
 SimpleURLLoaderImpl::~SimpleURLLoaderImpl() {}
 
 void SimpleURLLoaderImpl::DownloadToString(
-    mojom::URLLoaderFactory* url_loader_factory,
+    network::mojom::URLLoaderFactory* url_loader_factory,
     BodyAsStringCallback body_as_string_callback,
     size_t max_body_size) {
   DCHECK_LE(max_body_size, kMaxBoundedStringDownloadSize);
@@ -914,7 +915,7 @@
 }
 
 void SimpleURLLoaderImpl::DownloadToStringOfUnboundedSizeUntilCrashAndDie(
-    mojom::URLLoaderFactory* url_loader_factory,
+    network::mojom::URLLoaderFactory* url_loader_factory,
     BodyAsStringCallback body_as_string_callback) {
   body_handler_ = std::make_unique<SaveToStringBodyHandler>(
       this, std::move(body_as_string_callback),
@@ -925,7 +926,7 @@
 }
 
 void SimpleURLLoaderImpl::DownloadToFile(
-    mojom::URLLoaderFactory* url_loader_factory,
+    network::mojom::URLLoaderFactory* url_loader_factory,
     DownloadToFileCompleteCallback download_to_file_complete_callback,
     const base::FilePath& file_path,
     int64_t max_body_size) {
@@ -937,7 +938,7 @@
 }
 
 void SimpleURLLoaderImpl::DownloadToTempFile(
-    mojom::URLLoaderFactory* url_loader_factory,
+    network::mojom::URLLoaderFactory* url_loader_factory,
     DownloadToFileCompleteCallback download_to_file_complete_callback,
     int64_t max_body_size) {
   body_handler_ = std::make_unique<SaveToFileBodyHandler>(
@@ -1083,7 +1084,8 @@
   body_handler_->NotifyConsumerOfCompletion(destroy_results);
 }
 
-void SimpleURLLoaderImpl::Start(mojom::URLLoaderFactory* url_loader_factory) {
+void SimpleURLLoaderImpl::Start(
+    network::mojom::URLLoaderFactory* url_loader_factory) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   DCHECK(resource_request_);
   // It's illegal to use a single SimpleURLLoaderImpl to make multiple requests.
@@ -1103,11 +1105,11 @@
 }
 
 void SimpleURLLoaderImpl::StartRequest(
-    mojom::URLLoaderFactory* url_loader_factory) {
+    network::mojom::URLLoaderFactory* url_loader_factory) {
   DCHECK(resource_request_);
   DCHECK(url_loader_factory);
 
-  mojom::URLLoaderClientPtr client_ptr;
+  network::mojom::URLLoaderClientPtr client_ptr;
   client_binding_.Bind(mojo::MakeRequest(&client_ptr));
   client_binding_.set_connection_error_handler(base::BindOnce(
       &SimpleURLLoaderImpl::OnConnectionError, base::Unretained(this)));
@@ -1151,7 +1153,7 @@
 void SimpleURLLoaderImpl::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
   if (request_state_->response_info) {
     // The final headers have already been received, so the URLLoader is
diff --git a/content/public/common/simple_url_loader.h b/content/public/common/simple_url_loader.h
index f68df784..9941d24 100644
--- a/content/public/common/simple_url_loader.h
+++ b/content/public/common/simple_url_loader.h
@@ -27,13 +27,12 @@
 namespace network {
 struct ResourceRequest;
 struct ResourceResponseHead;
-}
-
-namespace content {
-
 namespace mojom {
 class URLLoaderFactory;
 }
+}  // namespace network
+
+namespace content {
 
 // Creates and wraps a URLLoader, and runs it to completion. It's recommended
 // that consumers use this class instead of URLLoader directly, due to the
@@ -114,7 +113,7 @@
   // SimpleURLLoader before the callback is invoked will return in cancelling
   // the request, and the callback will not be called.
   virtual void DownloadToString(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       BodyAsStringCallback body_as_string_callback,
       size_t max_body_size) = 0;
 
@@ -124,7 +123,7 @@
   // instead (DownloadToString if the body is expected to be of reasonable
   // length, or DownloadToFile otherwise).
   virtual void DownloadToStringOfUnboundedSizeUntilCrashAndDie(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       BodyAsStringCallback body_as_string_callback) = 0;
 
   // SimpleURLLoader will download the entire response to a file at the
@@ -141,7 +140,7 @@
   // downloaded file will be deleted asynchronously and the callback will not be
   // invoked, regardless of other settings.
   virtual void DownloadToFile(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       DownloadToFileCompleteCallback download_to_file_complete_callback,
       const base::FilePath& file_path,
       int64_t max_body_size = std::numeric_limits<int64_t>::max()) = 0;
@@ -149,7 +148,7 @@
   // Same as DownloadToFile, but creates a temporary file instead of taking a
   // FilePath.
   virtual void DownloadToTempFile(
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       DownloadToFileCompleteCallback download_to_file_complete_callback,
       int64_t max_body_size = std::numeric_limits<int64_t>::max()) = 0;
 
diff --git a/content/public/common/simple_url_loader_unittest.cc b/content/public/common/simple_url_loader_unittest.cc
index 68b86ae..c2ec396d 100644
--- a/content/public/common/simple_url_loader_unittest.cc
+++ b/content/public/common/simple_url_loader_unittest.cc
@@ -28,7 +28,6 @@
 #include "content/public/common/network_service.mojom.h"
 #include "content/public/common/service_manager_connection.h"
 #include "content/public/common/service_names.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/network/network_service.h"
 #include "mojo/public/c/system/types.h"
 #include "mojo/public/cpp/bindings/binding.h"
@@ -46,6 +45,7 @@
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/cpp/url_loader_completion_status.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -124,7 +124,7 @@
   // |max_body_size| of -1 means don't use a max body size (Use
   // DownloadToStringOfUnboundedSizeUntilCrashAndDie for string downloads, and
   // don't specify a size for other types of downloads).
-  void StartSimpleLoader(mojom::URLLoaderFactory* url_loader_factory,
+  void StartSimpleLoader(network::mojom::URLLoaderFactory* url_loader_factory,
                          int64_t max_body_size = -1) {
     EXPECT_FALSE(done_);
     switch (download_type_) {
@@ -175,8 +175,9 @@
   }
 
   // Starts the SimpleURLLoader waits for completion.
-  void StartSimpleLoaderAndWait(mojom::URLLoaderFactory* url_loader_factory,
-                                int64_t max_body_size = -1) {
+  void StartSimpleLoaderAndWait(
+      network::mojom::URLLoaderFactory* url_loader_factory,
+      int64_t max_body_size = -1) {
     StartSimpleLoader(url_loader_factory, max_body_size);
     Wait();
   }
@@ -430,7 +431,7 @@
 
   std::unique_ptr<mojom::NetworkService> network_service_;
   mojom::NetworkContextPtr network_context_;
-  mojom::URLLoaderFactoryPtr url_loader_factory_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_;
 
   net::test_server::EmbeddedTestServer test_server_;
 
@@ -1156,11 +1157,11 @@
 // control over event order over when a pipe is closed, and in ordering of
 // events where there are multiple pipes. It also allows sending events in
 // unexpected order, to test handling of events from less trusted processes.
-class MockURLLoader : public mojom::URLLoader {
+class MockURLLoader : public network::mojom::URLLoader {
  public:
   MockURLLoader(base::test::ScopedTaskEnvironment* scoped_task_environment,
-                mojom::URLLoaderRequest url_loader_request,
-                mojom::URLLoaderClientPtr client,
+                network::mojom::URLLoaderRequest url_loader_request,
+                network::mojom::URLLoaderClientPtr client,
                 std::vector<TestLoaderEvent> test_events,
                 scoped_refptr<network::ResourceRequestBody> request_body)
       : scoped_task_environment_(scoped_task_environment),
@@ -1363,7 +1364,7 @@
   }
   ~MockURLLoader() override {}
 
-  // mojom::URLLoader implementation:
+  // network::mojom::URLLoader implementation:
   void FollowRedirect() override {}
   void ProceedWithResponse() override {}
   void SetPriority(net::RequestPriority priority,
@@ -1373,7 +1374,7 @@
   void PauseReadingBodyFromNet() override {}
   void ResumeReadingBodyFromNet() override {}
 
-  mojom::URLLoaderClient* client() const { return client_.get(); }
+  network::mojom::URLLoaderClient* client() const { return client_.get(); }
 
  private:
   // Counts the total number of bytes that will be sent over the course of
@@ -1397,8 +1398,8 @@
   base::test::ScopedTaskEnvironment* scoped_task_environment_;
 
   std::unique_ptr<net::URLRequest> url_request_;
-  mojo::Binding<mojom::URLLoader> binding_;
-  mojom::URLLoaderClientPtr client_;
+  mojo::Binding<network::mojom::URLLoader> binding_;
+  network::mojom::URLLoaderClientPtr client_;
 
   std::vector<TestLoaderEvent> test_events_;
 
@@ -1414,21 +1415,21 @@
   DISALLOW_COPY_AND_ASSIGN(MockURLLoader);
 };
 
-class MockURLLoaderFactory : public mojom::URLLoaderFactory {
+class MockURLLoaderFactory : public network::mojom::URLLoaderFactory {
  public:
   explicit MockURLLoaderFactory(
       base::test::ScopedTaskEnvironment* scoped_task_environment)
       : scoped_task_environment_(scoped_task_environment) {}
   ~MockURLLoaderFactory() override {}
 
-  // mojom::URLLoaderFactory implementation:
+  // network::mojom::URLLoaderFactory implementation:
 
-  void CreateLoaderAndStart(mojom::URLLoaderRequest url_loader_request,
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest url_loader_request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     ASSERT_FALSE(test_events_.empty());
@@ -1441,7 +1442,7 @@
     url_loader_queue_.push_back(url_loaders_.back().get());
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override {
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
     mojo::BindingId id = binding_set_.AddBinding(this, std::move(request));
     if (close_new_binding_on_clone_)
       binding_set_.RemoveBinding(id);
@@ -1465,7 +1466,7 @@
   // Runs all events for all created URLLoaders, in order.
   void RunTest(SimpleLoaderTestHelper* test_helper,
                bool wait_for_completion = true) {
-    mojom::URLLoaderFactoryPtr factory;
+    network::mojom::URLLoaderFactoryPtr factory;
     binding_set_.AddBinding(this, mojo::MakeRequest(&factory));
 
     test_helper->StartSimpleLoader(factory.get());
@@ -1501,7 +1502,7 @@
 
   std::list<GURL> requested_urls_;
 
-  mojo::BindingSet<mojom::URLLoaderFactory> binding_set_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> binding_set_;
 
   DISALLOW_COPY_AND_ASSIGN(MockURLLoaderFactory);
 };
diff --git a/content/public/common/typemaps.gni b/content/public/common/typemaps.gni
index c21b84d0..5d4fc4d71 100644
--- a/content/public/common/typemaps.gni
+++ b/content/public/common/typemaps.gni
@@ -3,14 +3,8 @@
 # found in the LICENSE file.
 
 typemaps = [
-  "//content/public/common/cors_error_status.typemap",
   "//content/public/common/manifest.typemap",
-  "//content/public/common/network_param.typemap",
   "//content/public/common/referrer.typemap",
   "//content/public/common/resource_type.typemap",
-  "//content/public/common/url_loader_completion_status.typemap",
-  "//content/public/common/url_request.typemap",
-  "//content/public/common/url_request_redirect_info.typemap",
-  "//content/public/common/url_response_head.typemap",
   "//content/public/common/webplugininfo.typemap",
 ]
diff --git a/content/public/common/url_request.typemap b/content/public/common/url_request.typemap
deleted file mode 100644
index b6e74ea6..0000000
--- a/content/public/common/url_request.typemap
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2016 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.
-
-mojom = "//content/public/common/url_loader.mojom"
-public_headers = [ "//services/network/public/cpp/resource_request.h" ]
-traits_headers = [
-  "//content/common/resource_messages.h",
-  "//content/common/url_request_struct_traits.h",
-]
-deps = [
-  "//content:export",
-  "//net:net",
-  "//third_party/WebKit/public:blink_headers",
-  "//ui/base",
-]
-type_mappings = [
-  "content.mojom.URLRequest=network::ResourceRequest",
-  "content.mojom.RequestPriority=net::RequestPriority",
-]
diff --git a/content/public/common/url_response_head.typemap b/content/public/common/url_response_head.typemap
deleted file mode 100644
index aa23e30f..0000000
--- a/content/public/common/url_response_head.typemap
+++ /dev/null
@@ -1,12 +0,0 @@
-# Copyright 2016 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.
-
-mojom = "//content/public/common/url_loader.mojom"
-public_headers = [ "//services/network/public/cpp/resource_response.h" ]
-traits_headers = [ "//content/common/resource_messages.h" ]
-deps = [
-  "//net:net",
-]
-type_mappings =
-    [ "content.mojom.URLResponseHead=network::ResourceResponseHead" ]
diff --git a/content/public/renderer/child_url_loader_factory_getter.h b/content/public/renderer/child_url_loader_factory_getter.h
index 38c03d3..4452abc 100644
--- a/content/public/renderer/child_url_loader_factory_getter.h
+++ b/content/public/renderer/child_url_loader_factory_getter.h
@@ -6,7 +6,7 @@
 #define CONTENT_PUBLIC_RENDERER_CHILD_URL_LOADER_FACTORY_GETTER_H_
 
 #include "base/memory/ref_counted.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 class GURL;
 
@@ -22,16 +22,16 @@
   // ChildURLLoaderFactoryGetter in worker thread.
   class Info {
    public:
-    Info(mojom::URLLoaderFactoryPtrInfo network_loader_factory_info,
-         mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info);
+    Info(network::mojom::URLLoaderFactoryPtrInfo network_loader_factory_info,
+         network::mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info);
     Info(Info&& other);
     ~Info();
 
     scoped_refptr<ChildURLLoaderFactoryGetter> Bind();
 
    private:
-    mojom::URLLoaderFactoryPtrInfo network_loader_factory_info_;
-    mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info_;
+    network::mojom::URLLoaderFactoryPtrInfo network_loader_factory_info_;
+    network::mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info_;
   };
 
   virtual Info GetClonedInfo() = 0;
@@ -40,12 +40,12 @@
   // returns BlobURLLoader factory for blob: URL requests). When an appropriate
   // factory cannot be determined, |default_factory| is returned if non-null
   // factory is given, or Network URLLoaderFactory is returned otherwise.
-  virtual mojom::URLLoaderFactory* GetFactoryForURL(
+  virtual network::mojom::URLLoaderFactory* GetFactoryForURL(
       const GURL& request_url,
-      mojom::URLLoaderFactory* default_factory = nullptr) = 0;
+      network::mojom::URLLoaderFactory* default_factory = nullptr) = 0;
 
-  virtual mojom::URLLoaderFactory* GetNetworkLoaderFactory() = 0;
-  virtual mojom::URLLoaderFactory* GetBlobLoaderFactory() = 0;
+  virtual network::mojom::URLLoaderFactory* GetNetworkLoaderFactory() = 0;
+  virtual network::mojom::URLLoaderFactory* GetBlobLoaderFactory() = 0;
 
  protected:
   friend class base::RefCounted<ChildURLLoaderFactoryGetter>;
diff --git a/content/public/renderer/render_frame.h b/content/public/renderer/render_frame.h
index 20c4e4b..ab957e6 100644
--- a/content/public/renderer/render_frame.h
+++ b/content/public/renderer/render_frame.h
@@ -15,10 +15,10 @@
 #include "content/common/content_export.h"
 #include "content/public/common/console_message_level.h"
 #include "content/public/common/previews_state.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "ipc/ipc_listener.h"
 #include "ipc/ipc_sender.h"
 #include "ppapi/features/features.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
 #include "third_party/WebKit/common/page/page_visibility_state.mojom.h"
 #include "third_party/WebKit/public/platform/TaskType.h"
@@ -262,7 +262,7 @@
   virtual void SetAccessibilityModeForTest(ui::AXMode new_mode) = 0;
 
   // Returns the URLLoaderFactory for the given GURL
-  virtual mojom::URLLoaderFactory* GetURLLoaderFactory(
+  virtual network::mojom::URLLoaderFactory* GetURLLoaderFactory(
       const GURL& request_url) = 0;
 
  protected:
diff --git a/content/public/renderer/resource_fetcher.h b/content/public/renderer/resource_fetcher.h
index 3bf468a..a457dfc5 100644
--- a/content/public/renderer/resource_fetcher.h
+++ b/content/public/renderer/resource_fetcher.h
@@ -10,7 +10,7 @@
 
 #include "base/callback.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
 
 class GURL;
@@ -62,7 +62,7 @@
   virtual void Start(
       blink::WebLocalFrame* frame,
       blink::WebURLRequest::RequestContext request_context,
-      mojom::URLLoaderFactory* url_loader_factory,
+      network::mojom::URLLoaderFactory* url_loader_factory,
       const net::NetworkTrafficAnnotationTag& annotation_tag,
       Callback callback,
       size_t maximum_download_size = kDefaultMaximumDownloadSize) = 0;
diff --git a/content/public/test/browser_test_base.cc b/content/public/test/browser_test_base.cc
index ef0e40d..16ee8fce1 100644
--- a/content/public/test/browser_test_base.cc
+++ b/content/public/test/browser_test_base.cc
@@ -292,13 +292,20 @@
   auto ui_task = std::make_unique<base::Closure>(base::Bind(
       &BrowserTestBase::ProxyRunTestOnMainThreadLoop, base::Unretained(this)));
 
+  auto created_main_parts_closure =
+      std::make_unique<CreatedMainPartsClosure>(base::Bind(
+          &BrowserTestBase::CreatedBrowserMainParts, base::Unretained(this)));
+
 #if defined(OS_ANDROID)
   MainFunctionParams params(*command_line);
   params.ui_task = ui_task.release();
+  params.created_main_parts_closure = created_main_parts_closure.release();
   // TODO(phajdan.jr): Check return code, http://crbug.com/374738 .
   BrowserMain(params);
 #else
   GetContentMainParams()->ui_task = ui_task.release();
+  GetContentMainParams()->created_main_parts_closure =
+      created_main_parts_closure.release();
   EXPECT_EQ(expected_exit_code_, ContentMain(*GetContentMainParams()));
 #endif
   TearDownInProcessBrowserTestFixture();
diff --git a/content/public/test/browser_test_base.h b/content/public/test/browser_test_base.h
index 0e0a381..f6024160 100644
--- a/content/public/test/browser_test_base.h
+++ b/content/public/test/browser_test_base.h
@@ -22,6 +22,8 @@
 
 namespace content {
 
+class BrowserMainParts;
+
 class BrowserTestBase : public testing::Test {
  public:
   BrowserTestBase();
@@ -65,6 +67,10 @@
   // Override this for things you would normally override TearDown for.
   virtual void TearDownInProcessBrowserTestFixture() {}
 
+  // Called after the BrowserMainParts have been created, and before
+  // PreEarlyInitialization() has been called.
+  virtual void CreatedBrowserMainParts(BrowserMainParts* browser_main_parts) {}
+
   // This is invoked from main after browser_init/browser_main have completed.
   // This prepares for the test by creating a new browser and doing any other
   // initialization.
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index b1da72c..ac0b19b 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -2420,7 +2420,7 @@
                      const GURL& url,
                      int process_id,
                      int render_frame_id) {
-  mojom::URLLoaderFactoryPtr url_loader_factory;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory;
   network_context->CreateURLLoaderFactory(MakeRequest(&url_loader_factory),
                                           process_id);
   // |url_loader_factory| will receive error notification asynchronously if
diff --git a/content/public/test/test_storage_partition.cc b/content/public/test/test_storage_partition.cc
index 8f9c98b..a86e103 100644
--- a/content/public/test/test_storage_partition.cc
+++ b/content/public/test/test_storage_partition.cc
@@ -26,7 +26,7 @@
   return network_context_;
 }
 
-mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 TestStoragePartition::GetURLLoaderFactoryForBrowserProcess() {
   return url_loader_factory_for_browser_process_;
 }
diff --git a/content/public/test/test_storage_partition.h b/content/public/test/test_storage_partition.h
index e9a3e5c9..1a4d744 100644
--- a/content/public/test/test_storage_partition.h
+++ b/content/public/test/test_storage_partition.h
@@ -58,11 +58,13 @@
   mojom::NetworkContext* GetNetworkContext() override;
 
   void set_url_loader_factory_for_browser_process(
-      mojom::URLLoaderFactory* url_loader_factory_for_browser_process) {
+      network::mojom::URLLoaderFactory*
+          url_loader_factory_for_browser_process) {
     url_loader_factory_for_browser_process_ =
         url_loader_factory_for_browser_process;
   }
-  mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() override;
+  network::mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess()
+      override;
 
   void set_cookie_manager_for_browser_process(
       network::mojom::CookieManager* cookie_manager_for_browser_process) {
@@ -171,7 +173,8 @@
   net::URLRequestContextGetter* url_request_context_getter_ = nullptr;
   net::URLRequestContextGetter* media_url_request_context_getter_ = nullptr;
   mojom::NetworkContext* network_context_ = nullptr;
-  mojom::URLLoaderFactory* url_loader_factory_for_browser_process_ = nullptr;
+  network::mojom::URLLoaderFactory* url_loader_factory_for_browser_process_ =
+      nullptr;
   network::mojom::CookieManager* cookie_manager_for_browser_process_ = nullptr;
   storage::QuotaManager* quota_manager_ = nullptr;
   AppCacheService* app_cache_service_ = nullptr;
diff --git a/content/public/test/test_url_loader_client.cc b/content/public/test/test_url_loader_client.cc
index d4d6ec1..d974a02 100644
--- a/content/public/test/test_url_loader_client.cc
+++ b/content/public/test/test_url_loader_client.cc
@@ -16,7 +16,7 @@
 void TestURLLoaderClient::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   EXPECT_FALSE(has_received_response_);
   EXPECT_FALSE(has_received_cached_metadata_);
   EXPECT_FALSE(has_received_completion_);
@@ -108,7 +108,8 @@
     quit_closure_for_on_complete_.Run();
 }
 
-mojom::DownloadedTempFilePtr TestURLLoaderClient::TakeDownloadedTempFile() {
+network::mojom::DownloadedTempFilePtr
+TestURLLoaderClient::TakeDownloadedTempFile() {
   return std::move(downloaded_file_);
 }
 
@@ -116,8 +117,8 @@
   has_received_redirect_ = false;
 }
 
-mojom::URLLoaderClientPtr TestURLLoaderClient::CreateInterfacePtr() {
-  mojom::URLLoaderClientPtr client_ptr;
+network::mojom::URLLoaderClientPtr TestURLLoaderClient::CreateInterfacePtr() {
+  network::mojom::URLLoaderClientPtr client_ptr;
   binding_.Bind(mojo::MakeRequest(&client_ptr));
   binding_.set_connection_error_handler(base::BindOnce(
       &TestURLLoaderClient::OnConnectionError, base::Unretained(this)));
diff --git a/content/public/test/test_url_loader_client.h b/content/public/test/test_url_loader_client.h
index 7ace78d..2c87fcac 100644
--- a/content/public/test/test_url_loader_client.h
+++ b/content/public/test/test_url_loader_client.h
@@ -10,13 +10,13 @@
 
 #include "base/callback.h"
 #include "base/macros.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/c/system/data_pipe.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "net/url_request/redirect_info.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/cpp/url_loader_completion_status.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -28,14 +28,15 @@
 //   client.RunUntilComplete();
 //   EXPECT_EQ(net::OK, client.completion_status().error_code);
 //   ...
-class TestURLLoaderClient final : public mojom::URLLoaderClient {
+class TestURLLoaderClient final : public network::mojom::URLLoaderClient {
  public:
   TestURLLoaderClient();
   ~TestURLLoaderClient() override;
 
-  void OnReceiveResponse(const network::ResourceResponseHead& response_head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& response_head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(
       const net::RedirectInfo& redirect_info,
       const network::ResourceResponseHead& response_head) override;
@@ -84,10 +85,10 @@
     has_received_upload_progress_ = false;
   }
 
-  mojom::DownloadedTempFilePtr TakeDownloadedTempFile();
+  network::mojom::DownloadedTempFilePtr TakeDownloadedTempFile();
   void ClearHasReceivedRedirect();
   // Creates an InterfacePtr, binds it to |*this| and returns it.
-  mojom::URLLoaderClientPtr CreateInterfacePtr();
+  network::mojom::URLLoaderClientPtr CreateInterfacePtr();
 
   void Unbind();
 
@@ -102,10 +103,10 @@
  private:
   void OnConnectionError();
 
-  mojo::Binding<mojom::URLLoaderClient> binding_;
+  mojo::Binding<network::mojom::URLLoaderClient> binding_;
   network::ResourceResponseHead response_head_;
   base::Optional<net::SSLInfo> ssl_info_;
-  mojom::DownloadedTempFilePtr downloaded_file_;
+  network::mojom::DownloadedTempFilePtr downloaded_file_;
   net::RedirectInfo redirect_info_;
   std::string cached_metadata_;
   mojo::ScopedDataPipeConsumerHandle response_body_;
@@ -126,7 +127,7 @@
   base::Closure quit_closure_for_on_complete_;
   base::Closure quit_closure_for_on_connection_error_;
 
-  mojom::URLLoaderFactoryPtr url_loader_factory_;
+  network::mojom::URLLoaderFactoryPtr url_loader_factory_;
   int64_t download_data_length_ = 0;
   int64_t encoded_download_data_length_ = 0;
   int64_t body_transfer_size_ = 0;
diff --git a/content/public/test/url_loader_interceptor.cc b/content/public/test/url_loader_interceptor.cc
index bbd5a39..3f3c27e 100644
--- a/content/public/test/url_loader_interceptor.cc
+++ b/content/public/test/url_loader_interceptor.cc
@@ -11,15 +11,17 @@
 #include "content/browser/url_loader_factory_getter.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/common/content_features.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "net/http/http_util.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace content {
 
-class URLLoaderInterceptor::Interceptor : public mojom::URLLoaderFactory {
+class URLLoaderInterceptor::Interceptor
+    : public network::mojom::URLLoaderFactory {
  public:
   using ProcessIdGetter = base::Callback<int()>;
-  using OriginalFactoryGetter = base::Callback<mojom::URLLoaderFactory*()>;
+  using OriginalFactoryGetter =
+      base::Callback<network::mojom::URLLoaderFactory*()>;
 
   Interceptor(URLLoaderInterceptor* parent,
               const ProcessIdGetter& process_id_getter,
@@ -31,13 +33,13 @@
   ~Interceptor() override {}
 
  private:
-  // mojom::URLLoaderFactory implementation:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     RequestParams params;
@@ -74,7 +76,9 @@
         params.traffic_annotation);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
   URLLoaderInterceptor* parent_;
   ProcessIdGetter process_id_getter_;
@@ -93,7 +97,7 @@
       : url_loader_factory_getter_(url_loader_factory_getter) {
     frame_interceptor_ = std::make_unique<Interceptor>(
         parent, base::BindRepeating([]() { return 0; }),
-        base::BindLambdaForTesting([=]() -> mojom::URLLoaderFactory* {
+        base::BindLambdaForTesting([=]() -> network::mojom::URLLoaderFactory* {
           return url_loader_factory_getter
               ->original_network_factory_for_testing()
               ->get();
@@ -115,10 +119,10 @@
 // loader so that it can intercept subresource requests.
 class URLLoaderInterceptor::SubresourceWrapper {
  public:
-  SubresourceWrapper(mojom::URLLoaderFactoryRequest factory_request,
+  SubresourceWrapper(network::mojom::URLLoaderFactoryRequest factory_request,
                      int process_id,
                      URLLoaderInterceptor* parent,
-                     mojom::URLLoaderFactoryPtrInfo original_factory)
+                     network::mojom::URLLoaderFactoryPtrInfo original_factory)
       : interceptor_(
             parent,
             base::BindRepeating([](int process_id) { return process_id; },
@@ -135,13 +139,13 @@
   ~SubresourceWrapper() {}
 
  private:
-  mojom::URLLoaderFactory* GetOriginalFactory() {
+  network::mojom::URLLoaderFactory* GetOriginalFactory() {
     return original_factory_.get();
   }
 
   Interceptor interceptor_;
-  mojo::Binding<mojom::URLLoaderFactory> binding_;
-  mojom::URLLoaderFactoryPtr original_factory_;
+  mojo::Binding<network::mojom::URLLoaderFactory> binding_;
+  network::mojom::URLLoaderFactoryPtr original_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(SubresourceWrapper);
 };
@@ -194,9 +198,10 @@
   run_loop.Run();
 }
 
-void URLLoaderInterceptor::WriteResponse(const std::string& headers,
-                                         const std::string& body,
-                                         mojom::URLLoaderClient* client) {
+void URLLoaderInterceptor::WriteResponse(
+    const std::string& headers,
+    const std::string& body,
+    network::mojom::URLLoaderClient* client) {
   net::HttpResponseInfo info;
   info.headers = new net::HttpResponseHeaders(
       net::HttpUtil::AssembleRawHeaders(headers.c_str(), headers.length()));
@@ -217,9 +222,9 @@
 }
 
 void URLLoaderInterceptor::CreateURLLoaderFactoryForSubresources(
-    mojom::URLLoaderFactoryRequest request,
+    network::mojom::URLLoaderFactoryRequest request,
     int process_id,
-    mojom::URLLoaderFactoryPtrInfo original_factory) {
+    network::mojom::URLLoaderFactoryPtrInfo original_factory) {
   if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
@@ -269,7 +274,7 @@
           return ResourceMessageFilter::GetCurrentForTesting()->child_id();
         }),
         base::BindRepeating([]() {
-          mojom::URLLoaderFactory* factory =
+          network::mojom::URLLoaderFactory* factory =
               ResourceMessageFilter::GetCurrentForTesting();
           return factory;
         }));
diff --git a/content/public/test/url_loader_interceptor.h b/content/public/test/url_loader_interceptor.h
index 6b6c5dd..1da372a 100644
--- a/content/public/test/url_loader_interceptor.h
+++ b/content/public/test/url_loader_interceptor.h
@@ -8,9 +8,9 @@
 #include <set>
 
 #include "base/macros.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 class URLLoaderFactoryGetter;
@@ -48,12 +48,12 @@
     // browser process).
     int process_id;
     // The following are the parameters to CreateLoaderAndStart.
-    mojom::URLLoaderRequest request;
+    network::mojom::URLLoaderRequest request;
     int32_t routing_id;
     int32_t request_id;
     uint32_t options;
     network::ResourceRequest url_request;
-    mojom::URLLoaderClientPtr client;
+    network::mojom::URLLoaderClientPtr client;
     net::MutableNetworkTrafficAnnotationTag traffic_annotation;
   };
   // Function signature for intercept method.
@@ -69,7 +69,7 @@
   // Helper methods for use when intercepting.
   static void WriteResponse(const std::string& headers,
                             const std::string& body,
-                            mojom::URLLoaderClient* client);
+                            network::mojom::URLLoaderClient* client);
 
  private:
   class Interceptor;
@@ -78,9 +78,9 @@
 
   // Used to create a factory for subresources in the network service case.
   void CreateURLLoaderFactoryForSubresources(
-      mojom::URLLoaderFactoryRequest request,
+      network::mojom::URLLoaderFactoryRequest request,
       int process_id,
-      mojom::URLLoaderFactoryPtrInfo original_factory);
+      network::mojom::URLLoaderFactoryPtrInfo original_factory);
 
   // Callback on IO thread whenever a URLLoaderFactoryGetter::GetNetworkContext
   // is called on an object that doesn't have a test factory set up.
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
index 7349e170..f19f139 100644
--- a/content/renderer/BUILD.gn
+++ b/content/renderer/BUILD.gn
@@ -403,6 +403,8 @@
     "renderer_webcookiejar_impl.h",
     "resizing_mode_selector.cc",
     "resizing_mode_selector.h",
+    "resource_timing_info_conversions.cc",
+    "resource_timing_info_conversions.h",
     "sad_plugin.cc",
     "sad_plugin.h",
     "savable_resources.cc",
diff --git a/content/renderer/appcache/appcache_dispatcher.cc b/content/renderer/appcache/appcache_dispatcher.cc
index a112e36..50594cf 100644
--- a/content/renderer/appcache/appcache_dispatcher.cc
+++ b/content/renderer/appcache/appcache_dispatcher.cc
@@ -61,7 +61,7 @@
 
 void AppCacheDispatcher::SetSubresourceFactory(
     int32_t host_id,
-    mojom::URLLoaderFactoryPtr url_loader_factory) {
+    network::mojom::URLLoaderFactoryPtr url_loader_factory) {
   frontend_->OnSetSubresourceFactory(host_id, std::move(url_loader_factory));
 }
 
diff --git a/content/renderer/appcache/appcache_dispatcher.h b/content/renderer/appcache/appcache_dispatcher.h
index b659ae9..d864f3f 100644
--- a/content/renderer/appcache/appcache_dispatcher.h
+++ b/content/renderer/appcache/appcache_dispatcher.h
@@ -50,7 +50,7 @@
   void ContentBlocked(int32_t host_id, const GURL& manifest_url) override;
   void SetSubresourceFactory(
       int32_t host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) override;
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override;
 
   AppCacheBackendProxy backend_proxy_;
   std::unique_ptr<content::AppCacheFrontend> frontend_;
diff --git a/content/renderer/appcache/appcache_frontend_impl.cc b/content/renderer/appcache/appcache_frontend_impl.cc
index 300588e..09b60975 100644
--- a/content/renderer/appcache/appcache_frontend_impl.cc
+++ b/content/renderer/appcache/appcache_frontend_impl.cc
@@ -91,7 +91,7 @@
 
 void AppCacheFrontendImpl::OnSetSubresourceFactory(
     int host_id,
-    mojom::URLLoaderFactoryPtr url_loader_factory) {
+    network::mojom::URLLoaderFactoryPtr url_loader_factory) {
   WebApplicationCacheHostImpl* host = GetHost(host_id);
   if (host)
     host->SetSubresourceFactory(std::move(url_loader_factory));
diff --git a/content/renderer/appcache/appcache_frontend_impl.h b/content/renderer/appcache/appcache_frontend_impl.h
index a5e9b28..e8adfc02 100644
--- a/content/renderer/appcache/appcache_frontend_impl.h
+++ b/content/renderer/appcache/appcache_frontend_impl.h
@@ -28,7 +28,7 @@
   void OnContentBlocked(int host_id, const GURL& manifest_url) override;
   void OnSetSubresourceFactory(
       int host_id,
-      mojom::URLLoaderFactoryPtr url_loader_factory) override;
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override;
 };
 
 }  // namespace content
diff --git a/content/renderer/appcache/web_application_cache_host_impl.h b/content/renderer/appcache/web_application_cache_host_impl.h
index c37ca73..9c604b58 100644
--- a/content/renderer/appcache/web_application_cache_host_impl.h
+++ b/content/renderer/appcache/web_application_cache_host_impl.h
@@ -59,7 +59,7 @@
 
   // Set the URLLoaderFactory instance to be used for subresource requests.
   virtual void SetSubresourceFactory(
-      mojom::URLLoaderFactoryPtr url_loader_factory) {}
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) {}
 
  private:
   enum IsNewMasterEntry { MAYBE_NEW_ENTRY, NEW_ENTRY, OLD_ENTRY };
diff --git a/content/renderer/fetchers/resource_fetcher_impl.cc b/content/renderer/fetchers/resource_fetcher_impl.cc
index b2f5d45..1012e9b 100644
--- a/content/renderer/fetchers/resource_fetcher_impl.cc
+++ b/content/renderer/fetchers/resource_fetcher_impl.cc
@@ -45,7 +45,7 @@
 // TODO(toyoshim): Internal implementation might be replaced with
 // SimpleURLLoader, and content::ResourceFetcher could be a thin-wrapper
 // class to use SimpleURLLoader with blink-friendly types.
-class ResourceFetcherImpl::ClientImpl : public mojom::URLLoaderClient {
+class ResourceFetcherImpl::ClientImpl : public network::mojom::URLLoaderClient {
  public:
   ClientImpl(ResourceFetcherImpl* parent,
              Callback callback,
@@ -65,19 +65,19 @@
   }
 
   void Start(const network::ResourceRequest& request,
-             mojom::URLLoaderFactory* url_loader_factory,
+             network::mojom::URLLoaderFactory* url_loader_factory,
              const net::NetworkTrafficAnnotationTag& annotation_tag,
              scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
     status_ = Status::kStarted;
     response_.SetURL(request.url);
 
-    mojom::URLLoaderClientPtr client;
+    network::mojom::URLLoaderClientPtr client;
     client_binding_.Bind(mojo::MakeRequest(&client), std::move(task_runner));
 
     url_loader_factory->CreateLoaderAndStart(
         mojo::MakeRequest(&loader_), kRoutingId,
-        ResourceDispatcher::MakeRequestID(), mojom::kURLLoadOptionNone, request,
-        std::move(client),
+        ResourceDispatcher::MakeRequestID(), network::mojom::kURLLoadOptionNone,
+        request, std::move(client),
         net::MutableNetworkTrafficAnnotationTag(annotation_tag));
   }
 
@@ -171,11 +171,11 @@
     ReadDataPipe();
   }
 
-  // mojom::URLLoaderClient overrides:
+  // network::mojom::URLLoaderClient overrides:
   void OnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     DCHECK_EQ(Status::kStarted, status_);
     // Existing callers need URL and HTTP status code. URL is already set in
     // Start().
@@ -226,11 +226,12 @@
 
  private:
   ResourceFetcherImpl* parent_;
-  mojom::URLLoaderPtr loader_;
-  mojo::Binding<mojom::URLLoaderClient> client_binding_;
+  network::mojom::URLLoaderPtr loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> client_binding_;
   mojo::ScopedDataPipeConsumerHandle data_pipe_;
   mojo::SimpleWatcher data_pipe_watcher_;
-  PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory> loader_factory_;
+  PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>
+      loader_factory_;
 
   Status status_;
 
@@ -288,7 +289,7 @@
 void ResourceFetcherImpl::Start(
     blink::WebLocalFrame* frame,
     blink::WebURLRequest::RequestContext request_context,
-    mojom::URLLoaderFactory* url_loader_factory,
+    network::mojom::URLLoaderFactory* url_loader_factory,
     const net::NetworkTrafficAnnotationTag& annotation_tag,
     Callback callback,
     size_t maximum_download_size) {
diff --git a/content/renderer/fetchers/resource_fetcher_impl.h b/content/renderer/fetchers/resource_fetcher_impl.h
index d9c7d08..936b3c7 100644
--- a/content/renderer/fetchers/resource_fetcher_impl.h
+++ b/content/renderer/fetchers/resource_fetcher_impl.h
@@ -12,10 +12,10 @@
 #include "base/macros.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/resource_fetcher.h"
 #include "net/http/http_request_headers.h"
 #include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
 
 class GURL;
@@ -34,7 +34,7 @@
   void SetHeader(const std::string& header, const std::string& value) override;
   void Start(blink::WebLocalFrame* frame,
              blink::WebURLRequest::RequestContext request_context,
-             mojom::URLLoaderFactory* url_loader_factory,
+             network::mojom::URLLoaderFactory* url_loader_factory,
              const net::NetworkTrafficAnnotationTag& annotation_tag,
              Callback callback,
              size_t maximum_download_size) override;
diff --git a/content/renderer/loader/child_url_loader_factory_getter_impl.cc b/content/renderer/loader/child_url_loader_factory_getter_impl.cc
index 0805624..9b636b0 100644
--- a/content/renderer/loader/child_url_loader_factory_getter_impl.cc
+++ b/content/renderer/loader/child_url_loader_factory_getter_impl.cc
@@ -11,8 +11,8 @@
 namespace content {
 
 ChildURLLoaderFactoryGetter::Info::Info(
-    mojom::URLLoaderFactoryPtrInfo network_loader_factory_info,
-    mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info)
+    network::mojom::URLLoaderFactoryPtrInfo network_loader_factory_info,
+    network::mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info)
     : network_loader_factory_info_(std::move(network_loader_factory_info)),
       blob_loader_factory_info_(std::move(blob_loader_factory_info)) {}
 
@@ -26,8 +26,8 @@
 scoped_refptr<ChildURLLoaderFactoryGetter>
 ChildURLLoaderFactoryGetter::Info::Bind() {
   DCHECK(network_loader_factory_info_.is_valid());
-  mojom::URLLoaderFactoryPtr network_loader_factory;
-  mojom::URLLoaderFactoryPtr blob_loader_factory;
+  network::mojom::URLLoaderFactoryPtr network_loader_factory;
+  network::mojom::URLLoaderFactoryPtr blob_loader_factory;
   network_loader_factory.Bind(std::move(network_loader_factory_info_));
   blob_loader_factory.Bind(std::move(blob_loader_factory_info_));
   return base::MakeRefCounted<ChildURLLoaderFactoryGetterImpl>(
@@ -50,20 +50,21 @@
 
 ChildURLLoaderFactoryGetterImpl::Info
 ChildURLLoaderFactoryGetterImpl::GetClonedInfo() {
-  mojom::URLLoaderFactoryPtrInfo network_loader_factory_info;
+  network::mojom::URLLoaderFactoryPtrInfo network_loader_factory_info;
   GetNetworkLoaderFactory()->Clone(
       mojo::MakeRequest(&network_loader_factory_info));
 
-  mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info;
+  network::mojom::URLLoaderFactoryPtrInfo blob_loader_factory_info;
   GetBlobLoaderFactory()->Clone(mojo::MakeRequest(&blob_loader_factory_info));
 
   return Info(std::move(network_loader_factory_info),
               std::move(blob_loader_factory_info));
 }
 
-mojom::URLLoaderFactory* ChildURLLoaderFactoryGetterImpl::GetFactoryForURL(
+network::mojom::URLLoaderFactory*
+ChildURLLoaderFactoryGetterImpl::GetFactoryForURL(
     const GURL& url,
-    mojom::URLLoaderFactory* default_factory) {
+    network::mojom::URLLoaderFactory* default_factory) {
   if (base::FeatureList::IsEnabled(features::kNetworkService) &&
       url.SchemeIsBlob()) {
     return GetBlobLoaderFactory();
@@ -73,12 +74,12 @@
   return GetNetworkLoaderFactory();
 }
 
-mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 ChildURLLoaderFactoryGetterImpl::GetNetworkLoaderFactory() {
   return network_loader_factory_.get();
 }
 
-mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 ChildURLLoaderFactoryGetterImpl::GetBlobLoaderFactory() {
   if (!blob_loader_factory_) {
     if (blob_loader_factory_getter_.is_null()) {
diff --git a/content/renderer/loader/child_url_loader_factory_getter_impl.h b/content/renderer/loader/child_url_loader_factory_getter_impl.h
index 52bc4bcb..5d2e73a 100644
--- a/content/renderer/loader/child_url_loader_factory_getter_impl.h
+++ b/content/renderer/loader/child_url_loader_factory_getter_impl.h
@@ -8,8 +8,8 @@
 #include "base/callback.h"
 #include "content/common/content_export.h"
 #include "content/common/possibly_associated_interface_ptr.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/child_url_loader_factory_getter.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -17,9 +17,9 @@
     : public ChildURLLoaderFactoryGetter {
  public:
   using PossiblyAssociatedURLLoaderFactory =
-      PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory>;
+      PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>;
   using URLLoaderFactoryGetterCallback =
-      base::OnceCallback<mojom::URLLoaderFactoryPtr()>;
+      base::OnceCallback<network::mojom::URLLoaderFactoryPtr()>;
 
   ChildURLLoaderFactoryGetterImpl();
 
@@ -33,11 +33,11 @@
 
   Info GetClonedInfo() override;
 
-  mojom::URLLoaderFactory* GetFactoryForURL(
+  network::mojom::URLLoaderFactory* GetFactoryForURL(
       const GURL& url,
-      mojom::URLLoaderFactory* default_factory) override;
-  mojom::URLLoaderFactory* GetNetworkLoaderFactory() override;
-  mojom::URLLoaderFactory* GetBlobLoaderFactory() override;
+      network::mojom::URLLoaderFactory* default_factory) override;
+  network::mojom::URLLoaderFactory* GetNetworkLoaderFactory() override;
+  network::mojom::URLLoaderFactory* GetBlobLoaderFactory() override;
 
  private:
   ~ChildURLLoaderFactoryGetterImpl() override;
diff --git a/content/renderer/loader/cors_url_loader.cc b/content/renderer/loader/cors_url_loader.cc
index 2a91c95..10dcfed 100644
--- a/content/renderer/loader/cors_url_loader.cc
+++ b/content/renderer/loader/cors_url_loader.cc
@@ -50,9 +50,9 @@
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& resource_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
-    mojom::URLLoaderFactory* network_loader_factory)
+    network::mojom::URLLoaderFactory* network_loader_factory)
     : network_loader_factory_(network_loader_factory),
       network_client_binding_(this),
       forwarding_client_(std::move(client)),
@@ -74,7 +74,7 @@
   // TODO(toyoshim): Needs some checks if the calculated fetch_cors_flag_
   // is allowed in this request or not.
 
-  mojom::URLLoaderClientPtr network_client;
+  network::mojom::URLLoaderClientPtr network_client;
   network_client_binding_.Bind(mojo::MakeRequest(&network_client));
   // Binding |this| as an unretained pointer is safe because
   // |network_client_binding_| shares this object's lifetime.
@@ -122,7 +122,7 @@
 void CORSURLLoader::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   DCHECK(network_loader_);
   DCHECK(forwarding_client_);
   DCHECK(!is_waiting_follow_redirect_call_);
@@ -217,10 +217,10 @@
 
 void CORSURLLoader::OnUpstreamConnectionError() {
   // |network_client_binding_| has experienced a connection error and will no
-  // longer call any of the mojom::URLLoaderClient methods above. The client
-  // pipe to the downstream client is closed to inform it of this failure. The
-  // client should respond by closing its mojom::URLLoader pipe which will cause
-  // this object to be destroyed.
+  // longer call any of the network::mojom::URLLoaderClient methods above. The
+  // client pipe to the downstream client is closed to inform it of this
+  // failure. The client should respond by closing its network::mojom::URLLoader
+  // pipe which will cause this object to be destroyed.
   forwarding_client_.reset();
 }
 
diff --git a/content/renderer/loader/cors_url_loader.h b/content/renderer/loader/cors_url_loader.h
index 2e64d4e..7eb94d4 100644
--- a/content/renderer/loader/cors_url_loader.h
+++ b/content/renderer/loader/cors_url_loader.h
@@ -5,10 +5,11 @@
 #ifndef CONTENT_RENDERER_LOADER_CORS_URL_LOADER_H_
 #define CONTENT_RENDERER_LOADER_CORS_URL_LOADER_H_
 
-#include "content/public/common/url_loader_factory.mojom.h"
+#include "content/common/content_export.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "services/network/public/interfaces/fetch_api.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "url/gurl.h"
 #include "url/origin.h"
 
@@ -19,8 +20,8 @@
 // well as potential preflight requests to the supplied
 // |network_loader_factory|. It is owned by the CORSURLLoaderFactory that
 // created it.
-class CONTENT_EXPORT CORSURLLoader : public mojom::URLLoader,
-                                     public mojom::URLLoaderClient {
+class CONTENT_EXPORT CORSURLLoader : public network::mojom::URLLoader,
+                                     public network::mojom::URLLoaderClient {
  public:
   // Assumes network_loader_factory outlives this loader.
   CORSURLLoader(
@@ -28,13 +29,13 @@
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& resource_request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
-      mojom::URLLoaderFactory* network_loader_factory);
+      network::mojom::URLLoaderFactory* network_loader_factory);
 
   ~CORSURLLoader() override;
 
-  // mojom::URLLoader overrides:
+  // network::mojom::URLLoader overrides:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -42,10 +43,11 @@
   void PauseReadingBodyFromNet() override;
   void ResumeReadingBodyFromNet() override;
 
-  // mojom::URLLoaderClient overrides:
-  void OnReceiveResponse(const network::ResourceResponseHead& head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  // network::mojom::URLLoaderClient overrides:
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
                          const network::ResourceResponseHead& head) override;
   void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override;
@@ -68,14 +70,14 @@
 
   // This raw URLLoaderFactory pointer is shared with the CORSURLLoaderFactory
   // that created and owns this object.
-  mojom::URLLoaderFactory* network_loader_factory_;
+  network::mojom::URLLoaderFactory* network_loader_factory_;
 
   // For the actual request.
-  mojom::URLLoaderPtr network_loader_;
-  mojo::Binding<mojom::URLLoaderClient> network_client_binding_;
+  network::mojom::URLLoaderPtr network_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> network_client_binding_;
 
   // To be a URLLoader for the client.
-  mojom::URLLoaderClientPtr forwarding_client_;
+  network::mojom::URLLoaderClientPtr forwarding_client_;
 
   // Request initiator's origin.
   url::Origin security_origin_;
diff --git a/content/renderer/loader/cors_url_loader_factory.cc b/content/renderer/loader/cors_url_loader_factory.cc
index 84b3aa12..53815d3 100644
--- a/content/renderer/loader/cors_url_loader_factory.cc
+++ b/content/renderer/loader/cors_url_loader_factory.cc
@@ -4,16 +4,16 @@
 
 #include "content/renderer/loader/cors_url_loader_factory.h"
 
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/renderer/loader/cors_url_loader.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
 void CORSURLLoaderFactory::CreateAndBind(
-    PossiblyAssociatedInterfacePtrInfo<mojom::URLLoaderFactory>
+    PossiblyAssociatedInterfacePtrInfo<network::mojom::URLLoaderFactory>
         network_loader_factory,
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   DCHECK(network_loader_factory);
 
   // This object will be destroyed when all pipes bound to it are closed.
@@ -23,7 +23,7 @@
 }
 
 CORSURLLoaderFactory::CORSURLLoaderFactory(
-    PossiblyAssociatedInterfacePtrInfo<mojom::URLLoaderFactory>
+    PossiblyAssociatedInterfacePtrInfo<network::mojom::URLLoaderFactory>
         network_loader_factory) {
   // Binding |this| as an unretained pointer is safe because |bindings_| shares
   // this object's lifetime.
@@ -38,12 +38,12 @@
 CORSURLLoaderFactory::~CORSURLLoaderFactory() {}
 
 void CORSURLLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& resource_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   // Instances of CORSURLLoader are owned by this class and their pipe so that
   // they can share |network_loader_factory_|.
@@ -54,7 +54,8 @@
       std::move(request));
 }
 
-void CORSURLLoaderFactory::Clone(mojom::URLLoaderFactoryRequest request) {
+void CORSURLLoaderFactory::Clone(
+    network::mojom::URLLoaderFactoryRequest request) {
   bindings_.AddBinding(this, std::move(request));
 }
 
diff --git a/content/renderer/loader/cors_url_loader_factory.h b/content/renderer/loader/cors_url_loader_factory.h
index ce78469..2816a386 100644
--- a/content/renderer/loader/cors_url_loader_factory.h
+++ b/content/renderer/loader/cors_url_loader_factory.h
@@ -8,9 +8,9 @@
 #include "content/common/content_export.h"
 #include "content/common/possibly_associated_interface_ptr.h"
 #include "content/common/possibly_associated_interface_ptr_info.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/bindings/strong_binding_set.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -19,39 +19,41 @@
 // preflight requests to the supplied |network_loader_factory|. Its lifetime is
 // bound to that of the pipes connected to it and the CORSURLLoader instances it
 // creates.
-class CONTENT_EXPORT CORSURLLoaderFactory : public mojom::URLLoaderFactory {
+class CONTENT_EXPORT CORSURLLoaderFactory
+    : public network::mojom::URLLoaderFactory {
  public:
-  static void CreateAndBind(PossiblyAssociatedInterfacePtrInfo<
-                                mojom::URLLoaderFactory> network_loader_factory,
-                            mojom::URLLoaderFactoryRequest request);
+  static void CreateAndBind(
+      PossiblyAssociatedInterfacePtrInfo<network::mojom::URLLoaderFactory>
+          network_loader_factory,
+      network::mojom::URLLoaderFactoryRequest request);
 
   explicit CORSURLLoaderFactory(
-      PossiblyAssociatedInterfacePtrInfo<mojom::URLLoaderFactory>
+      PossiblyAssociatedInterfacePtrInfo<network::mojom::URLLoaderFactory>
           network_loader_factory);
   ~CORSURLLoaderFactory() override;
 
-  // mojom::URLLoaderFactory
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& resource_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
   void OnConnectionError();
 
  private:
-  PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory>
+  PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>
       network_loader_factory_;
 
   // The factory owns the CORSURLLoaders it creates so that they can share
   // |network_loader_factory_|.
-  mojo::StrongBindingSet<mojom::URLLoader> loader_bindings_;
+  mojo::StrongBindingSet<network::mojom::URLLoader> loader_bindings_;
 
-  mojo::BindingSet<mojom::URLLoaderFactory> bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
 };
 
 }  // namespace content
diff --git a/content/renderer/loader/cors_url_loader_unittest.cc b/content/renderer/loader/cors_url_loader_unittest.cc
index 96d04dd..8b54ee8 100644
--- a/content/renderer/loader/cors_url_loader_unittest.cc
+++ b/content/renderer/loader/cors_url_loader_unittest.cc
@@ -10,12 +10,12 @@
 #include "base/run_loop.h"
 #include "content/public/common/request_context_type.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/test/test_url_loader_client.h"
 #include "content/renderer/loader/cors_url_loader_factory.h"
 #include "net/http/http_request_headers.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using network::mojom::FetchRequestMode;
@@ -23,7 +23,7 @@
 namespace content {
 namespace {
 
-class TestURLLoaderFactory : public mojom::URLLoaderFactory {
+class TestURLLoaderFactory : public network::mojom::URLLoaderFactory {
  public:
   TestURLLoaderFactory() = default;
   ~TestURLLoaderFactory() override = default;
@@ -49,22 +49,24 @@
   bool IsCreateLoaderAndStartCalled() { return !!client_ptr_; }
 
  private:
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     DCHECK(client);
     client_ptr_ = std::move(client);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
-  mojom::URLLoaderClientPtr client_ptr_;
+  network::mojom::URLLoaderClientPtr client_ptr_;
 
   DISALLOW_COPY_AND_ASSIGN(TestURLLoaderFactory);
 };
@@ -78,10 +80,10 @@
   void CreateLoaderAndStart(const GURL& origin,
                             const GURL& url,
                             FetchRequestMode fetch_request_mode) {
-    mojom::URLLoaderFactoryPtr network_factory_ptr;
+    network::mojom::URLLoaderFactoryPtr network_factory_ptr;
     test_network_factory_binding_.Bind(mojo::MakeRequest(&network_factory_ptr));
 
-    mojom::URLLoaderFactoryPtr loader_factory_ptr;
+    network::mojom::URLLoaderFactoryPtr loader_factory_ptr;
     CORSURLLoaderFactory::CreateAndBind(network_factory_ptr.PassInterface(),
                                         mojo::MakeRequest(&loader_factory_ptr));
 
@@ -95,7 +97,7 @@
 
     loader_factory_ptr->CreateLoaderAndStart(
         mojo::MakeRequest(&url_loader_), 0 /* routing_id */, 0 /* request_id */,
-        mojom::kURLLoadOptionNone, request,
+        network::mojom::kURLLoadOptionNone, request,
         test_cors_loader_client_.CreateInterfacePtr(),
         net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
 
@@ -127,10 +129,10 @@
 
   // TestURLLoaderFactory instance and mojo binding.
   TestURLLoaderFactory test_network_loader_factory_;
-  mojo::Binding<mojom::URLLoaderFactory> test_network_factory_binding_;
+  mojo::Binding<network::mojom::URLLoaderFactory> test_network_factory_binding_;
 
   // Holds URLLoaderPtr that CreateLoaderAndStart() creates.
-  mojom::URLLoaderPtr url_loader_;
+  network::mojom::URLLoaderPtr url_loader_;
 
   // TestURLLoaderClient that records callback activities.
   TestURLLoaderClient test_cors_loader_client_;
diff --git a/content/renderer/loader/resource_dispatcher.cc b/content/renderer/loader/resource_dispatcher.cc
index 1ddbb1a..16f8c1d 100644
--- a/content/renderer/loader/resource_dispatcher.cc
+++ b/content/renderer/loader/resource_dispatcher.cc
@@ -415,7 +415,7 @@
     std::unique_ptr<RequestPeer> peer,
     scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
     std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
   CheckSchemeForReferrerPolicy(*request);
 
   // Compute a unique request_id for this renderer process.
@@ -441,16 +441,16 @@
   std::unique_ptr<URLLoaderClientImpl> client(
       new URLLoaderClientImpl(request_id, this, loading_task_runner));
 
-  uint32_t options = mojom::kURLLoadOptionNone;
+  uint32_t options = network::mojom::kURLLoadOptionNone;
   // TODO(jam): use this flag for ResourceDispatcherHost code path once
   // MojoLoading is the only IPC code path.
   if (base::FeatureList::IsEnabled(features::kNetworkService) &&
       request->fetch_request_context_type != REQUEST_CONTEXT_TYPE_FETCH) {
     // MIME sniffing should be disabled for a request initiated by fetch().
-    options |= mojom::kURLLoadOptionSniffMimeType;
+    options |= network::mojom::kURLLoadOptionSniffMimeType;
   }
   if (is_sync) {
-    options |= mojom::kURLLoadOptionSynchronous;
+    options |= network::mojom::kURLLoadOptionSynchronous;
     request->load_flags |= net::LOAD_IGNORE_LIMITS;
   }
 
@@ -522,7 +522,7 @@
 
 void ResourceDispatcher::ContinueForNavigation(
     int request_id,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) {
   DCHECK(url_loader_client_endpoints);
   PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
   if (!request_info)
@@ -535,7 +535,7 @@
   // pull the StreamOverride's one in
   // WebURLLoaderImpl::Context::OnReceivedResponse.
   client_ptr->OnReceiveResponse(network::ResourceResponseHead(), base::nullopt,
-                                mojom::DownloadedTempFilePtr());
+                                network::mojom::DownloadedTempFilePtr());
   // TODO(clamy): Move the replaying of redirects from WebURLLoaderImpl here.
 
   // Abort if the request is cancelled.
diff --git a/content/renderer/loader/resource_dispatcher.h b/content/renderer/loader/resource_dispatcher.h
index c987971..d287525 100644
--- a/content/renderer/loader/resource_dispatcher.h
+++ b/content/renderer/loader/resource_dispatcher.h
@@ -24,11 +24,11 @@
 #include "content/common/content_export.h"
 #include "content/public/common/resource_type.h"
 #include "content/public/common/shared_url_loader_factory.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "content/public/common/url_loader_throttle.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "net/base/request_priority.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
 #include "url/gurl.h"
 #include "url/origin.h"
@@ -42,6 +42,9 @@
 struct ResourceRequest;
 struct ResourceResponseHead;
 struct URLLoaderCompletionStatus;
+namespace mojom {
+class URLLoaderFactory;
+}
 }
 
 namespace content {
@@ -108,7 +111,7 @@
       std::unique_ptr<RequestPeer> peer,
       scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
       std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
 
   // Removes a request from the |pending_requests_| list, returning true if the
   // request was found and removed.
@@ -223,7 +226,7 @@
 
   void ContinueForNavigation(
       int request_id,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
 
   // All pending requests issued to the host
   PendingRequestMap pending_requests_;
diff --git a/content/renderer/loader/resource_dispatcher_unittest.cc b/content/renderer/loader/resource_dispatcher_unittest.cc
index eeafe794..a90fa944 100644
--- a/content/renderer/loader/resource_dispatcher_unittest.cc
+++ b/content/renderer/loader/resource_dispatcher_unittest.cc
@@ -55,7 +55,7 @@
 
 // Sets up the message sender override for the unit test.
 class ResourceDispatcherTest : public testing::Test,
-                               public mojom::URLLoaderFactory {
+                               public network::mojom::URLLoaderFactory {
  public:
   ResourceDispatcherTest()
       : dispatcher_(new ResourceDispatcher(message_loop_.task_runner())) {}
@@ -66,19 +66,21 @@
   }
 
   void CreateLoaderAndStart(
-      mojom::URLLoaderRequest request,
+      network::mojom::URLLoaderRequest request,
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& url_request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::MutableNetworkTrafficAnnotationTag& annotation) override {
     loader_and_clients_.emplace_back(std::move(request), std::move(client));
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
-  void CallOnReceiveResponse(mojom::URLLoaderClient* client) {
+  void CallOnReceiveResponse(network::mojom::URLLoaderClient* client) {
     network::ResourceResponseHead head;
     std::string raw_headers(kTestPageHeaders);
     std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0');
@@ -120,13 +122,14 @@
         TRAFFIC_ANNOTATION_FOR_TESTS, false, std::move(peer),
         base::MakeRefCounted<WeakWrapperSharedURLLoaderFactory>(this),
         std::vector<std::unique_ptr<URLLoaderThrottle>>(),
-        mojom::URLLoaderClientEndpointsPtr());
+        network::mojom::URLLoaderClientEndpointsPtr());
     peer_context->request_id = request_id;
     return request_id;
   }
 
  protected:
-  std::vector<std::pair<mojom::URLLoaderRequest, mojom::URLLoaderClientPtr>>
+  std::vector<std::pair<network::mojom::URLLoaderRequest,
+                        network::mojom::URLLoaderClientPtr>>
       loader_and_clients_;
   base::MessageLoop message_loop_;
   std::unique_ptr<ResourceDispatcher> dispatcher_;
@@ -214,7 +217,8 @@
   StartAsync(std::move(request), nullptr, &peer_context);
 
   ASSERT_EQ(1u, loader_and_clients_.size());
-  mojom::URLLoaderClientPtr client = std::move(loader_and_clients_[0].second);
+  network::mojom::URLLoaderClientPtr client =
+      std::move(loader_and_clients_[0].second);
   loader_and_clients_.clear();
 
   // Set the delegate that inserts a new peer in OnReceivedResponse.
@@ -261,7 +265,8 @@
   peer_context.cancel_on_receive_response = true;
 
   ASSERT_EQ(1u, loader_and_clients_.size());
-  mojom::URLLoaderClientPtr client = std::move(loader_and_clients_[0].second);
+  network::mojom::URLLoaderClientPtr client =
+      std::move(loader_and_clients_[0].second);
   loader_and_clients_.clear();
 
   // Set the delegate that inserts a new peer in OnReceivedResponse.
diff --git a/content/renderer/loader/sync_load_context.cc b/content/renderer/loader/sync_load_context.cc
index d6c259f..5df463c 100644
--- a/content/renderer/loader/sync_load_context.cc
+++ b/content/renderer/loader/sync_load_context.cc
@@ -35,7 +35,7 @@
       std::move(request), routing_id, std::move(loading_task_runner),
       frame_origin, traffic_annotation, true /* is_sync */,
       base::WrapUnique(context), context->url_loader_factory_,
-      std::move(throttles), mojom::URLLoaderClientEndpointsPtr());
+      std::move(throttles), network::mojom::URLLoaderClientEndpointsPtr());
 }
 
 SyncLoadContext::SyncLoadContext(
diff --git a/content/renderer/loader/url_loader_client_impl.cc b/content/renderer/loader/url_loader_client_impl.cc
index 592a536e..71c67f8 100644
--- a/content/renderer/loader/url_loader_client_impl.cc
+++ b/content/renderer/loader/url_loader_client_impl.cc
@@ -223,7 +223,8 @@
   }
 }
 
-void URLLoaderClientImpl::Bind(mojom::URLLoaderClientEndpointsPtr endpoints) {
+void URLLoaderClientImpl::Bind(
+    network::mojom::URLLoaderClientEndpointsPtr endpoints) {
   url_loader_.Bind(std::move(endpoints->url_loader));
   url_loader_client_binding_.Bind(std::move(endpoints->url_loader_client));
   url_loader_client_binding_.set_connection_error_handler(base::BindOnce(
@@ -233,7 +234,7 @@
 void URLLoaderClientImpl::OnReceiveResponse(
     const network::ResourceResponseHead& response_head,
     const base::Optional<net::SSLInfo>& ssl_info,
-    mojom::DownloadedTempFilePtr downloaded_file) {
+    network::mojom::DownloadedTempFilePtr downloaded_file) {
   has_received_response_ = true;
   downloaded_file_ = std::move(downloaded_file);
   if (NeedsStoringMessage()) {
diff --git a/content/renderer/loader/url_loader_client_impl.h b/content/renderer/loader/url_loader_client_impl.h
index 59926bb..676c6d3 100644
--- a/content/renderer/loader/url_loader_client_impl.h
+++ b/content/renderer/loader/url_loader_client_impl.h
@@ -11,9 +11,9 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/data_pipe.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace base {
 class SingleThreadTaskRunner;
@@ -32,7 +32,8 @@
 class ResourceDispatcher;
 class URLResponseBodyConsumer;
 
-class CONTENT_EXPORT URLLoaderClientImpl final : public mojom::URLLoaderClient {
+class CONTENT_EXPORT URLLoaderClientImpl final
+    : public network::mojom::URLLoaderClient {
  public:
   URLLoaderClientImpl(int request_id,
                       ResourceDispatcher* resource_dispatcher,
@@ -55,12 +56,14 @@
   // is enabled. Otherwise (in regular subresource loading cases) |this| is not
   // bound to a client request, but used via ThrottlingURLLoader to get client
   // upcalls from the loader.
-  void Bind(mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
+  void Bind(
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints);
 
-  // mojom::URLLoaderClient implementation
-  void OnReceiveResponse(const network::ResourceResponseHead& response_head,
-                         const base::Optional<net::SSLInfo>& ssl_info,
-                         mojom::DownloadedTempFilePtr downloaded_file) override;
+  // network::mojom::URLLoaderClient implementation
+  void OnReceiveResponse(
+      const network::ResourceResponseHead& response_head,
+      const base::Optional<net::SSLInfo>& ssl_info,
+      network::mojom::DownloadedTempFilePtr downloaded_file) override;
   void OnReceiveRedirect(
       const net::RedirectInfo& redirect_info,
       const network::ResourceResponseHead& response_head) override;
@@ -88,7 +91,7 @@
   void OnConnectionClosed();
 
   scoped_refptr<URLResponseBodyConsumer> body_consumer_;
-  mojom::DownloadedTempFilePtr downloaded_file_;
+  network::mojom::DownloadedTempFilePtr downloaded_file_;
   std::vector<std::unique_ptr<DeferredMessage>> deferred_messages_;
   const int request_id_;
   bool has_received_response_ = false;
@@ -99,8 +102,8 @@
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
 
   // Used in NavigationMojoResponse and NetworkService.
-  mojom::URLLoaderPtr url_loader_;
-  mojo::Binding<mojom::URLLoaderClient> url_loader_client_binding_;
+  network::mojom::URLLoaderPtr url_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> url_loader_client_binding_;
 
   base::WeakPtrFactory<URLLoaderClientImpl> weak_factory_;
 };
diff --git a/content/renderer/loader/url_loader_client_impl_unittest.cc b/content/renderer/loader/url_loader_client_impl_unittest.cc
index 4a411b8..8b952c3 100644
--- a/content/renderer/loader/url_loader_client_impl_unittest.cc
+++ b/content/renderer/loader/url_loader_client_impl_unittest.cc
@@ -9,20 +9,20 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "content/common/weak_wrapper_shared_url_loader_factory.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/renderer/loader/resource_dispatcher.h"
 #include "content/renderer/loader/test_request_peer.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/bindings/interface_ptr.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
 #include "net/url_request/redirect_info.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_test_support.h"
 
 namespace content {
 
 class URLLoaderClientImplTest : public ::testing::Test,
-                                public mojom::URLLoaderFactory {
+                                public network::mojom::URLLoaderFactory {
  protected:
   URLLoaderClientImplTest()
       : dispatcher_(new ResourceDispatcher(message_loop_.task_runner())) {
@@ -34,7 +34,7 @@
                                           &request_peer_context_),
         base::MakeRefCounted<WeakWrapperSharedURLLoaderFactory>(this),
         std::vector<std::unique_ptr<URLLoaderThrottle>>(),
-        mojom::URLLoaderClientEndpointsPtr());
+        network::mojom::URLLoaderClientEndpointsPtr());
     request_peer_context_.request_id = request_id_;
 
     base::RunLoop().RunUntilIdle();
@@ -45,18 +45,20 @@
     url_loader_client_ = nullptr;
   }
 
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     url_loader_client_ = std::move(client);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
   static MojoCreateDataPipeOptions DataPipeOptions() {
     MojoCreateDataPipeOptions options;
@@ -71,7 +73,7 @@
   std::unique_ptr<ResourceDispatcher> dispatcher_;
   TestRequestPeer::Context request_peer_context_;
   int request_id_ = 0;
-  mojom::URLLoaderClientPtr url_loader_client_;
+  network::mojom::URLLoaderClientPtr url_loader_client_;
 };
 
 TEST_F(URLLoaderClientImplTest, OnReceiveResponse) {
diff --git a/content/renderer/loader/url_response_body_consumer.h b/content/renderer/loader/url_response_body_consumer.h
index d99d257..6f27081 100644
--- a/content/renderer/loader/url_response_body_consumer.h
+++ b/content/renderer/loader/url_response_body_consumer.h
@@ -16,9 +16,9 @@
 #include "base/memory/weak_ptr.h"
 #include "base/single_thread_task_runner.h"
 #include "content/common/content_export.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "mojo/public/cpp/system/simple_watcher.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 
 namespace network {
 struct URLLoaderCompletionStatus;
diff --git a/content/renderer/loader/url_response_body_consumer_unittest.cc b/content/renderer/loader/url_response_body_consumer_unittest.cc
index db1ce27..7fb870ea 100644
--- a/content/renderer/loader/url_response_body_consumer_unittest.cc
+++ b/content/renderer/loader/url_response_body_consumer_unittest.cc
@@ -95,22 +95,22 @@
   // we need a URLLoaderFactory to create a PendingRequestInfo. We don't need
   // a true URLLoaderFactory, so here we define a no-op (other than keeping
   // clients to avoid connection error notifications) factory.
-  class NoopURLLoaderFactory final : public mojom::URLLoaderFactory {
+  class NoopURLLoaderFactory final : public network::mojom::URLLoaderFactory {
    public:
-    void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+    void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                               int32_t routing_id,
                               int32_t request_id,
                               uint32_t options,
                               const network::ResourceRequest& url_request,
-                              mojom::URLLoaderClientPtr client,
+                              network::mojom::URLLoaderClientPtr client,
                               const net::MutableNetworkTrafficAnnotationTag&
                                   traffic_annotation) override {
       clients_.push_back(std::move(client));
     }
 
-    void Clone(mojom::URLLoaderFactoryRequest request) override {}
+    void Clone(network::mojom::URLLoaderFactoryRequest request) override {}
 
-    std::vector<mojom::URLLoaderClientPtr> clients_;
+    std::vector<network::mojom::URLLoaderClientPtr> clients_;
   };
 
   URLResponseBodyConsumerTest()
@@ -157,7 +157,7 @@
         std::make_unique<TestRequestPeer>(context, message_loop_.task_runner()),
         base::MakeRefCounted<WeakWrapperSharedURLLoaderFactory>(&factory_),
         std::vector<std::unique_ptr<URLLoaderThrottle>>(),
-        mojom::URLLoaderClientEndpointsPtr());
+        network::mojom::URLLoaderClientEndpointsPtr());
   }
 
   void Run(TestRequestPeer::Context* context) {
diff --git a/content/renderer/loader/web_url_loader_impl.cc b/content/renderer/loader/web_url_loader_impl.cc
index fa992e0..1d8e21b2 100644
--- a/content/renderer/loader/web_url_loader_impl.cc
+++ b/content/renderer/loader/web_url_loader_impl.cc
@@ -34,7 +34,6 @@
 #include "content/public/common/previews_state.h"
 #include "content/public/common/referrer.h"
 #include "content/public/common/service_worker_modes.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "content/public/renderer/child_url_loader_factory_getter.h"
 #include "content/public/renderer/fixed_received_data.h"
 #include "content/public/renderer/request_peer.h"
@@ -58,6 +57,7 @@
 #include "net/url_request/url_request_data_job.h"
 #include "services/network/public/cpp/resource_request.h"
 #include "services/network/public/interfaces/request_context_frame_type.mojom.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "third_party/WebKit/common/mime_util/mime_util.h"
 #include "third_party/WebKit/public/platform/FilePathConversion.h"
 #include "third_party/WebKit/public/platform/WebHTTPLoadInfo.h"
@@ -714,7 +714,7 @@
   // The renderer should request a stream which contains the body of the
   // response. If the Network Service or NavigationMojoResponse is enabled, the
   // URLLoaderClientEndpoints is used instead to get the body.
-  mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints;
+  network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints;
   if (stream_override_) {
     CHECK(IsBrowserSideNavigationEnabled());
     DCHECK(!sync_load_response);
diff --git a/content/renderer/loader/web_url_loader_impl.h b/content/renderer/loader/web_url_loader_impl.h
index 29e7bb91..a408937 100644
--- a/content/renderer/loader/web_url_loader_impl.h
+++ b/content/renderer/loader/web_url_loader_impl.h
@@ -13,10 +13,11 @@
 #include "content/common/content_export.h"
 #include "content/common/frame.mojom.h"
 #include "content/public/common/shared_url_loader_factory.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "net/url_request/redirect_info.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/public/platform/WebURLLoader.h"
 #include "third_party/WebKit/public/platform/WebURLLoaderFactory.h"
 #include "url/gurl.h"
@@ -41,7 +42,7 @@
   ~StreamOverrideParameters();
 
   GURL stream_url;
-  mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints;
+  network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints;
   network::ResourceResponseHead response;
   std::vector<GURL> redirects;
   std::vector<network::ResourceResponseInfo> redirect_responses;
diff --git a/content/renderer/loader/web_url_loader_impl_unittest.cc b/content/renderer/loader/web_url_loader_impl_unittest.cc
index 7c03b32e..2e2ff1d 100644
--- a/content/renderer/loader/web_url_loader_impl_unittest.cc
+++ b/content/renderer/loader/web_url_loader_impl_unittest.cc
@@ -92,7 +92,8 @@
       std::unique_ptr<RequestPeer> peer,
       scoped_refptr<SharedURLLoaderFactory> url_loader_factory,
       std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints) override {
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints)
+      override {
     EXPECT_FALSE(peer_);
     if (sync_load_response_.encoded_body_length != -1)
       EXPECT_TRUE(is_sync);
@@ -136,22 +137,24 @@
   DISALLOW_COPY_AND_ASSIGN(TestResourceDispatcher);
 };
 
-class FakeURLLoaderFactory final : public mojom::URLLoaderFactory {
+class FakeURLLoaderFactory final : public network::mojom::URLLoaderFactory {
  public:
   FakeURLLoaderFactory() = default;
   ~FakeURLLoaderFactory() override = default;
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     NOTREACHED();
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest request) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
+    NOTREACHED();
+  }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(FakeURLLoaderFactory);
diff --git a/content/renderer/media/rtc_peer_connection_handler.cc b/content/renderer/media/rtc_peer_connection_handler.cc
index f99ab9a..b8109b94 100644
--- a/content/renderer/media/rtc_peer_connection_handler.cc
+++ b/content/renderer/media/rtc_peer_connection_handler.cc
@@ -1116,17 +1116,26 @@
     // associated with multiple tracks (multiple receivers).
     for (auto& receiver_state : states.receiver_states) {
       for (auto& stream_ref : receiver_state.stream_refs) {
+        CHECK(!stream_ref->adapter().web_stream().IsNull());
+        CHECK(stream_ref->adapter().webrtc_stream());
         auto* stream_state =
             GetOrAddStreamStateForStream(*stream_ref, &stream_states);
-        stream_state->track_refs.push_back(receiver_state.track_ref->Copy());
+        auto track_ref = receiver_state.track_ref->Copy();
+        CHECK(!track_ref->web_track().IsNull());
+        CHECK(track_ref->webrtc_track());
+        stream_state->track_refs.push_back(std::move(track_ref));
       }
     }
     // The track of removed receivers do not belong to any stream. Make sure we
     // have a stream state for any streams belonging to receivers about to be
     // removed in case it was the last receiver referencing that stream.
-    for (auto* removed_receiver : removed_receivers)
-      for (auto& stream_ref : removed_receiver->StreamAdapterRefs())
+    for (auto* removed_receiver : removed_receivers) {
+      for (auto& stream_ref : removed_receiver->StreamAdapterRefs()) {
+        CHECK(!stream_ref->adapter().web_stream().IsNull());
+        CHECK(stream_ref->adapter().webrtc_stream());
         GetOrAddStreamStateForStream(*stream_ref, &stream_states);
+      }
+    }
     return stream_states;
   }
 
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 91efe4a3..7cc1540 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -135,6 +135,7 @@
 #include "content/renderer/render_widget_fullscreen_pepper.h"
 #include "content/renderer/renderer_blink_platform_impl.h"
 #include "content/renderer/renderer_webapplicationcachehost_impl.h"
+#include "content/renderer/resource_timing_info_conversions.h"
 #include "content/renderer/savable_resources.h"
 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
 #include "content/renderer/service_worker/service_worker_handle_reference.h"
@@ -1076,7 +1077,8 @@
     CompositorDependencies* compositor_deps,
     blink::WebFrame* opener,
     const base::UnguessableToken& devtools_frame_token,
-    const FrameReplicationState& replicated_state) {
+    const FrameReplicationState& replicated_state,
+    bool has_committed_real_load) {
   // A main frame RenderFrame must have a RenderWidget.
   DCHECK_NE(MSG_ROUTING_NONE, widget_routing_id);
 
@@ -1091,6 +1093,8 @@
       // WebString...
       WebString::FromUTF8(replicated_state.name),
       replicated_state.frame_policy.sandbox_flags);
+  if (has_committed_real_load)
+    web_frame->SetCommittedFirstRealLoad();
   render_frame->render_widget_ = RenderWidget::CreateForFrame(
       widget_routing_id, hidden, screen_info, compositor_deps, web_frame);
   // TODO(avi): This DCHECK is to track cleanup for https://crbug.com/545684
@@ -1113,7 +1117,8 @@
     const FrameReplicationState& replicated_state,
     CompositorDependencies* compositor_deps,
     const mojom::CreateFrameWidgetParams& widget_params,
-    const FrameOwnerProperties& frame_owner_properties) {
+    const FrameOwnerProperties& frame_owner_properties,
+    bool has_committed_real_load) {
   blink::WebLocalFrame* web_frame;
   RenderFrameImpl* render_frame;
   if (proxy_routing_id == MSG_ROUTING_NONE) {
@@ -1186,6 +1191,9 @@
         render_frame->render_view_->screen_info(), compositor_deps, web_frame);
   }
 
+  if (has_committed_real_load)
+    web_frame->SetCommittedFirstRealLoad();
+
   render_frame->Initialize();
 }
 
@@ -3060,7 +3068,7 @@
     const GURL& body_url,
     const CommonNavigationParams& common_params,
     const RequestNavigationParams& request_params,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     base::Optional<URLLoaderFactoryBundle> subresource_loader_factories,
     mojom::ControllerServiceWorkerInfoPtr controller_service_worker_info,
     const base::UnguessableToken& devtools_navigation_token) {
@@ -3114,13 +3122,6 @@
   GetContentClient()->SetActiveURL(
       common_params.url, frame_->Top()->GetSecurityOrigin().ToString().Utf8());
 
-  // If this frame is navigating cross-process, it may naively assume that this
-  // is the first navigation in the frame, but this may not actually be the
-  // case. Inform the frame's state machine if this frame has already committed
-  // other loads.
-  if (request_params.has_committed_real_load)
-    frame_->SetCommittedFirstRealLoad();
-
   // TODO(clamy): This may not be needed now that PlzNavigate has shipped.
   if (is_reload && current_history_item_.IsNull()) {
     // We cannot reload if we do not have any history state.  This happens, for
@@ -3330,13 +3331,6 @@
   if (subresource_loader_factories)
     subresource_loader_factories_ = std::move(subresource_loader_factories);
 
-  // If this frame is navigating cross-process, it may naively assume that this
-  // is the first navigation in the frame, but this may not actually be the
-  // case. Inform the frame's state machine if this frame has already committed
-  // other loads.
-  if (request_params.has_committed_real_load)
-    frame_->SetCommittedFirstRealLoad();
-
   pending_navigation_params_.reset(
       new NavigationParams(common_params, request_params));
 
@@ -4581,6 +4575,12 @@
       routing_id_, frame_->GetDocument().ThemeColor()));
 }
 
+void RenderFrameImpl::ForwardResourceTimingToParent(
+    const blink::WebResourceTimingInfo& info) {
+  Send(new FrameHostMsg_ForwardResourceTimingToParent(
+      routing_id_, WebResourceTimingInfoToResourceTimingInfo(info)));
+}
+
 void RenderFrameImpl::DispatchLoad() {
   Send(new FrameHostMsg_DispatchLoad(routing_id_));
 }
@@ -6438,7 +6438,7 @@
 WebURLRequest RenderFrameImpl::CreateURLRequestForCommit(
     const CommonNavigationParams& common_params,
     const RequestNavigationParams& request_params,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     const network::ResourceResponseHead& head,
     const GURL& body_url,
     bool is_same_document_navigation) {
@@ -6575,7 +6575,7 @@
 }
 
 void RenderFrameImpl::SetCustomURLLoaderFactory(
-    mojom::URLLoaderFactoryPtr factory) {
+    network::mojom::URLLoaderFactoryPtr factory) {
   if (base::FeatureList::IsEnabled(features::kNetworkService)) {
     // When the network service is enabled, all subresource loads go through
     // a factory from |subresource_loader_factories|. In this case we simply
@@ -7105,7 +7105,7 @@
   OnSetAccessibilityMode(new_mode);
 }
 
-mojom::URLLoaderFactory* RenderFrameImpl::GetURLLoaderFactory(
+network::mojom::URLLoaderFactory* RenderFrameImpl::GetURLLoaderFactory(
     const GURL& request_url) {
   if (base::FeatureList::IsEnabled(features::kNetworkService)) {
     return GetSubresourceLoaderFactories().GetFactoryForRequest(request_url);
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 53bd054e3..721c0d5b 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -49,7 +49,6 @@
 #include "content/public/common/renderer_preferences.h"
 #include "content/public/common/request_context_type.h"
 #include "content/public/common/stop_find_action.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/renderer/frame_blame_context.h"
 #include "content/renderer/input/input_target_client_impl.h"
@@ -64,6 +63,7 @@
 #include "mojo/public/cpp/bindings/binding_set.h"
 #include "mojo/public/cpp/system/data_pipe.h"
 #include "ppapi/features/features.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "services/service_manager/public/cpp/bind_source_info.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
 #include "services/service_manager/public/cpp/interface_provider.h"
@@ -204,7 +204,8 @@
       CompositorDependencies* compositor_deps,
       blink::WebFrame* opener,
       const base::UnguessableToken& devtools_frame_token,
-      const FrameReplicationState& replicated_state);
+      const FrameReplicationState& replicated_state,
+      bool has_committed_real_load);
 
   // Creates a new RenderFrame with |routing_id|.  If |proxy_routing_id| is
   // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
@@ -236,7 +237,8 @@
       const FrameReplicationState& replicated_state,
       CompositorDependencies* compositor_deps,
       const mojom::CreateFrameWidgetParams& params,
-      const FrameOwnerProperties& frame_owner_properties);
+      const FrameOwnerProperties& frame_owner_properties,
+      bool has_committed_real_load);
 
   // Returns the RenderFrameImpl for the given routing ID.
   static RenderFrameImpl* FromRoutingID(int routing_id);
@@ -496,7 +498,7 @@
       blink::TaskType task_type) override;
   int GetEnabledBindings() const override;
   void SetAccessibilityModeForTest(ui::AXMode new_mode) override;
-  mojom::URLLoaderFactory* GetURLLoaderFactory(
+  network::mojom::URLLoaderFactory* GetURLLoaderFactory(
       const GURL& request_url) override;
 
   // blink::mojom::EngagementClient implementation:
@@ -524,7 +526,7 @@
       const GURL& body_url,
       const CommonNavigationParams& common_params,
       const RequestNavigationParams& request_params,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       base::Optional<URLLoaderFactoryBundle> subresource_loaders,
       mojom::ControllerServiceWorkerInfoPtr controller_service_worker_info,
       const base::UnguessableToken& devtools_navigation_token) override;
@@ -647,6 +649,8 @@
                              bool content_initiated) override;
   void DidUpdateCurrentHistoryItem() override;
   void DidChangeThemeColor() override;
+  void ForwardResourceTimingToParent(
+      const blink::WebResourceTimingInfo& info) override;
   void DispatchLoad() override;
   blink::WebEffectiveConnectionType GetEffectiveConnectionType() override;
   void SetEffectiveConnectionTypeForTesting(
@@ -860,7 +864,7 @@
   void SyncSelectionIfRequired();
 
   // Sets the custom URLLoaderFactory instance to be used for network requests.
-  void SetCustomURLLoaderFactory(mojom::URLLoaderFactoryPtr factory);
+  void SetCustomURLLoaderFactory(network::mojom::URLLoaderFactoryPtr factory);
 
   void ScrollFocusedEditableElementIntoRect(const gfx::Rect& rect);
   void DidChangeVisibleViewport();
@@ -1101,7 +1105,7 @@
   blink::WebURLRequest CreateURLRequestForCommit(
       const CommonNavigationParams& common_params,
       const RequestNavigationParams& request_params,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       const network::ResourceResponseHead& head,
       const GURL& body_url,
       bool is_same_document_navigation);
@@ -1271,7 +1275,7 @@
   std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params>
   MakeDidCommitProvisionalLoadParams(blink::WebHistoryCommitType commit_type);
 
-  mojom::URLLoaderFactory* custom_url_loader_factory() {
+  network::mojom::URLLoaderFactory* custom_url_loader_factory() {
     return custom_url_loader_factory_.get();
   }
 
@@ -1590,7 +1594,7 @@
 
   // This frame might be given a custom default URLLoaderFactory (e.g.
   // for AppCache).
-  PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory>
+  PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>
       custom_url_loader_factory_;
 
   // Non-null if this frame is to be controlled by a service worker.
diff --git a/content/renderer/render_frame_impl_browsertest.cc b/content/renderer/render_frame_impl_browsertest.cc
index b346a292..485c8a0 100644
--- a/content/renderer/render_frame_impl_browsertest.cc
+++ b/content/renderer/render_frame_impl_browsertest.cc
@@ -96,7 +96,8 @@
         kSubframeRouteId, std::move(stub_interface_provider), MSG_ROUTING_NONE,
         MSG_ROUTING_NONE, kFrameProxyRouteId, MSG_ROUTING_NONE,
         base::UnguessableToken::Create(), frame_replication_state,
-        &compositor_deps_, widget_params, FrameOwnerProperties());
+        &compositor_deps_, widget_params, FrameOwnerProperties(),
+        /*has_committed_real_load=*/true);
 
     frame_ = static_cast<TestRenderFrame*>(
         RenderFrameImpl::FromRoutingID(kSubframeRouteId));
diff --git a/content/renderer/render_frame_proxy.cc b/content/renderer/render_frame_proxy.cc
index 5615b19..8f83112 100644
--- a/content/renderer/render_frame_proxy.cc
+++ b/content/renderer/render_frame_proxy.cc
@@ -29,11 +29,13 @@
 #include "content/renderer/render_thread_impl.h"
 #include "content/renderer/render_view_impl.h"
 #include "content/renderer/render_widget.h"
+#include "content/renderer/resource_timing_info_conversions.h"
 #include "ipc/ipc_message_macros.h"
 #include "third_party/WebKit/common/feature_policy/feature_policy.h"
 #include "third_party/WebKit/common/frame_policy.h"
 #include "third_party/WebKit/public/platform/URLConversion.h"
 #include "third_party/WebKit/public/platform/WebRect.h"
+#include "third_party/WebKit/public/platform/WebResourceTimingInfo.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
 #include "third_party/WebKit/public/web/WebTriggeringEventInfo.h"
@@ -376,6 +378,8 @@
     IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateFramePolicy, OnDidUpdateFramePolicy)
     IPC_MESSAGE_HANDLER(FrameMsg_DidSetActiveSandboxFlags,
                         OnDidSetActiveSandboxFlags)
+    IPC_MESSAGE_HANDLER(FrameMsg_ForwardResourceTimingToParent,
+                        OnForwardResourceTimingToParent)
     IPC_MESSAGE_HANDLER(FrameMsg_DispatchLoad, OnDispatchLoad)
     IPC_MESSAGE_HANDLER(FrameMsg_Collapse, OnCollapse)
     IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateName, OnDidUpdateName)
@@ -448,8 +452,14 @@
   web_frame_->DidStopLoading();
 }
 
+void RenderFrameProxy::OnForwardResourceTimingToParent(
+    const ResourceTimingInfo& info) {
+  web_frame_->ForwardResourceTimingToParent(
+      ResourceTimingInfoToWebResourceTimingInfo(info));
+}
+
 void RenderFrameProxy::OnDispatchLoad() {
-  web_frame_->DispatchLoadEventOnFrameOwner();
+  web_frame_->DispatchLoadEventForFrameOwner();
 }
 
 void RenderFrameProxy::OnCollapse(bool collapsed) {
diff --git a/content/renderer/render_frame_proxy.h b/content/renderer/render_frame_proxy.h
index 8fe65d18..10554f05 100644
--- a/content/renderer/render_frame_proxy.h
+++ b/content/renderer/render_frame_proxy.h
@@ -43,6 +43,7 @@
 struct ContentSecurityPolicyHeader;
 struct FrameOwnerProperties;
 struct FrameReplicationState;
+struct ResourceTimingInfo;
 
 #if defined(USE_AURA)
 class MusEmbeddedFrame;
@@ -214,6 +215,8 @@
   void OnDidStopLoading();
   void OnDidUpdateFramePolicy(const blink::FramePolicy& frame_policy);
   void OnDidSetActiveSandboxFlags(blink::WebSandboxFlags active_sandbox_flags);
+  void OnForwardResourceTimingToParent(
+      const ResourceTimingInfo& resource_timing);
   void OnDispatchLoad();
   void OnCollapse(bool collapsed);
   void OnDidUpdateName(const std::string& name, const std::string& unique_name);
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 924b118..f55d956 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -2202,7 +2202,8 @@
       params->proxy_routing_id, params->opener_routing_id,
       params->parent_routing_id, params->previous_sibling_routing_id,
       params->devtools_frame_token, params->replication_state, compositor_deps,
-      *params->widget_params, params->frame_owner_properties);
+      *params->widget_params, params->frame_owner_properties,
+      params->has_committed_real_load);
 }
 
 void RenderThreadImpl::SetUpEmbeddedWorkerChannelForServiceWorker(
diff --git a/content/renderer/render_thread_impl.h b/content/renderer/render_thread_impl.h
index 16d885e2..8ceb3f27 100644
--- a/content/renderer/render_thread_impl.h
+++ b/content/renderer/render_thread_impl.h
@@ -40,7 +40,6 @@
 #include "content/common/renderer.mojom.h"
 #include "content/common/renderer_host.mojom.h"
 #include "content/common/storage_partition_service.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/url_loader_throttle_provider.h"
 #include "content/renderer/gpu/compositor_dependencies.h"
@@ -55,6 +54,7 @@
 #include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h"
 #include "net/base/network_change_notifier.h"
 #include "net/nqe/effective_connection_type.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "services/service_manager/public/cpp/bind_source_info.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
 #include "services/viz/public/interfaces/compositing/compositing_mode_watcher.mojom.h"
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index 2c03fb6..2d1bec1 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -798,7 +798,7 @@
       routing_id, std::move(stub_interface_provider), kProxyRoutingId,
       MSG_ROUTING_NONE, MSG_ROUTING_NONE, MSG_ROUTING_NONE,
       base::UnguessableToken::Create(), replication_state, nullptr,
-      widget_params, FrameOwnerProperties());
+      widget_params, FrameOwnerProperties(), /*has_committed_real_load=*/true);
   TestRenderFrame* provisional_frame =
       static_cast<TestRenderFrame*>(RenderFrameImpl::FromRoutingID(routing_id));
   EXPECT_TRUE(provisional_frame);
@@ -848,7 +848,7 @@
       routing_id, std::move(stub_interface_provider), kProxyRoutingId,
       MSG_ROUTING_NONE, frame()->GetRoutingID(), MSG_ROUTING_NONE,
       base::UnguessableToken::Create(), replication_state, nullptr,
-      widget_params, FrameOwnerProperties());
+      widget_params, FrameOwnerProperties(), /*has_committed_real_load=*/true);
   {
     TestRenderFrame* provisional_frame = static_cast<TestRenderFrame*>(
         RenderFrameImpl::FromRoutingID(routing_id));
@@ -2168,37 +2168,52 @@
 }
 
 TEST_F(RenderViewImplTest, PreferredSizeZoomed) {
-  LoadHTML("<body style='margin:0;'><div style='display:inline-block; "
-           "width:400px; height:400px;'/></body>");
-  view()->webview()->MainFrame()->ToWebLocalFrame()->SetCanHaveScrollbars(
-      false);
+  LoadHTML(
+      "<style>::-webkit-scrollbar { width: 20px; height: 20px; } </style>"
+      "<body style='margin:0;'>"
+      "<div style='display:inline-block; "
+      "width:400px; height:400px;'/></body>");
   EnablePreferredSizeMode();
 
+#if defined(OS_ANDROID)
+  // Android ignores scrollbar styling.
+  int scrollbar_width = 0;
+#else
+  int scrollbar_width = 20;
+#endif
+
   gfx::Size size = GetPreferredSize();
-  EXPECT_EQ(gfx::Size(400, 400), size);
+  EXPECT_EQ(gfx::Size(400 + scrollbar_width, 400), size);
 
   SetZoomLevel(ZoomFactorToZoomLevel(2.0));
   size = GetPreferredSize();
-  EXPECT_EQ(gfx::Size(800, 800), size);
+  EXPECT_EQ(gfx::Size(800 + scrollbar_width * 2, 800), size);
 }
 
 TEST_F(RenderViewImplScaleFactorTest, PreferredSizeWithScaleFactor) {
   DoSetUp();
-  LoadHTML("<body style='margin:0;'><div style='display:inline-block; "
-           "width:400px; height:400px;'/></body>");
-  view()->webview()->MainFrame()->ToWebLocalFrame()->SetCanHaveScrollbars(
-      false);
+  LoadHTML(
+      "<style>::-webkit-scrollbar { width: 20px; height: 20px; } </style>"
+      "<body style='margin:0;'><div style='display:inline-block; "
+      "width:400px; height:400px;'/></body>");
   EnablePreferredSizeMode();
 
+#if defined(OS_ANDROID)
+  // Android ignores scrollbar styling.
+  int scrollbar_width = 0;
+#else
+  int scrollbar_width = 20;
+#endif
+
   gfx::Size size = GetPreferredSize();
-  EXPECT_EQ(gfx::Size(400, 400), size);
+  EXPECT_EQ(gfx::Size(400 + scrollbar_width, 400), size);
 
   // The size is in DIP. Changing the scale factor should not change
   // the preferred size. (Caveat: a page may apply different layout for
   // high DPI, in which case, the size may differ.)
   SetDeviceScaleFactor(2.f);
   size = GetPreferredSize();
-  EXPECT_EQ(gfx::Size(400, 400), size);
+  EXPECT_EQ(gfx::Size(400 + scrollbar_width, 400), size);
 }
 
 // Ensure the RenderViewImpl history list is properly updated when starting a
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 39d5c52..1d136aa56 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -610,7 +610,7 @@
         std::move(main_frame_interface_provider),
         params->main_frame_widget_routing_id, params->hidden, screen_info(),
         compositor_deps_, opener_frame, params->devtools_main_frame_token,
-        params->replicated_frame_state);
+        params->replicated_frame_state, params->has_committed_real_load);
   }
 
   // TODO(dcheng): Shouldn't these be mutually exclusive at this point? See
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index 77879e5..5615937 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -206,8 +206,8 @@
       .output_params();
 }
 
-mojom::URLLoaderFactoryPtr GetBlobURLLoaderFactoryGetter() {
-  mojom::URLLoaderFactoryPtr blob_loader_factory;
+network::mojom::URLLoaderFactoryPtr GetBlobURLLoaderFactoryGetter() {
+  network::mojom::URLLoaderFactoryPtr blob_loader_factory;
   RenderThreadImpl::current()->GetRendererHost()->GetBlobURLLoaderFactory(
       mojo::MakeRequest(&blob_loader_factory));
   return blob_loader_factory;
@@ -362,18 +362,19 @@
           : ChildURLLoaderFactoryGetterImpl::URLLoaderFactoryGetterCallback());
 }
 
-PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory>
+PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>
 RendererBlinkPlatformImpl::CreateNetworkURLLoaderFactory() {
   RenderThreadImpl* render_thread = RenderThreadImpl::current();
   DCHECK(render_thread);
-  PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory> url_loader_factory;
+  PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>
+      url_loader_factory;
 
   if (base::FeatureList::IsEnabled(features::kNetworkService)) {
-    mojom::URLLoaderFactoryPtr factory_ptr;
+    network::mojom::URLLoaderFactoryPtr factory_ptr;
     connector_->BindInterface(mojom::kBrowserServiceName, &factory_ptr);
     url_loader_factory = std::move(factory_ptr);
   } else {
-    mojom::URLLoaderFactoryAssociatedPtr factory_ptr;
+    network::mojom::URLLoaderFactoryAssociatedPtr factory_ptr;
     render_thread->channel()->GetRemoteAssociatedInterface(&factory_ptr);
     url_loader_factory = std::move(factory_ptr);
   }
@@ -382,7 +383,7 @@
   // avoid thread hops and prevent jank on the main thread from affecting
   // requests from other threads this object should live on the IO thread.
   if (base::FeatureList::IsEnabled(features::kOutOfBlinkCORS)) {
-    mojom::URLLoaderFactoryPtr factory_ptr;
+    network::mojom::URLLoaderFactoryPtr factory_ptr;
     RenderThreadImpl::current()->GetIOTaskRunner()->PostTask(
         FROM_HERE, base::BindOnce(&CORSURLLoaderFactory::CreateAndBind,
                                   url_loader_factory.PassInterface(),
diff --git a/content/renderer/renderer_blink_platform_impl.h b/content/renderer/renderer_blink_platform_impl.h
index 351efa1..65ddfde 100644
--- a/content/renderer/renderer_blink_platform_impl.h
+++ b/content/renderer/renderer_blink_platform_impl.h
@@ -21,10 +21,10 @@
 #include "content/common/content_export.h"
 #include "content/common/file_utilities.mojom.h"
 #include "content/common/possibly_associated_interface_ptr.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/renderer/origin_trials/web_trial_token_validator_impl.h"
 #include "content/renderer/top_level_blame_context.h"
 #include "content/renderer/webpublicsuffixlist_impl.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBFactory.h"
 #include "third_party/WebKit/public/platform/modules/screen_orientation/WebScreenOrientationType.h"
 #include "third_party/WebKit/public/platform/modules/webdatabase/web_database.mojom.h"
@@ -270,7 +270,7 @@
   void SetCompositorThread(blink::scheduler::WebThreadBase* compositor_thread);
 
  private:
-  PossiblyAssociatedInterfacePtr<mojom::URLLoaderFactory>
+  PossiblyAssociatedInterfacePtr<network::mojom::URLLoaderFactory>
   CreateNetworkURLLoaderFactory();
 
   bool CheckPreparsedJsCachingEnabled() const;
diff --git a/content/renderer/renderer_webapplicationcachehost_impl.cc b/content/renderer/renderer_webapplicationcachehost_impl.cc
index 4fb06c3..1208ef5f 100644
--- a/content/renderer/renderer_webapplicationcachehost_impl.cc
+++ b/content/renderer/renderer_webapplicationcachehost_impl.cc
@@ -63,7 +63,7 @@
 }
 
 void RendererWebApplicationCacheHostImpl::SetSubresourceFactory(
-    mojom::URLLoaderFactoryPtr url_loader_factory) {
+    network::mojom::URLLoaderFactoryPtr url_loader_factory) {
   RenderFrameImpl* render_frame =
       RenderFrameImpl::FromRoutingID(frame_routing_id_);
   if (render_frame) {
diff --git a/content/renderer/renderer_webapplicationcachehost_impl.h b/content/renderer/renderer_webapplicationcachehost_impl.h
index 2ee42d55..0a04c56 100644
--- a/content/renderer/renderer_webapplicationcachehost_impl.h
+++ b/content/renderer/renderer_webapplicationcachehost_impl.h
@@ -26,7 +26,7 @@
   void OnCacheSelected(const AppCacheInfo& info) override;
 
   void SetSubresourceFactory(
-      mojom::URLLoaderFactoryPtr url_loader_factory) override;
+      network::mojom::URLLoaderFactoryPtr url_loader_factory) override;
 
  private:
   RenderViewImpl* GetRenderView();
diff --git a/content/renderer/resource_timing_info_conversions.cc b/content/renderer/resource_timing_info_conversions.cc
new file mode 100644
index 0000000..6f9c67d
--- /dev/null
+++ b/content/renderer/resource_timing_info_conversions.cc
@@ -0,0 +1,131 @@
+// 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/renderer/resource_timing_info_conversions.h"
+
+#include <string>
+#include <vector>
+
+#include "content/common/resource_timing_info.h"
+#include "third_party/WebKit/public/platform/WebResourceTimingInfo.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+#include "third_party/WebKit/public/platform/WebVector.h"
+
+namespace content {
+
+ResourceTimingInfo WebResourceTimingInfoToResourceTimingInfo(
+    const blink::WebResourceTimingInfo& info) {
+  // TODO(dcheng): This is sad. Move this to Mojo.
+  ResourceTimingInfo resource_timing;
+  resource_timing.name = info.name.Utf8();
+  resource_timing.start_time = info.start_time;
+
+  resource_timing.alpn_negotiated_protocol =
+      info.alpn_negotiated_protocol.Utf8();
+  resource_timing.connection_info = info.connection_info.Utf8();
+
+  if (!info.timing.IsNull()) {
+    resource_timing.timing.emplace();
+    resource_timing.timing->request_time = info.timing.RequestTime();
+    resource_timing.timing->proxy_start = info.timing.ProxyStart();
+    resource_timing.timing->proxy_end = info.timing.ProxyEnd();
+    resource_timing.timing->dns_start = info.timing.DnsStart();
+    resource_timing.timing->dns_end = info.timing.DnsEnd();
+    resource_timing.timing->connect_start = info.timing.ConnectStart();
+    resource_timing.timing->connect_end = info.timing.ConnectEnd();
+    resource_timing.timing->worker_start = info.timing.WorkerStart();
+    resource_timing.timing->worker_ready = info.timing.WorkerReady();
+    resource_timing.timing->send_start = info.timing.SendStart();
+    resource_timing.timing->send_end = info.timing.SendEnd();
+    resource_timing.timing->receive_headers_end =
+        info.timing.ReceiveHeadersEnd();
+    resource_timing.timing->ssl_start = info.timing.SslStart();
+    resource_timing.timing->ssl_end = info.timing.SslEnd();
+    resource_timing.timing->push_start = info.timing.PushStart();
+    resource_timing.timing->push_end = info.timing.PushEnd();
+  }
+
+  resource_timing.last_redirect_end_time = info.last_redirect_end_time;
+  resource_timing.finish_time = info.finish_time;
+
+  resource_timing.transfer_size = info.transfer_size;
+  resource_timing.encoded_body_size = info.encoded_body_size;
+  resource_timing.decoded_body_size = info.decoded_body_size;
+
+  resource_timing.did_reuse_connection = info.did_reuse_connection;
+
+  resource_timing.allow_timing_details = info.allow_timing_details;
+  resource_timing.allow_redirect_details = info.allow_redirect_details;
+
+  resource_timing.allow_negative_values = info.allow_negative_values;
+
+  for (const auto& entry : info.server_timing) {
+    resource_timing.server_timing.emplace_back();
+    auto& new_entry = resource_timing.server_timing.back();
+    new_entry.name = entry.name.Utf8();
+    new_entry.duration = entry.duration;
+    new_entry.description = entry.description.Utf8();
+  }
+
+  return resource_timing;
+}
+
+blink::WebResourceTimingInfo ResourceTimingInfoToWebResourceTimingInfo(
+    const ResourceTimingInfo& resource_timing) {
+  // TODO(dcheng): This is sad. Move this to Mojo.
+  blink::WebResourceTimingInfo info;
+  info.name = blink::WebString::FromUTF8(resource_timing.name);
+  info.start_time = resource_timing.start_time;
+
+  info.alpn_negotiated_protocol =
+      blink::WebString::FromUTF8(resource_timing.alpn_negotiated_protocol);
+  info.connection_info =
+      blink::WebString::FromUTF8(resource_timing.connection_info);
+
+  if (resource_timing.timing) {
+    info.timing.Initialize();
+    info.timing.SetRequestTime(resource_timing.timing->request_time);
+    info.timing.SetProxyStart(resource_timing.timing->proxy_start);
+    info.timing.SetProxyEnd(resource_timing.timing->proxy_end);
+    info.timing.SetDNSStart(resource_timing.timing->dns_start);
+    info.timing.SetDNSEnd(resource_timing.timing->dns_end);
+    info.timing.SetConnectStart(resource_timing.timing->connect_start);
+    info.timing.SetConnectEnd(resource_timing.timing->connect_end);
+    info.timing.SetWorkerStart(resource_timing.timing->worker_start);
+    info.timing.SetWorkerReady(resource_timing.timing->worker_ready);
+    info.timing.SetSendStart(resource_timing.timing->send_start);
+    info.timing.SetSendEnd(resource_timing.timing->send_end);
+    info.timing.SetReceiveHeadersEnd(
+        resource_timing.timing->receive_headers_end);
+    info.timing.SetSSLStart(resource_timing.timing->ssl_start);
+    info.timing.SetSSLEnd(resource_timing.timing->ssl_end);
+    info.timing.SetPushStart(resource_timing.timing->push_start);
+    info.timing.SetPushEnd(resource_timing.timing->push_end);
+  }
+
+  info.last_redirect_end_time = resource_timing.last_redirect_end_time;
+  info.finish_time = resource_timing.finish_time;
+
+  info.transfer_size = resource_timing.transfer_size;
+  info.encoded_body_size = resource_timing.encoded_body_size;
+  info.decoded_body_size = resource_timing.decoded_body_size;
+
+  info.did_reuse_connection = resource_timing.did_reuse_connection;
+
+  info.allow_timing_details = resource_timing.allow_timing_details;
+  info.allow_redirect_details = resource_timing.allow_redirect_details;
+
+  info.allow_negative_values = resource_timing.allow_negative_values;
+
+  info.server_timing.reserve(resource_timing.server_timing.size());
+  for (const auto& server_timing : resource_timing.server_timing) {
+    info.server_timing.emplace_back(
+        blink::WebString::FromUTF8(server_timing.name), server_timing.duration,
+        blink::WebString::FromUTF8(server_timing.description));
+  }
+
+  return info;
+}
+
+}  // namespace content
diff --git a/content/renderer/resource_timing_info_conversions.h b/content/renderer/resource_timing_info_conversions.h
new file mode 100644
index 0000000..e1a55e28
--- /dev/null
+++ b/content/renderer/resource_timing_info_conversions.h
@@ -0,0 +1,20 @@
+// 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_RENDERER_RESOURCE_TIMING_INFO_CONVERSIONS_H_
+#define CONTENT_RENDERER_RESOURCE_TIMING_INFO_CONVERSIONS_H_
+
+#include "content/common/resource_timing_info.h"
+#include "third_party/WebKit/public/platform/WebResourceTimingInfo.h"
+
+namespace content {
+
+ResourceTimingInfo WebResourceTimingInfoToResourceTimingInfo(
+    const blink::WebResourceTimingInfo& info);
+blink::WebResourceTimingInfo ResourceTimingInfoToWebResourceTimingInfo(
+    const ResourceTimingInfo& resource_timing);
+
+}  // namespace content
+
+#endif  // CONTENT_RENDERER_RESOURCE_TIMING_INFO_CONVERSIONS_H_
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc
index 1e68061..2904d42 100644
--- a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc
+++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc
@@ -100,11 +100,11 @@
       blink::WebConsoleMessage(level, blink::WebString::FromUTF8(message)));
 }
 
-void EmbeddedWorkerInstanceClientImpl::GetDevToolsAgent(
+void EmbeddedWorkerInstanceClientImpl::BindDevToolsAgent(
     blink::mojom::DevToolsAgentAssociatedRequest request) {
   DCHECK(wrapper_);
   DCHECK(wrapper_->worker());
-  wrapper_->worker()->GetDevToolsAgent(request.PassHandle());
+  wrapper_->worker()->BindDevToolsAgent(request.PassHandle());
 }
 
 EmbeddedWorkerInstanceClientImpl::EmbeddedWorkerInstanceClientImpl(
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.h b/content/renderer/service_worker/embedded_worker_instance_client_impl.h
index 9671e0bd..8e020a8d 100644
--- a/content/renderer/service_worker/embedded_worker_instance_client_impl.h
+++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.h
@@ -83,7 +83,7 @@
   void ResumeAfterDownload() override;
   void AddMessageToConsole(blink::WebConsoleMessage::Level level,
                            const std::string& message) override;
-  void GetDevToolsAgent(
+  void BindDevToolsAgent(
       blink::mojom::DevToolsAgentAssociatedRequest request) override;
 
   // Handler of connection error bound to |binding_|.
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
index c100bb6..72d9fb1 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -19,7 +19,6 @@
 #include "base/time/time.h"
 #include "base/trace_event/trace_event.h"
 #include "content/child/thread_safe_sender.h"
-#include "content/common/devtools_messages.h"
 #include "content/common/service_worker/embedded_worker_messages.h"
 #include "content/common/service_worker/service_worker_event_dispatcher.mojom.h"
 #include "content/common/service_worker/service_worker_messages.h"
@@ -474,7 +473,7 @@
 };
 
 class ServiceWorkerContextClient::NavigationPreloadRequest final
-    : public mojom::URLLoaderClient {
+    : public network::mojom::URLLoaderClient {
  public:
   NavigationPreloadRequest(int fetch_event_id,
                            const GURL& url,
@@ -489,7 +488,7 @@
   void OnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     DCHECK(!response_);
     DCHECK(!downloaded_file);
     response_ = std::make_unique<blink::WebURLResponse>();
@@ -618,8 +617,8 @@
 
   const int fetch_event_id_;
   const GURL url_;
-  mojom::URLLoaderPtr url_loader_;
-  mojo::Binding<mojom::URLLoaderClient> binding_;
+  network::mojom::URLLoaderPtr url_loader_;
+  mojo::Binding<network::mojom::URLLoaderClient> binding_;
 
   std::unique_ptr<blink::WebURLResponse> response_;
   mojo::ScopedDataPipeConsumerHandle body_;
diff --git a/content/renderer/service_worker/service_worker_fetch_context_impl.h b/content/renderer/service_worker/service_worker_fetch_context_impl.h
index 050dd06..712a5d6 100644
--- a/content/renderer/service_worker/service_worker_fetch_context_impl.h
+++ b/content/renderer/service_worker/service_worker_fetch_context_impl.h
@@ -5,8 +5,8 @@
 #ifndef CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
 #define CONTENT_RENDERER_SERVICE_WORKER_SERVICE_WORKER_FETCH_CONTEXT_IMPL_H_
 
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/child_url_loader_factory_getter.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/public/platform/WebWorkerFetchContext.h"
 #include "url/gurl.h"
 
diff --git a/content/renderer/service_worker/service_worker_network_provider.h b/content/renderer/service_worker/service_worker_network_provider.h
index ebdfc20..c9c7837 100644
--- a/content/renderer/service_worker/service_worker_network_provider.h
+++ b/content/renderer/service_worker/service_worker_network_provider.h
@@ -96,7 +96,7 @@
   int provider_id() const;
   ServiceWorkerProviderContext* context() const { return context_.get(); }
 
-  mojom::URLLoaderFactory* script_loader_factory() {
+  network::mojom::URLLoaderFactory* script_loader_factory() {
     return script_loader_factory_.get();
   }
 
@@ -130,7 +130,7 @@
 
   scoped_refptr<ServiceWorkerProviderContext> context_;
   mojom::ServiceWorkerDispatcherHostAssociatedPtr dispatcher_host_;
-  mojom::URLLoaderFactoryAssociatedPtr script_loader_factory_;
+  network::mojom::URLLoaderFactoryAssociatedPtr script_loader_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(ServiceWorkerNetworkProvider);
 };
diff --git a/content/renderer/service_worker/service_worker_provider_context.cc b/content/renderer/service_worker/service_worker_provider_context.cc
index 1e013aa..da91715 100644
--- a/content/renderer/service_worker/service_worker_provider_context.cc
+++ b/content/renderer/service_worker/service_worker_provider_context.cc
@@ -16,7 +16,6 @@
 #include "content/child/thread_safe_sender.h"
 #include "content/common/service_worker/service_worker_utils.h"
 #include "content/public/common/service_names.mojom.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/child_url_loader_factory_getter.h"
 #include "content/renderer/service_worker/controller_service_worker_connector.h"
 #include "content/renderer/service_worker/service_worker_dispatcher.h"
@@ -27,6 +26,7 @@
 #include "content/renderer/worker_thread_registry.h"
 #include "mojo/public/cpp/bindings/strong_associated_binding.h"
 #include "mojo/public/cpp/bindings/strong_binding.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "services/service_manager/public/cpp/connector.h"
 #include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/common/service_worker/service_worker_object.mojom.h"
@@ -50,7 +50,7 @@
   // S13nServiceWorker:
   // Used to intercept requests from the controllee and dispatch them
   // as events to the controller ServiceWorker.
-  mojom::URLLoaderFactoryPtr subresource_loader_factory;
+  network::mojom::URLLoaderFactoryPtr subresource_loader_factory;
 
   // S13nServiceWorker:
   // Used when we create |subresource_loader_factory|.
@@ -207,7 +207,7 @@
   return state_for_client_->controller_version_id;
 }
 
-mojom::URLLoaderFactory*
+network::mojom::URLLoaderFactory*
 ServiceWorkerProviderContext::GetSubresourceLoaderFactory() {
   DCHECK(state_for_client_);
   auto* state = state_for_client_.get();
diff --git a/content/renderer/service_worker/service_worker_provider_context.h b/content/renderer/service_worker/service_worker_provider_context.h
index 3e03cc2..440315d 100644
--- a/content/renderer/service_worker/service_worker_provider_context.h
+++ b/content/renderer/service_worker/service_worker_provider_context.h
@@ -132,7 +132,7 @@
   // For service worker clients. Returns URLLoaderFactory for loading
   // subresources with the controller ServiceWorker, or nullptr if
   // no controller is attached.
-  mojom::URLLoaderFactory* GetSubresourceLoaderFactory();
+  network::mojom::URLLoaderFactory* GetSubresourceLoaderFactory();
 
   // For service worker clients. Returns the feature usage of its controller.
   const std::set<blink::mojom::WebFeature>& used_features() const;
diff --git a/content/renderer/service_worker/service_worker_provider_context_unittest.cc b/content/renderer/service_worker/service_worker_provider_context_unittest.cc
index 42967a2..a5bc07b2 100644
--- a/content/renderer/service_worker/service_worker_provider_context_unittest.cc
+++ b/content/renderer/service_worker/service_worker_provider_context_unittest.cc
@@ -16,7 +16,6 @@
 #include "content/common/service_worker/service_worker_types.h"
 #include "content/public/common/content_features.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/child_url_loader_factory_getter.h"
 #include "content/public/test/test_url_loader_client.h"
 #include "content/renderer/loader/child_url_loader_factory_getter_impl.h"
@@ -30,6 +29,7 @@
 #include "ipc/ipc_test_sink.h"
 #include "mojo/public/cpp/bindings/associated_binding_set.h"
 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/WebKit/common/service_worker/service_worker_error_type.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_provider_type.mojom.h"
@@ -165,22 +165,22 @@
 
 // S13nServiceWorker: a fake URLLoaderFactory implementation that basically
 // does nothing but records the requests.
-class FakeURLLoaderFactory final : public mojom::URLLoaderFactory {
+class FakeURLLoaderFactory final : public network::mojom::URLLoaderFactory {
  public:
   FakeURLLoaderFactory() = default;
   ~FakeURLLoaderFactory() override = default;
 
-  void AddBinding(mojom::URLLoaderFactoryRequest request) {
+  void AddBinding(network::mojom::URLLoaderFactoryRequest request) {
     bindings_.AddBinding(this, std::move(request));
   }
 
-  // mojom::URLLoaderFactory:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     // Does nothing, but just record the request and hold the client (to avoid
@@ -188,14 +188,16 @@
     last_url_ = url_request.url;
     clients_.push_back(std::move(client));
   }
-  void Clone(mojom::URLLoaderFactoryRequest factory) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest factory) override {
+    NOTREACHED();
+  }
 
   size_t clients_count() const { return clients_.size(); }
   GURL last_request_url() const { return last_url_; }
 
  private:
-  mojo::BindingSet<mojom::URLLoaderFactory> bindings_;
-  std::vector<mojom::URLLoaderClientPtr> clients_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
+  std::vector<network::mojom::URLLoaderClientPtr> clients_;
   GURL last_url_;
 
   DISALLOW_COPY_AND_ASSIGN(FakeURLLoaderFactory);
@@ -247,7 +249,7 @@
 
   void EnableS13nServiceWorker() {
     scoped_feature_list_.InitAndEnableFeature(features::kNetworkService);
-    mojom::URLLoaderFactoryPtr fake_loader_factory;
+    network::mojom::URLLoaderFactoryPtr fake_loader_factory;
     fake_loader_factory_.AddBinding(MakeRequest(&fake_loader_factory));
     loader_factory_getter_ =
         base::MakeRefCounted<ChildURLLoaderFactoryGetterImpl>(
@@ -275,15 +277,16 @@
     return info;
   }
 
-  void StartRequest(mojom::URLLoaderFactory* factory, const GURL& url) {
+  void StartRequest(network::mojom::URLLoaderFactory* factory,
+                    const GURL& url) {
     network::ResourceRequest request;
     request.url = url;
     request.resource_type = static_cast<int>(RESOURCE_TYPE_SUB_RESOURCE);
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     TestURLLoaderClient loader_client;
     factory->CreateLoaderAndStart(
-        mojo::MakeRequest(&loader), 0, 0, mojom::kURLLoadOptionNone, request,
-        loader_client.CreateInterfacePtr(),
+        mojo::MakeRequest(&loader), 0, 0, network::mojom::kURLLoadOptionNone,
+        request, loader_client.CreateInterfacePtr(),
         net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
     // Need to run one more loop to make a Mojo call.
     base::RunLoop().RunUntilIdle();
diff --git a/content/renderer/service_worker/service_worker_subresource_loader.cc b/content/renderer/service_worker/service_worker_subresource_loader.cc
index 1160502..0e9556f2 100644
--- a/content/renderer/service_worker/service_worker_subresource_loader.cc
+++ b/content/renderer/service_worker/service_worker_subresource_loader.cc
@@ -38,13 +38,13 @@
 // A wrapper URLLoaderClient that invokes the given RewriteHeaderCallback
 // whenever a response or redirect is received. It self-destructs when the Mojo
 // connection is closed.
-class HeaderRewritingURLLoaderClient : public mojom::URLLoaderClient {
+class HeaderRewritingURLLoaderClient : public network::mojom::URLLoaderClient {
  public:
   using RewriteHeaderCallback = base::Callback<network::ResourceResponseHead(
       const network::ResourceResponseHead&)>;
 
-  static mojom::URLLoaderClientPtr CreateAndBind(
-      mojom::URLLoaderClientPtr url_loader_client,
+  static network::mojom::URLLoaderClientPtr CreateAndBind(
+      network::mojom::URLLoaderClientPtr url_loader_client,
       RewriteHeaderCallback rewrite_header_callback) {
     return (new HeaderRewritingURLLoaderClient(std::move(url_loader_client),
                                                rewrite_header_callback))
@@ -54,15 +54,16 @@
   ~HeaderRewritingURLLoaderClient() override {}
 
  private:
-  HeaderRewritingURLLoaderClient(mojom::URLLoaderClientPtr url_loader_client,
-                                 RewriteHeaderCallback rewrite_header_callback)
+  HeaderRewritingURLLoaderClient(
+      network::mojom::URLLoaderClientPtr url_loader_client,
+      RewriteHeaderCallback rewrite_header_callback)
       : url_loader_client_(std::move(url_loader_client)),
         binding_(this),
         rewrite_header_callback_(rewrite_header_callback) {}
 
-  mojom::URLLoaderClientPtr CreateInterfacePtrAndBind() {
+  network::mojom::URLLoaderClientPtr CreateInterfacePtrAndBind() {
     DCHECK(!binding_.is_bound());
-    mojom::URLLoaderClientPtr ptr;
+    network::mojom::URLLoaderClientPtr ptr;
     binding_.Bind(mojo::MakeRequest(&ptr));
     binding_.set_connection_error_handler(
         base::Bind(&HeaderRewritingURLLoaderClient::OnClientConnectionError,
@@ -74,11 +75,11 @@
     base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
   }
 
-  // mojom::URLLoaderClient implementation:
+  // network::mojom::URLLoaderClient implementation:
   void OnReceiveResponse(
       const network::ResourceResponseHead& response_head,
       const base::Optional<net::SSLInfo>& ssl_info,
-      mojom::DownloadedTempFilePtr downloaded_file) override {
+      network::mojom::DownloadedTempFilePtr downloaded_file) override {
     DCHECK(url_loader_client_.is_bound());
     url_loader_client_->OnReceiveResponse(
         rewrite_header_callback_.Run(response_head), ssl_info,
@@ -127,8 +128,8 @@
     url_loader_client_->OnComplete(status);
   }
 
-  mojom::URLLoaderClientPtr url_loader_client_;
-  mojo::Binding<mojom::URLLoaderClient> binding_;
+  network::mojom::URLLoaderClientPtr url_loader_client_;
+  mojo::Binding<network::mojom::URLLoaderClient> binding_;
   RewriteHeaderCallback rewrite_header_callback_;
 };
 }  // namespace
@@ -136,12 +137,12 @@
 // ServiceWorkerSubresourceLoader -------------------------------------------
 
 ServiceWorkerSubresourceLoader::ServiceWorkerSubresourceLoader(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& resource_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
     scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
     scoped_refptr<ChildURLLoaderFactoryGetter> default_loader_factory_getter)
@@ -510,12 +511,12 @@
     ~ServiceWorkerSubresourceLoaderFactory() = default;
 
 void ServiceWorkerSubresourceLoaderFactory::CreateLoaderAndStart(
-    mojom::URLLoaderRequest request,
+    network::mojom::URLLoaderRequest request,
     int32_t routing_id,
     int32_t request_id,
     uint32_t options,
     const network::ResourceRequest& resource_request,
-    mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderClientPtr client,
     const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) {
   // This loader destructs itself, as we want to transparently switch to the
   // network loader when fallback happens. When that happens the loader unbinds
@@ -528,7 +529,7 @@
 }
 
 void ServiceWorkerSubresourceLoaderFactory::Clone(
-    mojom::URLLoaderFactoryRequest request) {
+    network::mojom::URLLoaderFactoryRequest request) {
   NOTREACHED();
 }
 
diff --git a/content/renderer/service_worker/service_worker_subresource_loader.h b/content/renderer/service_worker/service_worker_subresource_loader.h
index 92cdbde8..4f67ef7 100644
--- a/content/renderer/service_worker/service_worker_subresource_loader.h
+++ b/content/renderer/service_worker/service_worker_subresource_loader.h
@@ -12,11 +12,11 @@
 #include "content/common/content_export.h"
 #include "content/common/service_worker/service_worker_fetch_response_callback.mojom.h"
 #include "content/common/service_worker/service_worker_status_code.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/renderer/service_worker/controller_service_worker_connector.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "net/traffic_annotation/network_traffic_annotation.h"
 #include "net/url_request/redirect_info.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/common/blob/blob.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_event_status.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_stream_handle.mojom.h"
@@ -32,19 +32,19 @@
 // Currently an instance of this class is created and used only on
 // the main thread (while the implementation itself is thread agnostic).
 class CONTENT_EXPORT ServiceWorkerSubresourceLoader
-    : public mojom::URLLoader,
+    : public network::mojom::URLLoader,
       public mojom::ServiceWorkerFetchResponseCallback,
       public ControllerServiceWorkerConnector::Observer {
  public:
   // See the comments for ServiceWorkerSubresourceLoaderFactory's ctor (below)
   // to see how each parameter is used.
   ServiceWorkerSubresourceLoader(
-      mojom::URLLoaderRequest request,
+      network::mojom::URLLoaderRequest request,
       int32_t routing_id,
       int32_t request_id,
       uint32_t options,
       const network::ResourceRequest& resource_request,
-      mojom::URLLoaderClientPtr client,
+      network::mojom::URLLoaderClientPtr client,
       const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
       scoped_refptr<ControllerServiceWorkerConnector> controller_connector,
       scoped_refptr<ChildURLLoaderFactoryGetter> default_loader_factory_getter);
@@ -82,7 +82,7 @@
                      blink::mojom::BlobPtr blob,
                      blink::mojom::ServiceWorkerStreamHandlePtr body_as_stream);
 
-  // mojom::URLLoader overrides:
+  // network::mojom::URLLoader overrides:
   void FollowRedirect() override;
   void ProceedWithResponse() override;
   void SetPriority(net::RequestPriority priority,
@@ -102,8 +102,8 @@
   base::Optional<net::RedirectInfo> redirect_info_;
   int redirect_limit_;
 
-  mojom::URLLoaderClientPtr url_loader_client_;
-  mojo::Binding<mojom::URLLoader> url_loader_binding_;
+  network::mojom::URLLoaderClientPtr url_loader_client_;
+  mojo::Binding<network::mojom::URLLoader> url_loader_binding_;
 
   // For handling FetchEvent response.
   mojo::Binding<ServiceWorkerFetchResponseCallback> response_callback_binding_;
@@ -146,7 +146,7 @@
 // A custom URLLoaderFactory implementation used by Service Worker controllees
 // for loading subresources via the controller Service Worker.
 class CONTENT_EXPORT ServiceWorkerSubresourceLoaderFactory
-    : public mojom::URLLoaderFactory {
+    : public network::mojom::URLLoaderFactory {
  public:
   // |controller_connector_| is used to get a connection to the controller
   // ServiceWorker.
@@ -158,16 +158,16 @@
 
   ~ServiceWorkerSubresourceLoaderFactory() override;
 
-  // mojom::URLLoaderFactory overrides:
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory overrides:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& resource_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override;
-  void Clone(mojom::URLLoaderFactoryRequest request) override;
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override;
 
  private:
   scoped_refptr<ControllerServiceWorkerConnector> controller_connector_;
diff --git a/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc b/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc
index b9a8e002..b6f3887 100644
--- a/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc
+++ b/content/renderer/service_worker/service_worker_subresource_loader_unittest.cc
@@ -33,17 +33,18 @@
 // This class need to set ChildURLLoaderFactoryGetter. CreateLoaderAndStart()
 // need to implement. todo(emim): Merge this and the one in
 // service_worker_url_loader_job_unittest.cc.
-class FakeNetworkURLLoaderFactory final : public mojom::URLLoaderFactory {
+class FakeNetworkURLLoaderFactory final
+    : public network::mojom::URLLoaderFactory {
  public:
   FakeNetworkURLLoaderFactory() = default;
 
-  // mojom::URLLoaderFactory implementation.
-  void CreateLoaderAndStart(mojom::URLLoaderRequest request,
+  // network::mojom::URLLoaderFactory implementation.
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest request,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& url_request,
-                            mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     std::string headers = "HTTP/1.1 200 OK\n\n";
@@ -67,7 +68,9 @@
     client->OnComplete(status);
   }
 
-  void Clone(mojom::URLLoaderFactoryRequest factory) override { NOTREACHED(); }
+  void Clone(network::mojom::URLLoaderFactoryRequest factory) override {
+    NOTREACHED();
+  }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(FakeNetworkURLLoaderFactory);
@@ -308,7 +311,7 @@
   void SetUp() override {
     feature_list_.InitAndEnableFeature(features::kNetworkService);
 
-    mojom::URLLoaderFactoryPtr fake_loader_factory;
+    network::mojom::URLLoaderFactoryPtr fake_loader_factory;
     mojo::MakeStrongBinding(std::make_unique<FakeNetworkURLLoaderFactory>(),
                             MakeRequest(&fake_loader_factory));
     loader_factory_getter_ =
@@ -333,12 +336,12 @@
   // the load to until |fake_controller_| receives the fetch event.
   void StartRequest(ServiceWorkerSubresourceLoaderFactory* loader_factory,
                     const network::ResourceRequest& request,
-                    mojom::URLLoaderPtr* out_loader,
+                    network::mojom::URLLoaderPtr* out_loader,
                     std::unique_ptr<TestURLLoaderClient>* out_loader_client) {
     *out_loader_client = std::make_unique<TestURLLoaderClient>();
     loader_factory->CreateLoaderAndStart(
-        mojo::MakeRequest(out_loader), 0, 0, mojom::kURLLoadOptionNone, request,
-        (*out_loader_client)->CreateInterfacePtr(),
+        mojo::MakeRequest(out_loader), 0, 0, network::mojom::kURLLoadOptionNone,
+        request, (*out_loader_client)->CreateInterfacePtr(),
         net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
   }
 
@@ -367,7 +370,7 @@
       CreateSubresourceLoaderFactory();
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   fake_controller_.RunUntilFetchEvent();
@@ -388,7 +391,7 @@
   // Perform the request.
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   client->RunUntilComplete();
@@ -403,7 +406,7 @@
   {
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     fake_controller_.RunUntilFetchEvent();
@@ -420,7 +423,7 @@
   {
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo2.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     fake_controller_.RunUntilFetchEvent();
@@ -439,7 +442,7 @@
     // This should re-obtain the ControllerServiceWorker.
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo3.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     fake_controller_.RunUntilFetchEvent();
@@ -458,7 +461,7 @@
   {
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     fake_controller_.RunUntilFetchEvent();
@@ -477,7 +480,7 @@
     // This should fallback to the network.
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo2.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     client->RunUntilComplete();
@@ -498,7 +501,7 @@
   {
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     fake_controller_.RunUntilFetchEvent();
@@ -515,7 +518,7 @@
   {
     network::ResourceRequest request =
         CreateRequest(GURL("https://www.example.com/foo2.png"));
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     fake_controller_.RunUntilFetchEvent();
@@ -528,7 +531,7 @@
 
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo3.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
 
@@ -553,7 +556,7 @@
       CreateSubresourceLoaderFactory();
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
 
@@ -582,7 +585,7 @@
   // Perform the request.
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   client->RunUntilResponseReceived();
@@ -632,7 +635,7 @@
   // Perform the request.
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   client->RunUntilComplete();
@@ -652,7 +655,7 @@
   // Perform the request.
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   client->RunUntilComplete();
@@ -670,7 +673,7 @@
   // Perform the request.
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   client->RunUntilRedirectReceived();
@@ -747,7 +750,7 @@
   // Perform the request.
   network::ResourceRequest request =
       CreateRequest(GURL("https://www.example.com/foo.png"));
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
 
@@ -839,7 +842,7 @@
         CreateRequest(GURL("https://www.example.com/foo.png"));
     request.fetch_request_mode = test.fetch_request_mode;
     request.request_initiator = test.request_initiator;
-    mojom::URLLoaderPtr loader;
+    network::mojom::URLLoaderPtr loader;
     std::unique_ptr<TestURLLoaderClient> client;
     StartRequest(factory.get(), request, &loader, &client);
     client->RunUntilResponseReceived();
@@ -871,7 +874,7 @@
   fake_controller_.RespondWithFallback();
 
   // Perform the request.
-  mojom::URLLoaderPtr loader;
+  network::mojom::URLLoaderPtr loader;
   std::unique_ptr<TestURLLoaderClient> client;
   StartRequest(factory.get(), request, &loader, &client);
   fake_controller_.RunUntilFetchEvent();
diff --git a/content/renderer/service_worker/worker_fetch_context_impl.cc b/content/renderer/service_worker/worker_fetch_context_impl.cc
index 1ce3e9f..bd205b4 100644
--- a/content/renderer/service_worker/worker_fetch_context_impl.cc
+++ b/content/renderer/service_worker/worker_fetch_context_impl.cc
@@ -54,7 +54,7 @@
   }
 
   void SetServiceWorkerURLLoaderFactory(
-      mojom::URLLoaderFactoryPtr service_worker_url_loader_factory) {
+      network::mojom::URLLoaderFactoryPtr service_worker_url_loader_factory) {
     service_worker_url_loader_factory_ =
         base::MakeRefCounted<WrapperSharedURLLoaderFactory>(
             std::move(service_worker_url_loader_factory));
@@ -282,7 +282,7 @@
     url_loader_factory_->SetServiceWorkerURLLoaderFactory(nullptr);
     return;
   }
-  mojom::URLLoaderFactoryPtr service_worker_url_loader_factory;
+  network::mojom::URLLoaderFactoryPtr service_worker_url_loader_factory;
   mojo::MakeStrongBinding(
       std::make_unique<ServiceWorkerSubresourceLoaderFactory>(
           base::MakeRefCounted<ControllerServiceWorkerConnector>(
diff --git a/content/renderer/service_worker/worker_fetch_context_impl.h b/content/renderer/service_worker/worker_fetch_context_impl.h
index 71fe2e6..1bc77171 100644
--- a/content/renderer/service_worker/worker_fetch_context_impl.h
+++ b/content/renderer/service_worker/worker_fetch_context_impl.h
@@ -8,10 +8,10 @@
 #include "content/common/service_worker/service_worker_provider.mojom.h"
 #include "content/common/service_worker/service_worker_types.h"
 #include "content/public/common/service_worker_modes.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "content/public/renderer/child_url_loader_factory_getter.h"
 #include "ipc/ipc_message.h"
 #include "mojo/public/cpp/bindings/binding.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 #include "third_party/WebKit/common/blob/blob_registry.mojom.h"
 #include "third_party/WebKit/common/service_worker/service_worker_object.mojom.h"
 #include "third_party/WebKit/public/platform/WebApplicationCacheHost.h"
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.cc b/content/renderer/shared_worker/embedded_shared_worker_stub.cc
index 10d0574..0a4f82d 100644
--- a/content/renderer/shared_worker/embedded_shared_worker_stub.cc
+++ b/content/renderer/shared_worker/embedded_shared_worker_stub.cc
@@ -321,9 +321,9 @@
   impl_->TerminateWorkerContext();
 }
 
-void EmbeddedSharedWorkerStub::GetDevToolsAgent(
+void EmbeddedSharedWorkerStub::BindDevToolsAgent(
     blink::mojom::DevToolsAgentAssociatedRequest request) {
-  impl_->GetDevToolsAgent(request.PassHandle());
+  impl_->BindDevToolsAgent(request.PassHandle());
 }
 
 }  // namespace content
diff --git a/content/renderer/shared_worker/embedded_shared_worker_stub.h b/content/renderer/shared_worker/embedded_shared_worker_stub.h
index 581dbba..3cd4ff8c 100644
--- a/content/renderer/shared_worker/embedded_shared_worker_stub.h
+++ b/content/renderer/shared_worker/embedded_shared_worker_stub.h
@@ -90,7 +90,7 @@
   void Connect(int connection_request_id,
                mojo::ScopedMessagePipeHandle port) override;
   void Terminate() override;
-  void GetDevToolsAgent(
+  void BindDevToolsAgent(
       blink::mojom::DevToolsAgentAssociatedRequest request) override;
 
   mojo::Binding<mojom::SharedWorker> binding_;
diff --git a/content/test/DEPS b/content/test/DEPS
index 2b03181..ea8425c 100644
--- a/content/test/DEPS
+++ b/content/test/DEPS
@@ -22,6 +22,7 @@
   "+services/catalog",
   "+services/device/public/cpp/generic_sensor",
   "+services/network/public/cpp",
+  "+services/network/public/interfaces",
   "+services/proxy_resolver",
   "+services/service_manager/public",
   "+ui/base/resource/data_pack.h",
diff --git a/content/test/test_navigation_url_loader.cc b/content/test/test_navigation_url_loader.cc
index 70feec3..dc2b6200 100644
--- a/content/test/test_navigation_url_loader.cc
+++ b/content/test/test_navigation_url_loader.cc
@@ -16,9 +16,9 @@
 #include "content/public/browser/stream_handle.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/browser_side_navigation_policy.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/url_request/redirect_info.h"
 #include "services/network/public/cpp/resource_response.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace content {
 
@@ -74,10 +74,10 @@
           ->GetProcess()
           ->GetID();
   GlobalRequestID global_id(child_id, ++request_id);
-  delegate_->OnResponseStarted(response, mojom::URLLoaderClientEndpointsPtr(),
-                               std::move(body), net::SSLInfo(),
-                               std::move(navigation_data), global_id, false,
-                               false, base::nullopt);
+  delegate_->OnResponseStarted(
+      response, network::mojom::URLLoaderClientEndpointsPtr(), std::move(body),
+      net::SSLInfo(), std::move(navigation_data), global_id, false, false,
+      base::nullopt);
 }
 
 TestNavigationURLLoader::~TestNavigationURLLoader() {}
diff --git a/content/test/test_navigation_url_loader_delegate.cc b/content/test/test_navigation_url_loader_delegate.cc
index 5a047cf..edfa504 100644
--- a/content/test/test_navigation_url_loader_delegate.cc
+++ b/content/test/test_navigation_url_loader_delegate.cc
@@ -59,7 +59,7 @@
 
 void TestNavigationURLLoaderDelegate::OnResponseStarted(
     const scoped_refptr<network::ResourceResponse>& response,
-    mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+    network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
     std::unique_ptr<StreamHandle> body,
     const net::SSLInfo& ssl_info,
     std::unique_ptr<NavigationData> navigation_data,
diff --git a/content/test/test_navigation_url_loader_delegate.h b/content/test/test_navigation_url_loader_delegate.h
index 41114ad..3d83d7c 100644
--- a/content/test/test_navigation_url_loader_delegate.h
+++ b/content/test/test_navigation_url_loader_delegate.h
@@ -62,7 +62,7 @@
       const scoped_refptr<network::ResourceResponse>& response) override;
   void OnResponseStarted(
       const scoped_refptr<network::ResourceResponse>& response,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       std::unique_ptr<StreamHandle> body,
       const net::SSLInfo& ssl_info,
       std::unique_ptr<NavigationData> navigation_data,
@@ -79,7 +79,7 @@
  private:
   net::RedirectInfo redirect_info_;
   scoped_refptr<network::ResourceResponse> redirect_response_;
-  mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints_;
+  network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints_;
   scoped_refptr<network::ResourceResponse> response_;
   std::unique_ptr<StreamHandle> body_;
   int net_error_;
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc
index 1852366..9e07a73 100644
--- a/content/test/test_render_frame.cc
+++ b/content/test/test_render_frame.cc
@@ -140,11 +140,11 @@
 
 void TestRenderFrame::Navigate(const CommonNavigationParams& common_params,
                                const RequestNavigationParams& request_params) {
-  CommitNavigation(network::ResourceResponseHead(), GURL(), common_params,
-                   request_params, mojom::URLLoaderClientEndpointsPtr(),
-                   URLLoaderFactoryBundle(),
-                   mojom::ControllerServiceWorkerInfoPtr(),
-                   base::UnguessableToken::Create());
+  CommitNavigation(
+      network::ResourceResponseHead(), GURL(), common_params, request_params,
+      network::mojom::URLLoaderClientEndpointsPtr(), URLLoaderFactoryBundle(),
+      mojom::ControllerServiceWorkerInfoPtr(),
+      base::UnguessableToken::Create());
 }
 
 void TestRenderFrame::SwapOut(
diff --git a/content/test/test_render_frame_host.cc b/content/test/test_render_frame_host.cc
index 52eac582..b686f96 100644
--- a/content/test/test_render_frame_host.cc
+++ b/content/test/test_render_frame_host.cc
@@ -63,7 +63,7 @@
       const GURL& body_url,
       const CommonNavigationParams& common_params,
       const RequestNavigationParams& request_params,
-      mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
+      network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
       base::Optional<URLLoaderFactoryBundle> subresource_loader_factories,
       mojom::ControllerServiceWorkerInfoPtr controller_service_worker,
       const base::UnguessableToken& devtools_navigation_token) override {
diff --git a/device/vr/features/features.gni b/device/vr/features/features.gni
index 61294ee7..4b927fd 100644
--- a/device/vr/features/features.gni
+++ b/device/vr/features/features.gni
@@ -21,7 +21,11 @@
 
 declare_args() {
   # Enable VR device support whenever VR device SDK(s) are supported.
-  enable_vr = enable_gvr_services || enable_openvr || enable_oculus_vr
+  # We enable VR on Linux even though VR features aren't usable because
+  # the binary size impact is small and allows many VR tests to run on Linux
+  enable_vr =
+      enable_gvr_services || enable_openvr || enable_oculus_vr ||
+      (is_desktop_linux && (current_cpu == "x64" || current_cpu == "x86"))
 
   # Whether to include VR extras like test APKs in non-VR-specific targets
   include_vr_data = false
diff --git a/docs/accessibility/patts.md b/docs/accessibility/patts.md
index 7d67ee8..65416008 100644
--- a/docs/accessibility/patts.md
+++ b/docs/accessibility/patts.md
@@ -14,11 +14,26 @@
 When debugging, start Chrome from the command-line and set the
 NACL_PLUGIN_DEBUG environment variable to 1 to print log messages to stdout.
 
+If running on Chrome OS on desktop Linux, you can put the unpacked extension in
+your downloads directory, and hide the existing TTS extension by temporarily
+renaming /usr/share/chromeos-assets to something else. Then in
+chrome://extensions you can enable developer mode and "load unpacked extension".
+You must hide the existing TTS extension because extension keys must not be
+duplicated, and ChromeOS will crash if you try to load the unpacked extension
+while the built-in one is already loaded.
+
+To test, use the [https://chrome.google.com/webstore/detail/tts-demo/chhkejkkcghanjclmhhpncachhgejoel](TTS Demo extension)
+in Chromeos. This should automatically recognize the unpacked TTS extension
+based on its manifest key. You can also use any site that uses a web speech API
+demo. In addition, the Chrome Accessibility team has a 
+[https://chrome.google.com/webstore/detail/idllbaaoaldabjncnbfokacibfehkemd](TTS Debug extension)
+which can run several automated tests.
+
 ## Updating
 
 First, follow the public
 [Chromium OS Developer Guide](http://www.chromium.org/chromium-os/developer-guide) to check out the source.
-At a minimum you'll need to create a chroot.
+At a minimum you'll need to create a chroot and initialize the build for your board.
 You do not need to build everything from source.
 You do need to start the devserver.
 
@@ -58,8 +73,13 @@
 
 When updating the files, the native client files (nexe) need to be zipped.
 
-Replace all of the files you need to update, commit them using git,
-then from the chroot, run:
+Replace all of the files you need to update. You will probably not need
+to update the manifest.json, tts_main.js or tts_controller.js, as these
+are probably most up-to-date on ChromeOS and not google3. Look at recent
+commit history on both platforms to determine what changes should be
+pushed.
+
+Commit your changes using git, then from the chroot, run:
 
 ```
 emerge-$BOARD common-assets
@@ -82,6 +102,10 @@
 repo upload .
 ```
 
+After submitting, inform the [mailto:chrome-a11y-core@google.com](Chrome Accessibility team)
+so that they can update their local copies of TTS per the
+[https://chromium.googlesource.com/chromium/src/+/lkgr/docs/accessibility/chromevox_on_desktop_linux.md](Chromevox instructions).
+
 ## Ebuild
 
 Note that sometimes you'll have to update the ebuild file that
diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS
index c41f134..bde65cb 100644
--- a/extensions/browser/DEPS
+++ b/extensions/browser/DEPS
@@ -25,6 +25,7 @@
   "+ppapi/features",
   "+services/data_decoder/public/cpp",
   "+services/network/public/cpp",
+  "+services/network/public/interfaces",
   "+services/preferences/public/cpp",
   "+services/service_manager/public/cpp",
   "+skia/ext/image_operations.h",
diff --git a/extensions/browser/extension_protocols.cc b/extensions/browser/extension_protocols.cc
index 67780ec..6481dfd8 100644
--- a/extensions/browser/extension_protocols.cc
+++ b/extensions/browser/extension_protocols.cc
@@ -732,13 +732,13 @@
     const std::string& extension_id,
     const base::FilePath& directory_path,
     const base::FilePath& relative_path,
-    content::mojom::URLLoaderRequest loader,
-    content::mojom::URLLoaderClientPtrInfo client_info,
+    network::mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderClientPtrInfo client_info,
     scoped_refptr<ContentVerifyJob> verify_job) {
   // NOTE: ExtensionResource::GetFilePath() must be called on a sequence which
   // tolerates blocking operations.
   ExtensionResource resource(extension_id, directory_path, relative_path);
-  content::mojom::URLLoaderClientPtr client;
+  network::mojom::URLLoaderClientPtr client;
   client.Bind(std::move(client_info));
 
   auto loader_observer =
@@ -755,8 +755,8 @@
     const std::string& extension_id,
     const base::FilePath& directory_path,
     const base::FilePath& relative_path,
-    content::mojom::URLLoaderRequest loader,
-    content::mojom::URLLoaderClientPtr client,
+    network::mojom::URLLoaderRequest loader,
+    network::mojom::URLLoaderClientPtr client,
     scoped_refptr<extensions::InfoMap> extension_info_map) {
   scoped_refptr<ContentVerifyJob> verify_job;
   ContentVerifier* verifier = extension_info_map->content_verifier();
@@ -777,7 +777,7 @@
                      std::move(verify_job)));
 }
 
-class ExtensionURLLoaderFactory : public content::mojom::URLLoaderFactory {
+class ExtensionURLLoaderFactory : public network::mojom::URLLoaderFactory {
  public:
   // |frame_host| is the RenderFrameHost which is either being navigated or
   // loading a subresource. For navigation requests, |frame_url| is empty; for
@@ -790,13 +790,13 @@
         extension_info_map_(nullptr) {}
   ~ExtensionURLLoaderFactory() override = default;
 
-  // content::mojom::URLLoaderFactory:
-  void CreateLoaderAndStart(content::mojom::URLLoaderRequest loader,
+  // network::mojom::URLLoaderFactory:
+  void CreateLoaderAndStart(network::mojom::URLLoaderRequest loader,
                             int32_t routing_id,
                             int32_t request_id,
                             uint32_t options,
                             const network::ResourceRequest& request,
-                            content::mojom::URLLoaderClientPtr client,
+                            network::mojom::URLLoaderClientPtr client,
                             const net::MutableNetworkTrafficAnnotationTag&
                                 traffic_annotation) override {
     content::RenderProcessHost* process_host = frame_host_->GetProcess();
@@ -921,7 +921,7 @@
                        std::move(client), extension_info_map_));
   }
 
-  void Clone(content::mojom::URLLoaderFactoryRequest request) override {
+  void Clone(network::mojom::URLLoaderFactoryRequest request) override {
     bindings_.AddBinding(this, std::move(request));
   }
 
@@ -930,7 +930,7 @@
   const GURL frame_url_;
   scoped_refptr<extensions::InfoMap> extension_info_map_;
 
-  mojo::BindingSet<content::mojom::URLLoaderFactory> bindings_;
+  mojo::BindingSet<network::mojom::URLLoaderFactory> bindings_;
 
   DISALLOW_COPY_AND_ASSIGN(ExtensionURLLoaderFactory);
 };
@@ -986,13 +986,13 @@
   g_test_handler = handler;
 }
 
-std::unique_ptr<content::mojom::URLLoaderFactory>
+std::unique_ptr<network::mojom::URLLoaderFactory>
 CreateExtensionNavigationURLLoaderFactory(
     content::RenderFrameHost* frame_host) {
   return std::make_unique<ExtensionURLLoaderFactory>(frame_host, GURL());
 }
 
-std::unique_ptr<content::mojom::URLLoaderFactory>
+std::unique_ptr<network::mojom::URLLoaderFactory>
 MaybeCreateExtensionSubresourceURLLoaderFactory(
     content::RenderFrameHost* frame_host,
     const GURL& frame_url) {
diff --git a/extensions/browser/extension_protocols.h b/extensions/browser/extension_protocols.h
index 85bda73..4d260ca7 100644
--- a/extensions/browser/extension_protocols.h
+++ b/extensions/browser/extension_protocols.h
@@ -10,8 +10,8 @@
 
 #include "base/callback.h"
 #include "base/memory/ref_counted.h"
-#include "content/public/common/url_loader_factory.mojom.h"
 #include "net/url_request/url_request_job_factory.h"
+#include "services/network/public/interfaces/url_loader_factory.mojom.h"
 
 namespace base {
 class FilePath;
@@ -53,16 +53,16 @@
 // way to map extra resources to be included in extensions.
 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler);
 
-// Creates a new content::mojom::URLLoaderFactory implementation suitable for
+// Creates a new network::mojom::URLLoaderFactory implementation suitable for
 // handling navigation requests to extension URLs.
-std::unique_ptr<content::mojom::URLLoaderFactory>
+std::unique_ptr<network::mojom::URLLoaderFactory>
 CreateExtensionNavigationURLLoaderFactory(content::RenderFrameHost* frame_host);
 
-// Attempts to create a content::mojom::URLLoaderFactory implementation suitable
+// Attempts to create a network::mojom::URLLoaderFactory implementation suitable
 // for handling subresource requests for extension URLs from |frame_host|. May
 // return null if |frame_host| is never allowed to load extension subresources
 // from its current navigation URL.
-std::unique_ptr<content::mojom::URLLoaderFactory>
+std::unique_ptr<network::mojom::URLLoaderFactory>
 MaybeCreateExtensionSubresourceURLLoaderFactory(
     content::RenderFrameHost* frame_host,
     const GURL& frame_url);
diff --git a/extensions/browser/extensions_browser_client.h b/extensions/browser/extensions_browser_client.h
index 69434c7..267a4012 100644
--- a/extensions/browser/extensions_browser_client.h
+++ b/extensions/browser/extensions_browser_client.h
@@ -13,10 +13,10 @@
 #include "build/build_config.h"
 #include "content/public/browser/bluetooth_chooser.h"
 #include "content/public/common/resource_type.h"
-#include "content/public/common/url_loader.mojom.h"
 #include "extensions/browser/extension_event_histogram_value.h"
 #include "extensions/browser/extension_prefs_observer.h"
 #include "extensions/common/view_type.h"
+#include "services/network/public/interfaces/url_loader.mojom.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
 #include "ui/base/page_transition_types.h"
 
diff --git a/ios/build/tools/setup-gn.py b/ios/build/tools/setup-gn.py
index 2c55b54..ec0d7785 100755
--- a/ios/build/tools/setup-gn.py
+++ b/ios/build/tools/setup-gn.py
@@ -24,11 +24,6 @@
 SUPPORTED_CONFIGS = ('Debug', 'Release', 'Profile', 'Official', 'Coverage')
 
 
-def IsRunningOnABot():
-  '''Returns True if the script thinks it is running on a bot.'''
-  return any(key for key in os.environ.keys() if 'BUILDBOT_' in key)
-
-
 class ConfigParserWithStringInterpolation(ConfigParser.SafeConfigParser):
 
   '''A .ini file parser that supports strings and environment variables.'''
@@ -296,10 +291,6 @@
 
 
 def Main(args):
-  if IsRunningOnABot():
-    sys.stdout.write('Running on a bot, skipped.\n')
-    return
-
   default_root = os.path.normpath(os.path.join(
       os.path.dirname(__file__), os.pardir, os.pardir, os.pardir))
 
diff --git a/ios/chrome/browser/metrics/ukm_egtest.mm b/ios/chrome/browser/metrics/ukm_egtest.mm
index a76297c4..da1734e 100644
--- a/ios/chrome/browser/metrics/ukm_egtest.mm
+++ b/ios/chrome/browser/metrics/ukm_egtest.mm
@@ -156,6 +156,12 @@
   GREYAssert(IsIncognitoMode(), @"Failed to switch to incognito mode.");
 }
 
+void CloseCurrentIncognitoTab() {
+  NSUInteger incognito_tab_count = GetIncognitoTabCount();
+  chrome_test_util::CloseCurrentTab();
+  [ChromeEarlGrey waitForIncognitoTabCount:(incognito_tab_count - 1)];
+}
+
 void CloseAllIncognitoTabs() {
   GREYAssert(chrome_test_util::CloseAllIncognitoTabs(), @"Tabs did not close");
   [ChromeEarlGrey waitForIncognitoTabCount:0];
@@ -169,6 +175,12 @@
   GREYAssert(!IsIncognitoMode(), @"Failed to switch to normal mode.");
 }
 
+void OpenNewRegularTab() {
+  NSUInteger tab_count = chrome_test_util::GetMainTabCount();
+  chrome_test_util::OpenNewTab();
+  [ChromeEarlGrey waitForMainTabCount:(tab_count + 1)];
+}
+
 // Signs in to sync.
 void SignIn() {
   ChromeIdentity* identity = [SigninEarlGreyUtils fakeIdentity1];
@@ -276,16 +288,25 @@
 }
 
 // Make sure that UKM is disabled while an incognito tab is open.
-- (void)testIncognito {
+- (void)testRegularPlusIncognito {
   uint64_t original_client_id = metrics::UkmEGTestHelper::client_id();
 
   OpenNewIncognitoTab();
+  AssertUKMEnabled(false);
 
+  // Opening another regular tab mustn't enable UKM.
+  OpenNewRegularTab();
+  AssertUKMEnabled(false);
+
+  // Opening and closing an incognito tab mustn't enable UKM.
+  OpenNewIncognitoTab();
+  AssertUKMEnabled(false);
+  CloseCurrentIncognitoTab();
   AssertUKMEnabled(false);
 
   CloseAllIncognitoTabs();
-
   AssertUKMEnabled(true);
+
   // Client ID should not have been reset.
   GREYAssert(original_client_id == metrics::UkmEGTestHelper::client_id(),
              @"Client ID was reset.");
diff --git a/ios/chrome/browser/ntp_snippets/BUILD.gn b/ios/chrome/browser/ntp_snippets/BUILD.gn
index 1edd553..83f64df 100644
--- a/ios/chrome/browser/ntp_snippets/BUILD.gn
+++ b/ios/chrome/browser/ntp_snippets/BUILD.gn
@@ -33,5 +33,6 @@
     "//ios/chrome/common",
     "//ios/web",
     "//net",
+    "//services/identity/public/cpp",
   ]
 }
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc
index c2467bc..9e1e0832 100644
--- a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc
+++ b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.cc
@@ -15,6 +15,7 @@
 #include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.h"
 #include "ios/chrome/browser/pref_names.h"
 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
+#include "ios/chrome/browser/signin/identity_manager_factory.h"
 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
 #include "ios/chrome/browser/signin/signin_manager_factory.h"
 
@@ -46,6 +47,7 @@
     : BrowserStateKeyedServiceFactory(
           "ContentSuggestionsService",
           BrowserStateDependencyManager::GetInstance()) {
+  DependsOn(IdentityManagerFactory::GetInstance());
   DependsOn(ios::HistoryServiceFactory::GetInstance());
   DependsOn(IOSChromeLargeIconServiceFactory::GetInstance());
   DependsOn(OAuth2TokenServiceFactory::GetInstance());
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
index 3a7fd22..2b97a94 100644
--- a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
+++ b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.cc
@@ -46,7 +46,7 @@
 #include "ios/chrome/browser/history/history_service_factory.h"
 #include "ios/chrome/browser/pref_names.h"
 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
-#include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
+#include "ios/chrome/browser/signin/identity_manager_factory.h"
 #include "ios/chrome/browser/signin/signin_manager_factory.h"
 #include "ios/chrome/common/channel_info.h"
 #include "ios/web/public/browser_state.h"
@@ -162,9 +162,8 @@
   PrefService* prefs = chrome_browser_state->GetPrefs();
   SigninManager* signin_manager =
       ios::SigninManagerFactory::GetForBrowserState(chrome_browser_state);
-
-  OAuth2TokenService* token_service =
-      OAuth2TokenServiceFactory::GetForBrowserState(chrome_browser_state);
+  identity::IdentityManager* identity_manager =
+      IdentityManagerFactory::GetForBrowserState(chrome_browser_state);
   scoped_refptr<net::URLRequestContextGetter> request_context =
       browser_state->GetRequestContext();
   base::FilePath database_dir(
@@ -179,8 +178,8 @@
                                 : google_apis::GetNonStableAPIKey();
   }
   auto suggestions_fetcher = base::MakeUnique<RemoteSuggestionsFetcherImpl>(
-      signin_manager, token_service, request_context, prefs, nullptr,
-      base::Bind(&ParseJson), GetFetchEndpoint(GetChannel()), api_key,
+      identity_manager, request_context, prefs, nullptr,
+      base::BindRepeating(&ParseJson), GetFetchEndpoint(GetChannel()), api_key,
       service->user_classifier());
 
   // This pref is also used for logging. If it is changed, change it in the
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm
index 06124c1..adedd74 100644
--- a/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm
+++ b/ios/chrome/browser/ui/ntp/new_tab_page_controller.mm
@@ -184,6 +184,7 @@
     } else {
       _currentController = self.homePanel;
     }
+    [_currentController wasShown];
   }
   return self;
 }
@@ -353,7 +354,7 @@
     // is initiated, and when WebController calls -willBeDismissed.
     DCHECK(panelController);
     [self.parentViewController addChildViewController:panelController];
-    [self.view addSubview:view];
+    [self.view insertSubview:view belowSubview:self.view.tabBar];
     self.view.contentView = view;
     [panelController didMoveToParentViewController:self.parentViewController];
   }
diff --git a/ios/chrome/browser/ui/webui/web_ui_egtest.mm b/ios/chrome/browser/ui/webui/web_ui_egtest.mm
index a2ffc52c..0351366 100644
--- a/ios/chrome/browser/ui/webui/web_ui_egtest.mm
+++ b/ios/chrome/browser/ui/webui/web_ui_egtest.mm
@@ -133,7 +133,7 @@
 
 // Tests that back and forward navigation between chrome URLs functions
 // properly.
-- (void)testChromeURLBackAndForwardNavigation {
+- (void)testChromeURLBackAndForwardAndReloadNavigation {
   // Navigate to the first URL chrome://version.
   LoadWebUIUrl(kChromeUIVersionHost);
 
@@ -152,6 +152,20 @@
       performAction:grey_tap()];
   [[EarlGrey selectElementWithMatcher:WaitForOmniboxText("chrome://flags")]
       assertWithMatcher:grey_notNil()];
+
+  // Tap the back button in the toolbar then reload, and verify that the
+  // resulting page corresponds to the first URL.
+  [[EarlGrey selectElementWithMatcher:BackButton()] performAction:grey_tap()];
+  [ChromeEarlGrey waitForPageToFinishLoading];
+  [ChromeEarlGrey reload];
+  [[EarlGrey selectElementWithMatcher:WaitForOmniboxText("chrome://version")]
+      assertWithMatcher:grey_notNil()];
+
+  // Make sure forward navigation is still possible.
+  [[EarlGrey selectElementWithMatcher:ForwardButton()]
+      performAction:grey_tap()];
+  [[EarlGrey selectElementWithMatcher:WaitForOmniboxText("chrome://flags")]
+      assertWithMatcher:grey_notNil()];
 }
 
 // Tests that all URLs on chrome://chrome-urls page load without error.
diff --git a/ios/web/navigation/navigation_manager_impl.h b/ios/web/navigation/navigation_manager_impl.h
index aaea3e1c..898fedd 100644
--- a/ios/web/navigation/navigation_manager_impl.h
+++ b/ios/web/navigation/navigation_manager_impl.h
@@ -216,6 +216,9 @@
   // Subclass specific implementation to update session state.
   virtual void FinishGoToIndex(int index, NavigationInitiationType type) = 0;
 
+  // Returns true if the subclass uses placeholder URLs and this is such a URL.
+  virtual bool IsPlaceholderUrl(const GURL& url) const;
+
   // The primary delegate for this manager.
   NavigationManagerDelegate* delegate_;
 
diff --git a/ios/web/navigation/navigation_manager_impl.mm b/ios/web/navigation/navigation_manager_impl.mm
index 88c7328..e56ba9a 100644
--- a/ios/web/navigation/navigation_manager_impl.mm
+++ b/ios/web/navigation/navigation_manager_impl.mm
@@ -332,13 +332,18 @@
         &loaded_url, browser_state_);
   }
 
-  if (initiation_type == web::NavigationInitiationType::RENDERER_INITIATED &&
+  // The URL should not be changed to app-specific URL in two cases:
+  // 1) The load is renderer-initiated requested by non-app-specific URL. Pages
+  //    with app-specific urls have elevated previledges and should not be
+  //    allowed to open app-specific URLs.
+  // 2) The load is a placeholder URL. Navigation code relies on this special
+  //    URL to implement native view and WebUI.
+  bool is_renderer_initiated_app_specific_url_from_non_app_specific_url =
+      initiation_type == web::NavigationInitiationType::RENDERER_INITIATED &&
       loaded_url != url && web::GetWebClient()->IsAppSpecificURL(loaded_url) &&
-      !web::GetWebClient()->IsAppSpecificURL(previous_url)) {
-    // The URL should not be changed to app-specific URL if the load was
-    // renderer-initiated requested by non app-specific URL. Pages with
-    // app-specific urls have elevated previledges and should not be allowed
-    // to open app-specific URLs.
+      !web::GetWebClient()->IsAppSpecificURL(previous_url);
+  if (is_renderer_initiated_app_specific_url_from_non_app_specific_url ||
+      IsPlaceholderUrl(url)) {
     loaded_url = url;
   }
 
@@ -366,4 +371,8 @@
   return nullptr;
 }
 
+bool NavigationManagerImpl::IsPlaceholderUrl(const GURL& url) const {
+  return false;  // Default implementation doesn't use placeholder URLs
+}
+
 }  // namespace web
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.h b/ios/web/navigation/wk_based_navigation_manager_impl.h
index 62e4610..d762ccd6 100644
--- a/ios/web/navigation/wk_based_navigation_manager_impl.h
+++ b/ios/web/navigation/wk_based_navigation_manager_impl.h
@@ -131,6 +131,7 @@
   NavigationItemImpl* GetTransientItemImpl() const override;
   void FinishGoToIndex(int index,
                        NavigationInitiationType initiation_type) override;
+  bool IsPlaceholderUrl(const GURL& url) const override;
 
   // Returns the absolute index of WKBackForwardList's |currentItem|. Returns -1
   // if |currentItem| is nil.
diff --git a/ios/web/navigation/wk_based_navigation_manager_impl.mm b/ios/web/navigation/wk_based_navigation_manager_impl.mm
index cbebea8..2710ba4 100644
--- a/ios/web/navigation/wk_based_navigation_manager_impl.mm
+++ b/ios/web/navigation/wk_based_navigation_manager_impl.mm
@@ -532,6 +532,10 @@
   }
 }
 
+bool WKBasedNavigationManagerImpl::IsPlaceholderUrl(const GURL& url) const {
+  return placeholder_navigation_util::IsPlaceholderUrl(url);
+}
+
 int WKBasedNavigationManagerImpl::GetWKCurrentItemIndex() const {
   id<CRWWebViewNavigationProxy> proxy = delegate_->GetWebViewNavigationProxy();
   if (proxy.backForwardList.currentItem) {
diff --git a/ios/web/web_state/js/resources/common.js b/ios/web/web_state/js/resources/common.js
index a0c4e36..9c436230 100644
--- a/ios/web/web_state/js/resources/common.js
+++ b/ios/web/web_state/js/resources/common.js
@@ -654,6 +654,10 @@
     // Some frameworks will use the data field to update their cache value.
     changeEvent.data = element.value;
 
+    // Adding a |simulated| flag on the event will force the React framework to
+    // update the backend store.
+    changeEvent.simulated = true;
+
     // A timer is used to avoid reentering JavaScript evaluation.
     window.setTimeout(function() {
       element.dispatchEvent(changeEvent);
diff --git a/ios/web/web_state/navigation_and_load_callbacks_inttest.mm b/ios/web/web_state/navigation_and_load_callbacks_inttest.mm
index 2b64715..ef931a8 100644
--- a/ios/web/web_state/navigation_and_load_callbacks_inttest.mm
+++ b/ios/web/web_state/navigation_and_load_callbacks_inttest.mm
@@ -336,12 +336,11 @@
  public:
   WebStateObserverMock() = default;
 
-  MOCK_METHOD2(DidStartNavigation,
-               void(WebState* web_state, NavigationContext* context));
-  MOCK_METHOD2(DidFinishNavigation,
-               void(WebState* web_state, NavigationContext* context));
-  MOCK_METHOD1(DidStartLoading, void(WebState* web_state));
-  MOCK_METHOD1(DidStopLoading, void(WebState* web_state));
+  MOCK_METHOD2(DidStartNavigation, void(WebState*, NavigationContext*));
+  MOCK_METHOD2(DidFinishNavigation, void(WebState*, NavigationContext*));
+  MOCK_METHOD1(DidStartLoading, void(WebState*));
+  MOCK_METHOD1(DidStopLoading, void(WebState*));
+  MOCK_METHOD2(PageLoaded, void(WebState*, PageLoadCompletionStatus));
   void WebStateDestroyed(WebState* web_state) override { NOTREACHED(); }
 
  private:
@@ -420,6 +419,8 @@
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
 }
 
@@ -445,6 +446,8 @@
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
 
   LoadUrl(url);
   web_state()->SetWebUsageEnabled(true);
@@ -462,6 +465,10 @@
   EXPECT_CALL(observer_, DidStartNavigation(web_state(), _))
       .WillOnce(VerifyNewPageStartedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  // TODO(crbug.com/803232): PageLoaded() should be called after
+  // DidFinishNavigation().
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::FAILURE));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyErrorFinishedContext(web_state(), url, &context));
   // LoadUrl() expects sucessfull load and can not be used here.
@@ -486,6 +493,8 @@
       .WillOnce(Return(true));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
 
   // Reload web page.
@@ -500,6 +509,8 @@
       .WillOnce(VerifyReloadFinishedContext(web_state(), url, &context,
                                             true /* is_web_page */));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current
   // delegate does not run callback for ShowRepostFormWarningDialog. Clearing
   // the delegate will allow form resubmission. Remove this workaround (clearing
@@ -529,6 +540,8 @@
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
 
   // Perform same-document navigation.
@@ -547,6 +560,8 @@
           ui::PageTransition::PAGE_TRANSITION_TYPED,
           /*renderer_initiated=*/false));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(hash_url);
 
   // Perform same-document navigation by going back.
@@ -565,6 +580,8 @@
           ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK,
           /*renderer_initiated=*/false));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   ExecuteBlockAndWaitForLoad(url, ^{
     navigation_manager()->GoBack();
   });
@@ -588,6 +605,8 @@
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
 
   // Perform same-page navigation using JavaScript.
@@ -606,6 +625,8 @@
           ui::PageTransition::PAGE_TRANSITION_CLIENT_REDIRECT,
           /*renderer_initiated=*/true));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   ExecuteJavaScript(@"window.location.hash = '#1'");
 }
 
@@ -627,6 +648,8 @@
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyNewPageFinishedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
 
   // Perform push state using JavaScript.
@@ -674,6 +697,8 @@
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _))
       .WillOnce(VerifyNewNativePageFinishedContext(web_state(), url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   [provider_ setController:content_ forURL:url];
   LoadUrl(url);
 }
@@ -687,6 +712,8 @@
   // navigations.
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   [provider_ setController:content_ forURL:url];
   LoadUrl(url);
 
@@ -701,6 +728,8 @@
       .WillOnce(VerifyReloadFinishedContext(web_state(), url, &context,
                                             false /* is_web_page */));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   navigation_manager()->Reload(ReloadType::NORMAL, false /*check_for_repost*/);
 }
 
@@ -726,6 +755,8 @@
       .WillOnce(VerifyPostFinishedContext(web_state(), url, &context,
                                           /*renderer_initiated=*/false));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
 
   // Load request using POST HTTP method.
   web::NavigationManager::WebLoadParams params(url);
@@ -754,6 +785,8 @@
       .WillOnce(Return(true));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
   ASSERT_TRUE(WaitForWebViewContainingText(web_state(), kTestPageText));
 
@@ -770,6 +803,8 @@
       .WillOnce(VerifyPostFinishedContext(web_state(), action, &context,
                                           /*renderer_initiated=*/true));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   ExecuteJavaScript(@"document.getElementById('form').submit();");
   ASSERT_TRUE(WaitForWebViewContainingText(web_state(), responses[action]));
 }
@@ -793,6 +828,8 @@
       .WillOnce(Return(true));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
   ASSERT_TRUE(WaitForWebViewContainingText(web_state(), kTestPageText));
 
@@ -804,6 +841,8 @@
       .WillOnce(Return(true));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   ExecuteJavaScript(@"window.document.getElementById('form').submit();");
   ASSERT_TRUE(WaitForWebViewContainingText(web_state(), responses[action]));
 
@@ -820,6 +859,8 @@
       .WillOnce(VerifyPostFinishedContext(web_state(), action, &context,
                                           /*renderer_initiated=*/true));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current
   // delegate does not run callback for ShowRepostFormWarningDialog. Clearing
   // the delegate will allow form resubmission. Remove this workaround (clearing
@@ -850,6 +891,8 @@
       .WillOnce(Return(true));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
   ASSERT_TRUE(WaitForWebViewContainingText(web_state(), kTestPageText));
 
@@ -861,6 +904,8 @@
       .WillOnce(Return(true));
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   ExecuteJavaScript(@"window.document.getElementById('form').submit();");
   ASSERT_TRUE(WaitForWebViewContainingText(web_state(), responses[action]));
 
@@ -883,6 +928,8 @@
   }
   EXPECT_CALL(observer_, DidFinishNavigation(web_state(), _));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   ExecuteBlockAndWaitForLoad(url, ^{
     navigation_manager()->GoBack();
   });
@@ -903,6 +950,8 @@
       .WillOnce(VerifyPostFinishedContext(web_state(), action, &context,
                                           /*renderer_initiated=*/false));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   // TODO(crbug.com/700958): ios/web ignores |check_for_repost| flag and current
   // delegate does not run callback for ShowRepostFormWarningDialog. Clearing
   // the delegate will allow form resubmission. Remove this workaround (clearing
@@ -939,6 +988,8 @@
       .WillOnce(
           VerifyNewPageFinishedContext(web_state(), redirect_url, &context));
   EXPECT_CALL(observer_, DidStopLoading(web_state()));
+  EXPECT_CALL(observer_,
+              PageLoaded(web_state(), PageLoadCompletionStatus::SUCCESS));
   LoadUrl(url);
 }
 
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm
index 551a1c5..6da4349 100644
--- a/ios/web/web_state/ui/crw_web_controller.mm
+++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -1193,7 +1193,8 @@
       return [self.nativeController url];
     }
   }
-  web::NavigationItem* item = self.currentNavItem;
+  web::NavigationItem* item =
+      self.navigationManagerImpl->GetLastCommittedItem();
   return item ? item->GetVirtualURL() : GURL::EmptyGURL();
 }
 
@@ -1435,8 +1436,12 @@
 
   if (!IsPlaceholderUrl(requestURL)) {
     _webStateImpl->SetIsLoading(true);
+
+    // WKBasedNavigationManager triggers HTML load when placeholder navigation
+    // finishes.
+    if (!web::GetWebClient()->IsSlimNavigationManagerEnabled())
+      [_webUIManager loadWebUIForURL:requestURL];
   }
-  [_webUIManager loadWebUIForURL:requestURL];
   return context;
 }
 
@@ -1817,8 +1822,10 @@
 
   web::NavigationItem* item = self.currentNavItem;
   const GURL currentURL = item ? item->GetURL() : GURL::EmptyGURL();
+  const bool isCurrentURLAppSpecific =
+      web::GetWebClient()->IsAppSpecificURL(currentURL);
   // If it's a chrome URL, but not a native one, create the WebUI instance.
-  if (web::GetWebClient()->IsAppSpecificURL(currentURL) &&
+  if (isCurrentURLAppSpecific &&
       ![_nativeProvider hasControllerForURL:currentURL]) {
     if (!(item->GetTransitionType() & ui::PAGE_TRANSITION_TYPED ||
           item->GetTransitionType() & ui::PAGE_TRANSITION_AUTO_BOOKMARK) &&
@@ -1838,6 +1845,11 @@
   // a native view.
   if ([self shouldLoadURLInNativeView:currentURL]) {
     [self loadCurrentURLInNativeView];
+  } else if (web::GetWebClient()->IsSlimNavigationManagerEnabled() &&
+             isCurrentURLAppSpecific) {
+    // Handle WebUI separately from regular web page load in new nav manager.
+    DCHECK(_webStateImpl->HasWebUI());
+    [self loadPlaceholderInWebViewForURL:currentURL completionHandler:nil];
   } else {
     [self loadCurrentURLInWebView];
   }
@@ -3944,20 +3956,7 @@
 
 - (void)loadHTML:(NSString*)HTML forAppSpecificURL:(const GURL&)URL {
   CHECK(web::GetWebClient()->IsAppSpecificURL(URL));
-
-  ProceduralBlock finishLoadHTMLForAppSpecificURL = ^{
-    [self loadHTML:HTML forURL:URL];
-  };
-
-  // When using WKBasedNavigationManagerImpl, a placeholder must be loaded into
-  // the web view for each WebUI page so that the WKBackForwardList has an entry
-  // for each user-visible navigation.
-  if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
-    [self loadPlaceholderInWebViewForURL:URL
-                       completionHandler:finishLoadHTMLForAppSpecificURL];
-  } else {
-    finishLoadHTMLForAppSpecificURL();
-  }
+  [self loadHTML:HTML forURL:URL];
 }
 
 - (void)stopLoading {
@@ -4296,7 +4295,16 @@
 
   [self clearWebUI];
 
-  if (web::GetWebClient()->IsAppSpecificURL(webViewURL)) {
+  // When using WKBasedNavigationManager, if |backForwardList.currentItem| is a
+  // placeholder URL for the provisional load URL (i.e. webView.URL), then this
+  // is an in-progress app-specific load and should not be restarted.
+  bool currentItemIsPlaceholderForProvisionalURL =
+      web::GetWebClient()->IsSlimNavigationManagerEnabled() &&
+      CreatePlaceholderUrlForUrl(webViewURL) ==
+          net::GURLWithNSURL(webView.backForwardList.currentItem.URL);
+
+  if (web::GetWebClient()->IsAppSpecificURL(webViewURL) &&
+      !currentItemIsPlaceholderForProvisionalURL) {
     // Restart app specific URL loads to properly capture state.
     // TODO(crbug.com/546347): Extract necessary tasks for app specific URL
     // navigation rather than restarting the load.
@@ -4307,15 +4315,6 @@
     // dangerous.
     if (web::GetWebClient()->IsAppSpecificURL(_documentURL)) {
       [self abortLoad];
-
-      // Do some additional book keeping for WKBasedNavigationManagerImpl, which
-      // doesn't use KVO to manage navigation states. Sometimes
-      // WKNavigationDelegate callbacks may arrive after calling |stopLoading|.
-      // Remove this navigation from |_navigationStates| allows those delinquent
-      // callbacks to be ignored.
-      if (web::GetWebClient()->IsSlimNavigationManagerEnabled()) {
-        [_navigationStates removeNavigation:navigation];
-      }
       NavigationManager::WebLoadParams params(webViewURL);
       self.webState->GetNavigationManager()->LoadURLWithParams(params);
     }
@@ -4520,12 +4519,11 @@
     self.webStateImpl->OnNavigationFinished(context);
   }
 
-  [self updateSSLStatusForCurrentNavigationItem];
-
-  // Do not update the HTML5 history state or last committed item title for
-  // placeholder page because the actual navigation item will not be committed
-  // until the native content or WebUI is shown.
+  // Do not update the HTML5 history state or states of the last committed item
+  // for placeholder page because the actual navigation item will not be
+  // committed until the native content or WebUI is shown.
   if (context && !IsPlaceholderUrl(context->GetUrl())) {
+    [self updateSSLStatusForCurrentNavigationItem];
     [self updateHTML5HistoryState];
     [self setNavigationItemTitle:[_webView title]];
   }
@@ -4593,9 +4591,24 @@
       if (CreatePlaceholderUrlForUrl(item->GetVirtualURL()) != webViewURL)
         return;
 
+      const bool isWebUIURL =
+          web::GetWebClient()->IsAppSpecificURL(item->GetURL()) &&
+          ![_nativeProvider hasControllerForURL:item->GetURL()];
+      if (isWebUIURL && !_webUIManager) {
+        // WebUIManager is normally created when initiating a new load (in
+        // |loadCurrentURL|. If user navigates to a WebUI URL via back/forward
+        // navigation, the WebUI manager would have not been created. Create it
+        // now.
+        [self createWebUIForURL:item->GetURL()];
+      }
+
       if ([self shouldLoadURLInNativeView:item->GetURL()]) {
         [self loadNativeContentForNavigationItem:item];
+      } else if (isWebUIURL) {
+        DCHECK(_webUIManager);
+        [_webUIManager loadWebUIForURL:item->GetURL()];
       } else {
+        // Native error
         CRWPlaceholderNavigationInfo* placeholderNavigationInfo =
             [CRWPlaceholderNavigationInfo infoForNavigation:navigation];
         if (placeholderNavigationInfo) {
diff --git a/ipc/ipc_message_start.h b/ipc/ipc_message_start.h
index b36c86f2..e24a858 100644
--- a/ipc/ipc_message_start.h
+++ b/ipc/ipc_message_start.h
@@ -18,7 +18,6 @@
   ViewMsgStart,
   InputMsgStart,
   TestMsgStart,
-  DevToolsMsgStart,
   WorkerMsgStart,
   NaClMsgStart,
   GpuChannelMsgStart,
diff --git a/media/audio/audio_debug_recording_manager.cc b/media/audio/audio_debug_recording_manager.cc
index 62d288c..99e730bf 100644
--- a/media/audio/audio_debug_recording_manager.cc
+++ b/media/audio/audio_debug_recording_manager.cc
@@ -125,7 +125,7 @@
     const AudioParameters& params,
     scoped_refptr<base::SingleThreadTaskRunner> task_runner,
     base::OnceClosure on_destruction_closure) {
-  return base::MakeUnique<AudioDebugRecordingHelper>(
+  return std::make_unique<AudioDebugRecordingHelper>(
       params, task_runner, base::BindRepeating(&CreateFile),
       std::move(on_destruction_closure));
 }
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc
index 9542f92..1ba690b 100644
--- a/media/audio/win/audio_low_latency_input_win.cc
+++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -71,20 +71,27 @@
   bool avrt_init = avrt::Initialize();
   DCHECK(avrt_init) << "Failed to load the Avrt.dll";
 
-  // Set up the desired capture format specified by the client.
-  format_.wFormatTag = WAVE_FORMAT_PCM;
-  format_.nChannels = params.channels();
-  format_.nSamplesPerSec = params.sample_rate();
-  format_.wBitsPerSample = params.bits_per_sample();
-  format_.nBlockAlign = (format_.wBitsPerSample / 8) * format_.nChannels;
-  format_.nAvgBytesPerSec = format_.nSamplesPerSec * format_.nBlockAlign;
-  format_.cbSize = 0;
+  // Set up the desired output format specified by the client.
+  output_format_.wFormatTag = WAVE_FORMAT_PCM;
+  output_format_.nChannels = params.channels();
+  output_format_.nSamplesPerSec = params.sample_rate();
+  output_format_.wBitsPerSample = params.bits_per_sample();
+  output_format_.nBlockAlign =
+      (output_format_.wBitsPerSample / 8) * output_format_.nChannels;
+  output_format_.nAvgBytesPerSec =
+      output_format_.nSamplesPerSec * output_format_.nBlockAlign;
+  output_format_.cbSize = 0;
+
+  // Set the input (capture) format to the desired output format. In most cases,
+  // it will be used unchanged.
+  input_format_ = output_format_;
 
   // Size in bytes of each audio frame.
-  frame_size_ = format_.nBlockAlign;
+  frame_size_ = input_format_.nBlockAlign;
+
   // Store size of audio packets which we expect to get from the audio
   // endpoint device in each capture event.
-  packet_size_frames_ = params.GetBytesPerBuffer() / format_.nBlockAlign;
+  packet_size_frames_ = params.GetBytesPerBuffer() / input_format_.nBlockAlign;
   packet_size_bytes_ = params.GetBytesPerBuffer();
   DVLOG(1) << "Number of bytes per audio frame  : " << frame_size_;
   DVLOG(1) << "Number of audio frames per packet: " << packet_size_frames_;
@@ -378,7 +385,7 @@
     ++buffers_required;
 
   DCHECK(!fifo_);
-  fifo_.reset(new AudioBlockFifo(format_.nChannels, packet_size_frames_,
+  fifo_.reset(new AudioBlockFifo(input_format_.nChannels, packet_size_frames_,
                                  buffers_required));
 
   DVLOG(1) << "AudioBlockFifo buffer count: " << buffers_required;
@@ -409,7 +416,7 @@
         break;
       case WAIT_OBJECT_0 + 1: {
         TRACE_EVENT1("audio", "WASAPIAudioInputStream::Run_0", "sample rate",
-                     format_.nSamplesPerSec);
+                     input_format_.nSamplesPerSec);
         // |audio_samples_ready_event_| has been set.
         BYTE* data_ptr = NULL;
         UINT32 num_frames_to_read = 0;
@@ -454,14 +461,14 @@
 
         // Adjust |capture_time| for the FIFO before pushing.
         capture_time -= AudioTimestampHelper::FramesToTime(
-            fifo_->GetAvailableFrames(), format_.nSamplesPerSec);
+            fifo_->GetAvailableFrames(), input_format_.nSamplesPerSec);
 
         if (num_frames_to_read != 0) {
           if (flags & AUDCLNT_BUFFERFLAGS_SILENT) {
             fifo_->PushSilence(num_frames_to_read);
           } else {
             fifo_->Push(data_ptr, num_frames_to_read,
-                        format_.wBitsPerSample / 8);
+                        input_format_.wBitsPerSample / 8);
           }
         }
 
@@ -488,13 +495,13 @@
 
             // Move the capture time forward for each vended block.
             capture_time += AudioTimestampHelper::FramesToTime(
-                convert_bus_->frames(), format_.nSamplesPerSec);
+                convert_bus_->frames(), output_format_.nSamplesPerSec);
           } else {
             sink_->OnData(fifo_->Consume(), capture_time, volume);
 
             // Move the capture time forward for each vended block.
             capture_time += AudioTimestampHelper::FramesToTime(
-                packet_size_frames_, format_.nSamplesPerSec);
+                packet_size_frames_, input_format_.nSamplesPerSec);
           }
         }
       } break;
@@ -642,16 +649,18 @@
   // Many audio devices support both PCM and non-PCM stream formats. However,
   // the audio engine can mix only PCM streams.
   base::win::ScopedCoMem<WAVEFORMATEX> closest_match;
-  HRESULT hresult = audio_client_->IsFormatSupported(AUDCLNT_SHAREMODE_SHARED,
-                                                     &format_, &closest_match);
+  HRESULT hresult = audio_client_->IsFormatSupported(
+      AUDCLNT_SHAREMODE_SHARED, &input_format_, &closest_match);
   DLOG_IF(ERROR, hresult == S_FALSE)
       << "Format is not supported but a closest match exists.";
 
   if (hresult == S_FALSE) {
-    WAVEFORMATEX new_format = {};
-    new_format.wFormatTag = WAVE_FORMAT_PCM;
-    new_format.nChannels = closest_match->nChannels;
-    new_format.nSamplesPerSec = closest_match->nSamplesPerSec;
+    // Change the format we're going to ask for to better match with what the OS
+    // can provide.  If we succeed in initializing the audio client in this
+    // format and are able to convert from this format, we will do that
+    // conversion.
+    input_format_.nChannels = closest_match->nChannels;
+    input_format_.nSamplesPerSec = closest_match->nSamplesPerSec;
 
     // If the closest match is fixed point PCM (WAVE_FORMAT_PCM or
     // KSDATAFORMAT_SUBTYPE_PCM), we use the closest match's bits per sample.
@@ -668,59 +677,56 @@
       }
       return false;
     };
-    new_format.wBitsPerSample = format_is_pcm(closest_match)
-                                    ? closest_match->wBitsPerSample
-                                    : format_.wBitsPerSample;
+    if (format_is_pcm(closest_match))
+      input_format_.wBitsPerSample = closest_match->wBitsPerSample;
 
-    new_format.nBlockAlign =
-        (new_format.wBitsPerSample / 8) * new_format.nChannels;
-    new_format.nAvgBytesPerSec =
-        new_format.nSamplesPerSec * new_format.nBlockAlign;
+    input_format_.nBlockAlign =
+        (input_format_.wBitsPerSample / 8) * input_format_.nChannels;
+    input_format_.nAvgBytesPerSec =
+        input_format_.nSamplesPerSec * input_format_.nBlockAlign;
 
-    if (IsSupportedFormatForConversion(new_format)) {
-      DVLOG(1) << "Audio capture data conversion needed.";
+    if (IsSupportedFormatForConversion(input_format_)) {
+      DVLOG(1) << "Will convert capture audio from: \nbits: "
+               << input_format_.wBitsPerSample
+               << "\nsample rate: " << input_format_.nSamplesPerSec
+               << "\nchannels: " << input_format_.nChannels
+               << "\nblock align: " << input_format_.nBlockAlign
+               << "\navg bytes per sec: " << input_format_.nAvgBytesPerSec;
+
       // Ideally, we want a 1:1 ratio between the buffers we get and the buffers
       // we give to OnData so that each buffer we receive from the OS can be
       // directly converted to a buffer that matches with what was asked for.
-      const double buffer_ratio =
-          format_.nSamplesPerSec / static_cast<double>(packet_size_frames_);
-      double new_frames_per_buffer = new_format.nSamplesPerSec / buffer_ratio;
+      const double buffer_ratio = output_format_.nSamplesPerSec /
+                                  static_cast<double>(packet_size_frames_);
+      double new_frames_per_buffer =
+          input_format_.nSamplesPerSec / buffer_ratio;
 
-      const auto input_layout = GuessChannelLayout(new_format.nChannels);
+      const auto input_layout = GuessChannelLayout(input_format_.nChannels);
       DCHECK_NE(CHANNEL_LAYOUT_UNSUPPORTED, input_layout);
-      const auto output_layout = GuessChannelLayout(format_.nChannels);
+      const auto output_layout = GuessChannelLayout(output_format_.nChannels);
       DCHECK_NE(CHANNEL_LAYOUT_UNSUPPORTED, output_layout);
 
       const AudioParameters input(AudioParameters::AUDIO_PCM_LOW_LATENCY,
-                                  input_layout, new_format.nSamplesPerSec,
-                                  new_format.wBitsPerSample,
+                                  input_layout, input_format_.nSamplesPerSec,
+                                  input_format_.wBitsPerSample,
                                   static_cast<int>(new_frames_per_buffer));
 
       const AudioParameters output(AudioParameters::AUDIO_PCM_LOW_LATENCY,
-                                   output_layout, format_.nSamplesPerSec,
-                                   format_.wBitsPerSample, packet_size_frames_);
+                                   output_layout, output_format_.nSamplesPerSec,
+                                   output_format_.wBitsPerSample,
+                                   packet_size_frames_);
 
       converter_.reset(new AudioConverter(input, output, false));
       converter_->AddInput(this);
       converter_->PrimeWithSilence();
       convert_bus_ = AudioBus::Create(output);
 
-      // Now change the format we're going to ask for to better match with what
-      // the OS can provide.  If we succeed in opening the stream with these
-      // params, we can take care of the required format conversion.
-      format_ = new_format;
-      DVLOG(1) << "Will convert audio from: \nbits: " << format_.wBitsPerSample
-               << "\nsample rate: " << format_.nSamplesPerSec
-               << "\nchannels: " << format_.nChannels
-               << "\nblock align: " << format_.nBlockAlign
-               << "\navg bytes per sec: " << format_.nAvgBytesPerSec;
-
       // Update our packet size assumptions based on the new format.
       const auto new_bytes_per_buffer =
-          static_cast<int>(new_frames_per_buffer) * format_.nBlockAlign;
-      packet_size_frames_ = new_bytes_per_buffer / format_.nBlockAlign;
+          static_cast<int>(new_frames_per_buffer) * input_format_.nBlockAlign;
+      packet_size_frames_ = new_bytes_per_buffer / input_format_.nBlockAlign;
       packet_size_bytes_ = new_bytes_per_buffer;
-      frame_size_ = format_.nBlockAlign;
+      frame_size_ = input_format_.nBlockAlign;
 
       imperfect_buffer_size_conversion_ =
           std::modf(new_frames_per_buffer, &new_frames_per_buffer) != 0.0;
@@ -762,9 +768,10 @@
   HRESULT hr = audio_client_->Initialize(
       AUDCLNT_SHAREMODE_SHARED, flags,
       0,  // hnsBufferDuration
-      0, &format_, device_id_ == AudioDeviceDescription::kCommunicationsDeviceId
-                       ? &kCommunicationsSessionId
-                       : nullptr);
+      0, &input_format_,
+      device_id_ == AudioDeviceDescription::kCommunicationsDeviceId
+          ? &kCommunicationsSessionId
+          : nullptr);
 
   if (FAILED(hr)) {
     open_result_ = OPEN_RESULT_AUDIO_CLIENT_INIT_FAILED;
@@ -839,7 +846,7 @@
     hr = audio_render_client_for_loopback_->Initialize(
         AUDCLNT_SHAREMODE_SHARED,
         AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, 0, 0,
-        &format_, NULL);
+        &input_format_, NULL);
     if (FAILED(hr)) {
       open_result_ = OPEN_RESULT_LOOPBACK_INIT_FAILED;
       return hr;
@@ -880,8 +887,20 @@
   if (open_result_ != OPEN_RESULT_OK &&
       open_result_ != OPEN_RESULT_OK_WITH_RESAMPLING) {
     log_callback_.Run(base::StringPrintf(
-        "WASAPIAIS::Open: failed, result = %d, hresult = %#lx", open_result_,
-        hr));
+        "WASAPIAIS::Open: failed, result = %d, hresult = %#lx, "
+        "input format = %#x/%d/%ld/%d/%d/%ld/%d, "
+        "output format = %#x/%d/%ld/%d/%d/%ld/%d",
+        // clang-format off
+        open_result_, hr,
+        input_format_.wFormatTag, input_format_.nChannels,
+        input_format_.nSamplesPerSec, input_format_.wBitsPerSample,
+        input_format_.nBlockAlign, input_format_.nAvgBytesPerSec,
+        input_format_.cbSize,
+        output_format_.wFormatTag, output_format_.nChannels,
+        output_format_.nSamplesPerSec, output_format_.wBitsPerSample,
+        output_format_.nBlockAlign,output_format_.nAvgBytesPerSec,
+        output_format_.cbSize));
+    // clang-format on
   }
 }
 
diff --git a/media/audio/win/audio_low_latency_input_win.h b/media/audio/win/audio_low_latency_input_win.h
index 4d199b5e..8d93349 100644
--- a/media/audio/win/audio_low_latency_input_win.h
+++ b/media/audio/win/audio_low_latency_input_win.h
@@ -168,8 +168,14 @@
   // All OnData() callbacks will be called from this thread.
   std::unique_ptr<base::DelegateSimpleThread> capture_thread_;
 
-  // Contains the desired audio format which is set up at construction.
-  WAVEFORMATEX format_;
+  // Contains the desired output audio format which is set up at construction,
+  // that is the audio format this class should output data to the sink in.
+  WAVEFORMATEX output_format_;
+
+  // Contains the audio format we get data from the audio engine in. Set to
+  // |output_format_| at construction and might be changed to a close match
+  // if the audio engine doesn't support the originally set format.
+  WAVEFORMATEX input_format_;
 
   bool opened_ = false;
   bool started_ = false;
diff --git a/media/blink/webmediaplayer_impl_unittest.cc b/media/blink/webmediaplayer_impl_unittest.cc
index 88ab6a5..57e43be3 100644
--- a/media/blink/webmediaplayer_impl_unittest.cc
+++ b/media/blink/webmediaplayer_impl_unittest.cc
@@ -1037,7 +1037,7 @@
   InitializeWebMediaPlayerImpl();
 
   std::unique_ptr<cc_blink::WebLayerImpl> web_layer =
-      base::MakeUnique<cc_blink::WebLayerImpl>();
+      std::make_unique<cc_blink::WebLayerImpl>();
   cc_blink::WebLayerImpl* web_layer_ptr = web_layer.get();
 
   EXPECT_CALL(*surface_layer_bridge_ptr_, GetWebLayer())
diff --git a/media/cast/net/udp_packet_pipe_unittest.cc b/media/cast/net/udp_packet_pipe_unittest.cc
index c993c3a..1bdae8a6 100644
--- a/media/cast/net/udp_packet_pipe_unittest.cc
+++ b/media/cast/net/udp_packet_pipe_unittest.cc
@@ -4,13 +4,13 @@
 
 #include "media/cast/net/udp_packet_pipe.h"
 
+#include <memory>
 #include <string>
 
 #include "base/bind.h"
 #include "base/callback.h"
 #include "base/containers/circular_deque.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/test/mock_callback.h"
 #include "base/test/scoped_task_environment.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -26,9 +26,9 @@
  public:
   UdpPacketPipeTest() {
     mojo::DataPipe data_pipe(kDefaultDataPipeCapacityBytes);
-    writer_ = base::MakeUnique<UdpPacketPipeWriter>(
+    writer_ = std::make_unique<UdpPacketPipeWriter>(
         std::move(data_pipe.producer_handle));
-    reader_ = base::MakeUnique<UdpPacketPipeReader>(
+    reader_ = std::make_unique<UdpPacketPipeReader>(
         std::move(data_pipe.consumer_handle));
   }
 
diff --git a/media/gpu/dxva_video_decode_accelerator_win.cc b/media/gpu/dxva_video_decode_accelerator_win.cc
index e2d185c..a660072 100644
--- a/media/gpu/dxva_video_decode_accelerator_win.cc
+++ b/media/gpu/dxva_video_decode_accelerator_win.cc
@@ -584,6 +584,7 @@
       support_copy_nv12_textures_(gpu_preferences.enable_nv12_dxgi_video &&
                                   !workarounds.disable_nv12_dxgi_video),
       support_delayed_copy_nv12_textures_(
+          !gpu_preferences.use_passthrough_cmd_decoder &&
           base::FeatureList::IsEnabled(kDelayCopyNV12Textures) &&
           !workarounds.disable_delayed_copy_nv12),
       use_dx11_(false),
diff --git a/media/gpu/jpeg_encode_accelerator_unittest.cc b/media/gpu/jpeg_encode_accelerator_unittest.cc
index 1d841f7..3f7b231 100644
--- a/media/gpu/jpeg_encode_accelerator_unittest.cc
+++ b/media/gpu/jpeg_encode_accelerator_unittest.cc
@@ -18,7 +18,6 @@
 #include "base/files/file_util.h"
 #include "base/logging.h"
 #include "base/macros.h"
-#include "base/memory/ptr_util.h"
 #include "base/path_service.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_piece.h"
@@ -156,7 +155,7 @@
   encoder_ = nullptr;
 
 #if BUILDFLAG(USE_VAAPI)
-  encoder_ = base::MakeUnique<VaapiJpegEncodeAccelerator>(
+  encoder_ = std::make_unique<VaapiJpegEncodeAccelerator>(
       base::ThreadTaskRunnerHandle::Get());
 #endif
 
@@ -360,7 +359,7 @@
 
   base::SharedMemoryHandle dup_handle;
   dup_handle = base::SharedMemory::DuplicateHandle(hw_out_shm_->handle());
-  encoded_buffer_ = base::MakeUnique<BitstreamBuffer>(
+  encoded_buffer_ = std::make_unique<BitstreamBuffer>(
       bitstream_buffer_id, dup_handle, image_file->output_size);
   scoped_refptr<VideoFrame> input_frame_ = VideoFrame::WrapExternalSharedMemory(
       PIXEL_FORMAT_I420, image_file->visible_size,
@@ -461,7 +460,7 @@
     ASSERT_TRUE(!image_size.IsEmpty());
 
     base::FilePath input_file = GetOriginalOrTestDataFilePath(filename);
-    auto image_data = base::MakeUnique<TestImageFile>(filename, image_size);
+    auto image_data = std::make_unique<TestImageFile>(filename, image_size);
     ASSERT_NO_FATAL_FAILURE(ReadTestYuvImage(input_file, image_data.get()));
     image_data_user_.push_back(std::move(image_data));
   }
@@ -542,9 +541,9 @@
   std::vector<std::unique_ptr<JpegClient>> clients;
 
   for (size_t i = 0; i < num_concurrent_encoders; i++) {
-    notes.push_back(base::MakeUnique<ClientStateNotification<ClientState>>());
+    notes.push_back(std::make_unique<ClientStateNotification<ClientState>>());
     clients.push_back(
-        base::MakeUnique<JpegClient>(test_image_files_, notes.back().get()));
+        std::make_unique<JpegClient>(test_image_files_, notes.back().get()));
     encoder_thread.task_runner()->PostTask(
         FROM_HERE, base::BindOnce(&JpegClient::CreateJpegEncoder,
                                   base::Unretained(clients.back().get())));
diff --git a/media/gpu/windows/d3d11_picture_buffer.cc b/media/gpu/windows/d3d11_picture_buffer.cc
index f766b8c1..022c60d 100644
--- a/media/gpu/windows/d3d11_picture_buffer.cc
+++ b/media/gpu/windows/d3d11_picture_buffer.cc
@@ -8,7 +8,8 @@
 #include <d3d11_1.h>
 #include <windows.h>
 
-#include "base/memory/ptr_util.h"
+#include <memory>
+
 #include "gpu/command_buffer/service/mailbox_manager.h"
 #include "gpu/command_buffer/service/texture_manager.h"
 #include "media/gpu/gles2_decoder_helper.h"
@@ -70,7 +71,7 @@
   // device for decoding.  Sharing seems not to work very well.  Otherwise, we
   // would create the texture with KEYED_MUTEX and NTHANDLE, then send along
   // a handle that we get from |texture| as an IDXGIResource1.
-  gpu_resources_ = base::MakeUnique<GpuResources>();
+  gpu_resources_ = std::make_unique<GpuResources>();
   if (!gpu_resources_->Init(std::move(get_stub_cb), level_,
                             std::move(mailboxes), target_, size_, texture,
                             textures_per_picture))
diff --git a/net/cert/x509_certificate.cc b/net/cert/x509_certificate.cc
index 454110f..ffc90d0 100644
--- a/net/cert/x509_certificate.cc
+++ b/net/cert/x509_certificate.cc
@@ -198,6 +198,14 @@
 // static
 scoped_refptr<X509Certificate> X509Certificate::CreateFromDERCertChain(
     const std::vector<base::StringPiece>& der_certs) {
+  return CreateFromDERCertChainUnsafeOptions(der_certs, {});
+}
+
+// static
+scoped_refptr<X509Certificate>
+X509Certificate::CreateFromDERCertChainUnsafeOptions(
+    const std::vector<base::StringPiece>& der_certs,
+    UnsafeCreateOptions options) {
   TRACE_EVENT0("io", "X509Certificate::CreateFromDERCertChain");
   if (der_certs.empty())
     return nullptr;
@@ -221,7 +229,8 @@
   if (!handle)
     return nullptr;
 
-  return CreateFromBuffer(std::move(handle), std::move(intermediate_ca_certs));
+  return CreateFromBufferUnsafeOptions(
+      std::move(handle), std::move(intermediate_ca_certs), options);
 }
 
 // static
@@ -249,6 +258,13 @@
 // static
 scoped_refptr<X509Certificate> X509Certificate::CreateFromPickle(
     base::PickleIterator* pickle_iter) {
+  return CreateFromPickleUnsafeOptions(pickle_iter, {});
+}
+
+// static
+scoped_refptr<X509Certificate> X509Certificate::CreateFromPickleUnsafeOptions(
+    base::PickleIterator* pickle_iter,
+    UnsafeCreateOptions options) {
   int chain_length = 0;
   if (!pickle_iter->ReadLength(&chain_length))
     return nullptr;
@@ -261,7 +277,7 @@
       return nullptr;
     cert_chain.push_back(base::StringPiece(data, data_length));
   }
-  return CreateFromDERCertChain(cert_chain);
+  return CreateFromDERCertChainUnsafeOptions(cert_chain, options);
 }
 
 // static
diff --git a/net/cert/x509_certificate.h b/net/cert/x509_certificate.h
index d52d8796..9d3af48 100644
--- a/net/cert/x509_certificate.h
+++ b/net/cert/x509_certificate.h
@@ -98,6 +98,13 @@
   static scoped_refptr<X509Certificate> CreateFromDERCertChain(
       const std::vector<base::StringPiece>& der_certs);
 
+  // Create an X509Certificate from a chain of DER encoded certificates with
+  // non-standard parsing options.
+  // Do not use without consulting //net owners.
+  static scoped_refptr<X509Certificate> CreateFromDERCertChainUnsafeOptions(
+      const std::vector<base::StringPiece>& der_certs,
+      UnsafeCreateOptions options);
+
   // Create an X509Certificate from the DER-encoded representation.
   // Returns NULL on failure.
   static scoped_refptr<X509Certificate> CreateFromBytes(const char* data,
@@ -117,6 +124,13 @@
   static scoped_refptr<X509Certificate> CreateFromPickle(
       base::PickleIterator* pickle_iter);
 
+  // Create an X509Certificate from the representation stored in the given
+  // pickle with non-standard parsing options.
+  // Do not use without consulting //net owners.
+  static scoped_refptr<X509Certificate> CreateFromPickleUnsafeOptions(
+      base::PickleIterator* pickle_iter,
+      UnsafeCreateOptions options);
+
   // Parses all of the certificates possible from |data|. |format| is a
   // bit-wise OR of Format, indicating the possible formats the
   // certificates may have been serialized as. If an error occurs, an empty
diff --git a/remoting/client/chromoting_session.cc b/remoting/client/chromoting_session.cc
index 0f1dbfd..48948b16 100644
--- a/remoting/client/chromoting_session.cc
+++ b/remoting/client/chromoting_session.cc
@@ -114,21 +114,37 @@
 }
 
 void ChromotingSession::Disconnect() {
+  DisconnectForReason(protocol::ErrorCode::OK);
+}
+
+void ChromotingSession::DisconnectForReason(protocol::ErrorCode error) {
   if (!runtime_->network_task_runner()->BelongsToCurrentThread()) {
     runtime_->network_task_runner()->PostTask(
-        FROM_HERE, base::Bind(&ChromotingSession::Disconnect, GetWeakPtr()));
+        FROM_HERE, base::BindOnce(&ChromotingSession::DisconnectForReason,
+                                  GetWeakPtr(), error));
     return;
   }
 
-  stats_logging_enabled_ = false;
+  EnableStatsLogging(false);
 
-  // User disconnection will not trigger OnConnectionState(Closed, OK).
-  // Remote disconnection will trigger OnConnectionState(...) and later trigger
-  // Disconnect().
-  if (connected_) {
-    logger_->LogSessionStateChange(ChromotingEvent::SessionState::CLOSED,
-                                   ChromotingEvent::ConnectionError::NONE);
-    connected_ = false;
+  // Do not log session state change if the connection is never started or is
+  // already closed.
+  if (session_state_ != protocol::ConnectionToHost::INITIALIZING &&
+      session_state_ != protocol::ConnectionToHost::FAILED &&
+      session_state_ != protocol::ConnectionToHost::CLOSED) {
+    ChromotingEvent::SessionState session_state_to_log;
+    if (error != protocol::ErrorCode::OK) {
+      session_state_to_log = ChromotingEvent::SessionState::CONNECTION_FAILED;
+    } else if (session_state_ == protocol::ConnectionToHost::CONNECTED) {
+      session_state_to_log = ChromotingEvent::SessionState::CLOSED;
+    } else {
+      session_state_to_log = ChromotingEvent::SessionState::CONNECTION_CANCELED;
+    }
+    logger_->LogSessionStateChange(
+        session_state_to_log, ClientTelemetryLogger::TranslateError(error));
+    session_state_ = (error == protocol::ErrorCode::OK)
+                         ? protocol::ConnectionToHost::CLOSED
+                         : protocol::ConnectionToHost::FAILED;
   }
 
   ReleaseResources();
@@ -317,8 +333,8 @@
 
   // This code assumes no intermediate connection state between CONNECTED and
   // CLOSED/FAILED.
-  connected_ = state == protocol::ConnectionToHost::CONNECTED;
-  EnableStatsLogging(connected_);
+  session_state_ = state;
+  EnableStatsLogging(session_state_ == protocol::ConnectionToHost::CONNECTED);
 
   logger_->LogSessionStateChange(ClientTelemetryLogger::TranslateState(state),
                                  ClientTelemetryLogger::TranslateError(error));
diff --git a/remoting/client/chromoting_session.h b/remoting/client/chromoting_session.h
index a498f7a9..2fab111 100644
--- a/remoting/client/chromoting_session.h
+++ b/remoting/client/chromoting_session.h
@@ -90,14 +90,18 @@
   // Must be called before destruction.
   void Disconnect();
 
-  // Requests the android app to fetch a third-party token.
+  // Similar to Disconnect(), except that this method allows you to specify the
+  // reason to disconnect, which will be reported to telemetry.
+  void DisconnectForReason(protocol::ErrorCode error);
+
+  // Requests the client to fetch a third-party token.
   void FetchThirdPartyToken(
       const std::string& host_public_key,
       const std::string& token_url,
       const std::string& scope,
       const protocol::ThirdPartyTokenFetchedCallback& token_fetched_callback);
 
-  // Called by the android app when the token is fetched.
+  // Called by the client when the token is fetched.
   void HandleOnThirdPartyTokenFetched(const std::string& token,
                                       const std::string& shared_secret);
 
@@ -211,9 +215,9 @@
   // set of capabilities for this remoting session.
   std::string capabilities_;
 
-  // Indicates whether the client is connected to the host. Used on network
-  // thread.
-  bool connected_ = false;
+  // The current session state. Used on network thread.
+  protocol::ConnectionToHost::State session_state_ =
+      protocol::ConnectionToHost::INITIALIZING;
 
   std::unique_ptr<ClientTelemetryLogger> logger_;
 
diff --git a/remoting/host/policy_watcher.cc b/remoting/host/policy_watcher.cc
index 2ed5db8..1cdeee7 100644
--- a/remoting/host/policy_watcher.cc
+++ b/remoting/host/policy_watcher.cc
@@ -375,8 +375,9 @@
 
   policy::PolicyServiceImpl::Providers providers;
   providers.push_back(policy_provider.get());
-  std::unique_ptr<policy::PolicyService> policy_service(
-      new policy::PolicyServiceImpl(providers));
+  std::unique_ptr<policy::PolicyServiceImpl> policy_service =
+      std::make_unique<policy::PolicyServiceImpl>();
+  policy_service->SetProviders(providers);
 
   policy::PolicyService* borrowed_policy_service = policy_service.get();
   return base::WrapUnique(new PolicyWatcher(
diff --git a/remoting/ios/session/remoting_client.mm b/remoting/ios/session/remoting_client.mm
index 1713039..52bb0d7 100644
--- a/remoting/ios/session/remoting_client.mm
+++ b/remoting/ios/session/remoting_client.mm
@@ -327,6 +327,8 @@
   // Not supported for iOS yet.
   _sessionDetails.state = SessionFailed;
   _sessionDetails.error = SessionErrorThirdPartyAuthNotSupported;
+  _session->DisconnectForReason(
+      remoting::protocol::ErrorCode::AUTHENTICATION_FAILED);
   [[NSNotificationCenter defaultCenter]
       postNotificationName:kHostSessionStatusChanged
                     object:self
diff --git a/services/network/public/cpp/BUILD.gn b/services/network/public/cpp/BUILD.gn
index 1c660c3..616855be 100644
--- a/services/network/public/cpp/BUILD.gn
+++ b/services/network/public/cpp/BUILD.gn
@@ -8,18 +8,12 @@
   sources = [
     "cors/cors.cc",
     "cors/cors.h",
-    "data_element.cc",
-    "data_element.h",
     "mutable_network_traffic_annotation_tag_struct_traits.h",
     "mutable_partial_network_traffic_annotation_tag_struct_traits.h",
     "net_adapters.cc",
     "net_adapters.h",
     "proxy_resolving_client_socket.cc",
     "proxy_resolving_client_socket.h",
-    "resource_request.cc",
-    "resource_request.h",
-    "resource_request_body.cc",
-    "resource_request_body.h",
   ]
 
   public_deps = [
@@ -40,20 +34,29 @@
   sources = [
     "cors/cors_error_status.cc",
     "cors/cors_error_status.h",
+    "data_element.cc",
+    "data_element.h",
     "http_raw_request_response_info.cc",
     "http_raw_request_response_info.h",
     "network_param_ipc_traits.cc",
     "network_param_ipc_traits.h",
     "proxy_config_traits.cc",
     "proxy_config_traits.h",
+    "resource_request.cc",
+    "resource_request.h",
+    "resource_request_body.cc",
+    "resource_request_body.h",
     "resource_response.cc",
     "resource_response.h",
     "resource_response_info.cc",
     "resource_response_info.h",
     "url_loader_completion_status.cc",
     "url_loader_completion_status.h",
+    "url_request_struct_traits.cc",
+    "url_request_struct_traits.h",
   ]
   public_deps = [
+    "//services/network/public/interfaces:data_pipe_interface",
     "//url/ipc:url_ipc",
     "//url/mojo:url_mojom_gurl",
   ]
diff --git a/services/network/public/cpp/cors/cors.cc b/services/network/public/cpp/cors/cors.cc
index 4c715081..77d0dc00 100644
--- a/services/network/public/cpp/cors/cors.cc
+++ b/services/network/public/cpp/cors/cors.cc
@@ -6,6 +6,7 @@
 
 #include "url/gurl.h"
 #include "url/origin.h"
+#include "url/url_util.h"
 
 namespace network {
 
@@ -101,6 +102,30 @@
   return base::nullopt;
 }
 
+base::Optional<mojom::CORSError> CheckRedirectLocation(const GURL& redirect_url,
+                                                       bool skip_scheme_check) {
+  if (!skip_scheme_check) {
+    // Block non HTTP(S) schemes as specified in the step 4 in
+    // https://fetch.spec.whatwg.org/#http-redirect-fetch. Chromium also allows
+    // the data scheme.
+    auto& schemes = url::GetCORSEnabledSchemes();
+    if (std::find(std::begin(schemes), std::end(schemes),
+                  redirect_url.scheme()) == std::end(schemes)) {
+      return mojom::CORSError::kRedirectDisallowedScheme;
+    }
+  }
+
+  // Block URLs including credentials as specified in the step 9 in
+  // https://fetch.spec.whatwg.org/#http-redirect-fetch.
+  //
+  // TODO(tyoshino): This check should be performed also when request's
+  // origin is not same origin with the redirect destination's origin.
+  if (redirect_url.has_username() || redirect_url.has_password())
+    return mojom::CORSError::kRedirectContainsCredentials;
+
+  return base::nullopt;
+}
+
 bool IsCORSEnabledRequestMode(mojom::FetchRequestMode mode) {
   return mode == mojom::FetchRequestMode::kCORS ||
          mode == mojom::FetchRequestMode::kCORSWithForcedPreflight;
diff --git a/services/network/public/cpp/cors/cors.h b/services/network/public/cpp/cors/cors.h
index 686482a..eccf4110 100644
--- a/services/network/public/cpp/cors/cors.h
+++ b/services/network/public/cpp/cors/cors.h
@@ -38,6 +38,16 @@
     network::mojom::FetchCredentialsMode credentials_mode,
     const url::Origin& origin);
 
+// Given a redirected-to URL, check if the location is allowed
+// according to CORS. That is:
+// - the URL has a CORS supported scheme and
+// - the URL does not contain the userinfo production.
+// TODO(toyoshim): Remove |skip_scheme_check| that is used when customized
+// scheme check runs in Blink side in the legacy mode.
+// See https://crbug.com/800669.
+base::Optional<mojom::CORSError> CheckRedirectLocation(const GURL& redirect_url,
+                                                       bool skip_scheme_check);
+
 bool IsCORSEnabledRequestMode(mojom::FetchRequestMode mode);
 
 }  // namespace cors
diff --git a/services/network/public/cpp/cors/cors_unittest.cc b/services/network/public/cpp/cors/cors_unittest.cc
index ed26776..c124f58 100644
--- a/services/network/public/cpp/cors/cors_unittest.cc
+++ b/services/network/public/cpp/cors/cors_unittest.cc
@@ -237,6 +237,45 @@
   EXPECT_EQ(mojom::CORSError::kDisallowCredentialsNotSetToTrue, *error2);
 }
 
+// Tests if cors::CheckRedirectLocation detects kRedirectDisallowedScheme and
+// kRedirectContainsCredentials errors correctly.
+TEST_F(CORSTest, CheckRedirectLocationDetectsErrors) {
+  // Following URLs should pass.
+  EXPECT_FALSE(cors::CheckRedirectLocation(GURL("http://example.com/"), false));
+  EXPECT_FALSE(
+      cors::CheckRedirectLocation(GURL("https://example.com/"), false));
+  EXPECT_FALSE(cors::CheckRedirectLocation(GURL("data:,Hello"), false));
+  EXPECT_FALSE(
+      cors::CheckRedirectLocation(GURL("file:///not_allow_scheme"), true));
+
+  // Following URLs should result in kRedirectDisallowedScheme.
+  base::Optional<mojom::CORSError> error1 =
+      cors::CheckRedirectLocation(GURL("file:///not_allow_scheme"), false);
+  ASSERT_TRUE(error1);
+  EXPECT_EQ(mojom::CORSError::kRedirectDisallowedScheme, *error1);
+
+  // Following checks should result in the kRedirectContainsCredentials error.
+  base::Optional<mojom::CORSError> error2 = cors::CheckRedirectLocation(
+      GURL("http://yukari:tamura@example.com/"), false);
+  ASSERT_TRUE(error2);
+  EXPECT_EQ(mojom::CORSError::kRedirectContainsCredentials, *error2);
+
+  base::Optional<mojom::CORSError> error3 = cors::CheckRedirectLocation(
+      GURL("http://yukari:tamura@example.com/"), true);
+  ASSERT_TRUE(error3);
+  EXPECT_EQ(mojom::CORSError::kRedirectContainsCredentials, *error3);
+
+  base::Optional<mojom::CORSError> error4 =
+      cors::CheckRedirectLocation(GURL("http://tamura@example.com/"), true);
+  ASSERT_TRUE(error4);
+  EXPECT_EQ(mojom::CORSError::kRedirectContainsCredentials, *error4);
+
+  base::Optional<mojom::CORSError> error5 =
+      cors::CheckRedirectLocation(GURL("http://yukari:@example.com/"), true);
+  ASSERT_TRUE(error5);
+  EXPECT_EQ(mojom::CORSError::kRedirectContainsCredentials, *error5);
+}
+
 }  // namespace
 
 }  // namespace network
diff --git a/content/public/common/cors_error_status.typemap b/services/network/public/cpp/cors_error_status.typemap
similarity index 61%
rename from content/public/common/cors_error_status.typemap
rename to services/network/public/cpp/cors_error_status.typemap
index 2472b60..efda7cd 100644
--- a/content/public/common/cors_error_status.typemap
+++ b/services/network/public/cpp/cors_error_status.typemap
@@ -2,10 +2,13 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-mojom = "//content/public/common/url_loader.mojom"
+mojom = "//services/network/public/interfaces/url_loader.mojom"
 public_headers = [ "//services/network/public/cpp/cors/cors_error_status.h" ]
 traits_headers = [ "//services/network/public/cpp/network_param_ipc_traits.h" ]
 deps = [
-  "//services/network/public/cpp",
+  "//net",
 ]
-type_mappings = [ "content.mojom.CORSErrorStatus=network::CORSErrorStatus" ]
+public_deps = [
+  "//services/network/public/cpp:typemap_dependencies",
+]
+type_mappings = [ "network.mojom.CORSErrorStatus=network::CORSErrorStatus" ]
diff --git a/services/network/public/cpp/http_request_headers.typemap b/services/network/public/cpp/http_request_headers.typemap
index 90c8e67..ada2ad3 100644
--- a/services/network/public/cpp/http_request_headers.typemap
+++ b/services/network/public/cpp/http_request_headers.typemap
@@ -3,7 +3,10 @@
 # found in the LICENSE file.
 
 mojom = "//services/network/public/interfaces/http_request_headers.mojom"
-public_headers = [ "//net/http/http_request_headers.h" ]
+public_headers = [
+  "//net/http/http_request_headers.h",
+  "//services/network/public/cpp/http_request_headers_struct_traits.h",
+]
 traits_headers =
     [ "//services/network/public/cpp/http_request_headers_struct_traits.h" ]
 sources = [
diff --git a/services/network/public/cpp/network_param.typemap b/services/network/public/cpp/network_param.typemap
new file mode 100644
index 0000000..6fb311f
--- /dev/null
+++ b/services/network/public/cpp/network_param.typemap
@@ -0,0 +1,22 @@
+# Copyright 2017 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.
+
+mojom = "//services/network/public/interfaces/url_loader.mojom"
+public_headers = [
+  "//net/base/host_port_pair.h",
+  "//net/cert/cert_verify_result.h",
+  "//net/cert/x509_certificate.h",
+  "//net/http/http_request_headers.h",
+  "//net/ssl/ssl_info.h",
+]
+traits_headers = [ "//services/network/public/cpp/network_param_ipc_traits.h" ]
+public_deps = [
+  "//net",
+]
+type_mappings = [
+  "network.mojom.CertVerifyResult=net::CertVerifyResult",
+  "network.mojom.HostPortPair=net::HostPortPair",
+  "network.mojom.SSLInfo=net::SSLInfo",
+  "network.mojom.X509Certificate=scoped_refptr<net::X509Certificate>[nullable_is_same_type]",
+]
diff --git a/services/network/public/cpp/network_param_ipc_traits.cc b/services/network/public/cpp/network_param_ipc_traits.cc
index c5fffddf..12058b0 100644
--- a/services/network/public/cpp/network_param_ipc_traits.cc
+++ b/services/network/public/cpp/network_param_ipc_traits.cc
@@ -5,6 +5,8 @@
 #include "services/network/public/cpp/network_param_ipc_traits.h"
 
 #include "ipc/ipc_message_utils.h"
+#include "ipc/ipc_mojo_param_traits.h"
+#include "ipc/ipc_platform_file.h"
 #include "net/http/http_util.h"
 #include "services/network/public/cpp/http_raw_request_response_info.h"
 
@@ -307,7 +309,13 @@
     return false;
   if (!has_object)
     return true;
-  *r = net::X509Certificate::CreateFromPickle(iter);
+  net::X509Certificate::UnsafeCreateOptions options;
+  // Setting the |printable_string_is_utf8| option to be true here is necessary
+  // to round-trip any X509Certificate objects that were parsed with this
+  // option in the first place.
+  // See https://crbug.com/770323 and https://crbug.com/788655.
+  options.printable_string_is_utf8 = true;
+  *r = net::X509Certificate::CreateFromPickleUnsafeOptions(iter, options);
   return !!r->get();
 }
 
@@ -407,6 +415,263 @@
   l->append(")");
 }
 
+void ParamTraits<network::DataElement>::Write(base::Pickle* m,
+                                              const param_type& p) {
+  WriteParam(m, static_cast<int>(p.type()));
+  switch (p.type()) {
+    case network::DataElement::TYPE_BYTES: {
+      m->WriteData(p.bytes(), static_cast<int>(p.length()));
+      break;
+    }
+    case network::DataElement::TYPE_BYTES_DESCRIPTION: {
+      WriteParam(m, p.length());
+      break;
+    }
+    case network::DataElement::TYPE_FILE: {
+      WriteParam(m, p.path());
+      WriteParam(m, p.offset());
+      WriteParam(m, p.length());
+      WriteParam(m, p.expected_modification_time());
+      break;
+    }
+    case network::DataElement::TYPE_RAW_FILE: {
+      WriteParam(
+          m, IPC::GetPlatformFileForTransit(p.file().GetPlatformFile(),
+                                            false /* close_source_handle */));
+      WriteParam(m, p.path());
+      WriteParam(m, p.offset());
+      WriteParam(m, p.length());
+      WriteParam(m, p.expected_modification_time());
+      break;
+    }
+    case network::DataElement::TYPE_FILE_FILESYSTEM: {
+      WriteParam(m, p.filesystem_url());
+      WriteParam(m, p.offset());
+      WriteParam(m, p.length());
+      WriteParam(m, p.expected_modification_time());
+      break;
+    }
+    case network::DataElement::TYPE_BLOB: {
+      WriteParam(m, p.blob_uuid());
+      WriteParam(m, p.offset());
+      WriteParam(m, p.length());
+      break;
+    }
+    case network::DataElement::TYPE_DISK_CACHE_ENTRY: {
+      NOTREACHED() << "Can't be sent by IPC.";
+      break;
+    }
+    case network::DataElement::TYPE_DATA_PIPE: {
+      WriteParam(m,
+                 const_cast<network::mojom::DataPipeGetterPtr&>(p.data_pipe())
+                     .PassInterface()
+                     .PassHandle()
+                     .release());
+      break;
+    }
+    case network::DataElement::TYPE_UNKNOWN: {
+      NOTREACHED();
+      break;
+    }
+  }
+}
+
+bool ParamTraits<network::DataElement>::Read(const base::Pickle* m,
+                                             base::PickleIterator* iter,
+                                             param_type* r) {
+  int type;
+  if (!ReadParam(m, iter, &type))
+    return false;
+  switch (type) {
+    case network::DataElement::TYPE_BYTES: {
+      const char* data;
+      int len;
+      if (!iter->ReadData(&data, &len))
+        return false;
+      r->SetToBytes(data, len);
+      return true;
+    }
+    case network::DataElement::TYPE_BYTES_DESCRIPTION: {
+      uint64_t length;
+      if (!ReadParam(m, iter, &length))
+        return false;
+      r->SetToBytesDescription(length);
+      return true;
+    }
+    case network::DataElement::TYPE_FILE: {
+      base::FilePath file_path;
+      uint64_t offset, length;
+      base::Time expected_modification_time;
+      if (!ReadParam(m, iter, &file_path))
+        return false;
+      if (!ReadParam(m, iter, &offset))
+        return false;
+      if (!ReadParam(m, iter, &length))
+        return false;
+      if (!ReadParam(m, iter, &expected_modification_time))
+        return false;
+      r->SetToFilePathRange(file_path, offset, length,
+                            expected_modification_time);
+      return true;
+    }
+    case network::DataElement::TYPE_RAW_FILE: {
+      IPC::PlatformFileForTransit platform_file_for_transit;
+      if (!ReadParam(m, iter, &platform_file_for_transit))
+        return false;
+      base::File file = PlatformFileForTransitToFile(platform_file_for_transit);
+      base::FilePath file_path;
+      if (!ReadParam(m, iter, &file_path))
+        return false;
+      uint64_t offset;
+      if (!ReadParam(m, iter, &offset))
+        return false;
+      uint64_t length;
+      if (!ReadParam(m, iter, &length))
+        return false;
+      base::Time expected_modification_time;
+      if (!ReadParam(m, iter, &expected_modification_time))
+        return false;
+      r->SetToFileRange(std::move(file), file_path, offset, length,
+                        expected_modification_time);
+      return true;
+    }
+    case network::DataElement::TYPE_FILE_FILESYSTEM: {
+      GURL file_system_url;
+      uint64_t offset, length;
+      base::Time expected_modification_time;
+      if (!ReadParam(m, iter, &file_system_url))
+        return false;
+      if (!ReadParam(m, iter, &offset))
+        return false;
+      if (!ReadParam(m, iter, &length))
+        return false;
+      if (!ReadParam(m, iter, &expected_modification_time))
+        return false;
+      r->SetToFileSystemUrlRange(file_system_url, offset, length,
+                                 expected_modification_time);
+      return true;
+    }
+    case network::DataElement::TYPE_BLOB: {
+      std::string blob_uuid;
+      uint64_t offset, length;
+      if (!ReadParam(m, iter, &blob_uuid))
+        return false;
+      if (!ReadParam(m, iter, &offset))
+        return false;
+      if (!ReadParam(m, iter, &length))
+        return false;
+      r->SetToBlobRange(blob_uuid, offset, length);
+      return true;
+    }
+    case network::DataElement::TYPE_DISK_CACHE_ENTRY: {
+      NOTREACHED() << "Can't be sent by IPC.";
+      return false;
+    }
+    case network::DataElement::TYPE_DATA_PIPE: {
+      network::mojom::DataPipeGetterPtr data_pipe_getter;
+      mojo::MessagePipeHandle message_pipe;
+      if (!ReadParam(m, iter, &message_pipe))
+        return false;
+      data_pipe_getter.Bind(network::mojom::DataPipeGetterPtrInfo(
+          mojo::ScopedMessagePipeHandle(message_pipe), 0u));
+      r->SetToDataPipe(std::move(data_pipe_getter));
+      return true;
+    }
+    case network::DataElement::TYPE_UNKNOWN: {
+      NOTREACHED();
+      return false;
+    }
+  }
+  return false;
+}
+
+void ParamTraits<network::DataElement>::Log(const param_type& p,
+                                            std::string* l) {
+  l->append("<network::DataElement>");
+}
+
+void ParamTraits<scoped_refptr<network::ResourceRequestBody>>::Write(
+    base::Pickle* m,
+    const param_type& p) {
+  WriteParam(m, p.get() != nullptr);
+  if (p.get()) {
+    WriteParam(m, *p->elements());
+    WriteParam(m, p->identifier());
+    WriteParam(m, p->contains_sensitive_info());
+  }
+}
+
+bool ParamTraits<scoped_refptr<network::ResourceRequestBody>>::Read(
+    const base::Pickle* m,
+    base::PickleIterator* iter,
+    param_type* r) {
+  bool has_object;
+  if (!ReadParam(m, iter, &has_object))
+    return false;
+  if (!has_object)
+    return true;
+  std::vector<network::DataElement> elements;
+  if (!ReadParam(m, iter, &elements))
+    return false;
+  int64_t identifier;
+  if (!ReadParam(m, iter, &identifier))
+    return false;
+  bool contains_sensitive_info;
+  if (!ReadParam(m, iter, &contains_sensitive_info))
+    return false;
+  *r = new network::ResourceRequestBody;
+  (*r)->swap_elements(&elements);
+  (*r)->set_identifier(identifier);
+  (*r)->set_contains_sensitive_info(contains_sensitive_info);
+  return true;
+}
+
+void ParamTraits<scoped_refptr<network::ResourceRequestBody>>::Log(
+    const param_type& p,
+    std::string* l) {
+  l->append("<ResourceRequestBody>");
+}
+
+void ParamTraits<url::Origin>::Write(base::Pickle* m, const url::Origin& p) {
+  WriteParam(m, p.unique());
+  WriteParam(m, p.scheme());
+  WriteParam(m, p.host());
+  WriteParam(m, p.port());
+  WriteParam(m, p.suborigin());
+}
+
+bool ParamTraits<url::Origin>::Read(const base::Pickle* m,
+                                    base::PickleIterator* iter,
+                                    url::Origin* p) {
+  bool unique;
+  std::string scheme;
+  std::string host;
+  uint16_t port;
+  std::string suborigin;
+  if (!ReadParam(m, iter, &unique) || !ReadParam(m, iter, &scheme) ||
+      !ReadParam(m, iter, &host) || !ReadParam(m, iter, &port) ||
+      !ReadParam(m, iter, &suborigin)) {
+    *p = url::Origin();
+    return false;
+  }
+
+  *p = unique ? url::Origin()
+              : url::Origin::UnsafelyCreateOriginWithoutNormalization(
+                    scheme, host, port, suborigin);
+
+  // If a unique origin was created, but the unique flag wasn't set, then
+  // the values provided to 'UnsafelyCreateOriginWithoutNormalization' were
+  // invalid; kill the renderer.
+  if (!unique && p->unique())
+    return false;
+
+  return true;
+}
+
+void ParamTraits<url::Origin>::Log(const url::Origin& p, std::string* l) {
+  l->append(p.Serialize());
+}
+
 }  // namespace IPC
 
 // Generation of IPC definitions.
diff --git a/services/network/public/cpp/network_param_ipc_traits.h b/services/network/public/cpp/network_param_ipc_traits.h
index 6b683c54..34181bbe 100644
--- a/services/network/public/cpp/network_param_ipc_traits.h
+++ b/services/network/public/cpp/network_param_ipc_traits.h
@@ -11,6 +11,7 @@
 #include "ipc/ipc_param_traits.h"
 #include "ipc/param_traits_macros.h"
 #include "net/base/host_port_pair.h"
+#include "net/base/request_priority.h"
 #include "net/cert/cert_verify_result.h"
 #include "net/cert/ct_policy_status.h"
 #include "net/cert/signed_certificate_timestamp.h"
@@ -19,11 +20,16 @@
 #include "net/nqe/effective_connection_type.h"
 #include "net/ssl/ssl_info.h"
 #include "net/url_request/redirect_info.h"
+#include "services/network/public/cpp/resource_request.h"
+#include "services/network/public/cpp/resource_request_body.h"
 #include "services/network/public/cpp/resource_response.h"
 #include "services/network/public/cpp/resource_response_info.h"
 #include "services/network/public/cpp/url_loader_completion_status.h"
+#include "services/network/public/interfaces/cors.mojom-shared.h"
 #include "services/network/public/interfaces/fetch_api.mojom-shared.h"
+#include "services/network/public/interfaces/request_context_frame_type.mojom-shared.h"
 #include "url/ipc/url_param_traits.h"
+#include "url/origin.h"
 
 #ifndef INTERNAL_SERVICES_NETWORK_PUBLIC_CPP_NETWORK_PARAM_IPC_TRAITS_H_
 #define INTERNAL_SERVICES_NETWORK_PUBLIC_CPP_NETWORK_PARAM_IPC_TRAITS_H_
@@ -152,6 +158,36 @@
   static void Log(const param_type& p, std::string* l);
 };
 
+template <>
+struct ParamTraits<network::DataElement> {
+  typedef network::DataElement param_type;
+  static void Write(base::Pickle* m, const param_type& p);
+  static bool Read(const base::Pickle* m,
+                   base::PickleIterator* iter,
+                   param_type* r);
+  static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<scoped_refptr<network::ResourceRequestBody>> {
+  typedef scoped_refptr<network::ResourceRequestBody> param_type;
+  static void Write(base::Pickle* m, const param_type& p);
+  static bool Read(const base::Pickle* m,
+                   base::PickleIterator* iter,
+                   param_type* r);
+  static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<url::Origin> {
+  typedef url::Origin param_type;
+  static void Write(base::Pickle* m, const param_type& p);
+  static bool Read(const base::Pickle* m,
+                   base::PickleIterator* iter,
+                   param_type* p);
+  static void Log(const param_type& p, std::string* l);
+};
+
 }  // namespace IPC
 
 #endif  // INTERNAL_SERVICES_NETWORK_PUBLIC_CPP_NETWORK_PARAM_IPC_TRAITS_H_
@@ -165,7 +201,7 @@
                           net::OCSPRevocationStatus::UNKNOWN)
 
 IPC_ENUM_TRAITS_MAX_VALUE(net::ct::SCTVerifyStatus, net::ct::SCT_STATUS_MAX)
-
+IPC_ENUM_TRAITS_MAX_VALUE(net::RequestPriority, net::MAXIMUM_PRIORITY)
 IPC_ENUM_TRAITS_MAX_VALUE(net::SSLInfo::HandshakeType,
                           net::SSLInfo::HANDSHAKE_FULL)
 IPC_ENUM_TRAITS_MAX_VALUE(net::TokenBindingParam, net::TB_PARAM_ECDSAP256)
@@ -175,15 +211,30 @@
   IPC_STRUCT_TRAITS_MEMBER(value)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(net::MutableNetworkTrafficAnnotationTag)
+  IPC_STRUCT_TRAITS_MEMBER(unique_id_hash_code)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_TRAITS_BEGIN(net::SignedCertificateTimestampAndStatus)
   IPC_STRUCT_TRAITS_MEMBER(sct)
   IPC_STRUCT_TRAITS_MEMBER(status)
 IPC_STRUCT_TRAITS_END()
 
-// Parameters for a ResourceMsg_RequestComplete
 IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::CORSError,
                           network::mojom::CORSError::kLast)
 
+IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchCredentialsMode,
+                          network::mojom::FetchCredentialsMode::kLast)
+
+IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchRedirectMode,
+                          network::mojom::FetchRedirectMode::kLast)
+
+IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::FetchRequestMode,
+                          network::mojom::FetchRequestMode::kLast)
+
+IPC_ENUM_TRAITS_MAX_VALUE(network::mojom::RequestContextFrameType,
+                          network::mojom::RequestContextFrameType::kLast)
+
 IPC_STRUCT_TRAITS_BEGIN(network::CORSErrorStatus)
   IPC_STRUCT_TRAITS_MEMBER(cors_error)
   IPC_STRUCT_TRAITS_MEMBER(related_response_headers)
@@ -214,6 +265,53 @@
   IPC_STRUCT_TRAITS_MEMBER(referred_token_binding_host)
 IPC_STRUCT_TRAITS_END()
 
+IPC_STRUCT_TRAITS_BEGIN(network::ResourceRequest)
+  IPC_STRUCT_TRAITS_MEMBER(method)
+  IPC_STRUCT_TRAITS_MEMBER(url)
+  IPC_STRUCT_TRAITS_MEMBER(site_for_cookies)
+  IPC_STRUCT_TRAITS_MEMBER(update_first_party_url_on_redirect)
+  IPC_STRUCT_TRAITS_MEMBER(request_initiator)
+  IPC_STRUCT_TRAITS_MEMBER(referrer)
+  IPC_STRUCT_TRAITS_MEMBER(referrer_policy)
+  IPC_STRUCT_TRAITS_MEMBER(is_prerendering)
+  IPC_STRUCT_TRAITS_MEMBER(headers)
+  IPC_STRUCT_TRAITS_MEMBER(load_flags)
+  IPC_STRUCT_TRAITS_MEMBER(plugin_child_id)
+  IPC_STRUCT_TRAITS_MEMBER(resource_type)
+  IPC_STRUCT_TRAITS_MEMBER(priority)
+  IPC_STRUCT_TRAITS_MEMBER(request_context)
+  IPC_STRUCT_TRAITS_MEMBER(appcache_host_id)
+  IPC_STRUCT_TRAITS_MEMBER(should_reset_appcache)
+  IPC_STRUCT_TRAITS_MEMBER(service_worker_provider_id)
+  IPC_STRUCT_TRAITS_MEMBER(originated_from_service_worker)
+  IPC_STRUCT_TRAITS_MEMBER(service_worker_mode)
+  IPC_STRUCT_TRAITS_MEMBER(fetch_request_mode)
+  IPC_STRUCT_TRAITS_MEMBER(fetch_credentials_mode)
+  IPC_STRUCT_TRAITS_MEMBER(fetch_redirect_mode)
+  IPC_STRUCT_TRAITS_MEMBER(fetch_integrity)
+  IPC_STRUCT_TRAITS_MEMBER(fetch_request_context_type)
+  IPC_STRUCT_TRAITS_MEMBER(fetch_frame_type)
+  IPC_STRUCT_TRAITS_MEMBER(request_body)
+  IPC_STRUCT_TRAITS_MEMBER(download_to_file)
+  IPC_STRUCT_TRAITS_MEMBER(keepalive)
+  IPC_STRUCT_TRAITS_MEMBER(has_user_gesture)
+  IPC_STRUCT_TRAITS_MEMBER(enable_load_timing)
+  IPC_STRUCT_TRAITS_MEMBER(enable_upload_progress)
+  IPC_STRUCT_TRAITS_MEMBER(do_not_prompt_for_login)
+  IPC_STRUCT_TRAITS_MEMBER(render_frame_id)
+  IPC_STRUCT_TRAITS_MEMBER(is_main_frame)
+  IPC_STRUCT_TRAITS_MEMBER(transition_type)
+  IPC_STRUCT_TRAITS_MEMBER(should_replace_current_entry)
+  IPC_STRUCT_TRAITS_MEMBER(transferred_request_child_id)
+  IPC_STRUCT_TRAITS_MEMBER(transferred_request_request_id)
+  IPC_STRUCT_TRAITS_MEMBER(allow_download)
+  IPC_STRUCT_TRAITS_MEMBER(report_raw_headers)
+  IPC_STRUCT_TRAITS_MEMBER(previews_state)
+  IPC_STRUCT_TRAITS_MEMBER(resource_body_stream_url)
+  IPC_STRUCT_TRAITS_MEMBER(initiated_in_secure_context)
+  IPC_STRUCT_TRAITS_MEMBER(download_to_network_cache_only)
+IPC_STRUCT_TRAITS_END()
+
 IPC_STRUCT_TRAITS_BEGIN(network::ResourceResponseInfo)
   IPC_STRUCT_TRAITS_MEMBER(request_time)
   IPC_STRUCT_TRAITS_MEMBER(response_time)
diff --git a/services/network/public/cpp/resource_request.h b/services/network/public/cpp/resource_request.h
index a61e348..f0fd32b 100644
--- a/services/network/public/cpp/resource_request.h
+++ b/services/network/public/cpp/resource_request.h
@@ -14,9 +14,9 @@
 #include "net/http/http_request_headers.h"
 #include "net/url_request/url_request.h"
 #include "services/network/public/cpp/resource_request_body.h"
-#include "services/network/public/interfaces/cors.mojom.h"
-#include "services/network/public/interfaces/fetch_api.mojom.h"
-#include "services/network/public/interfaces/request_context_frame_type.mojom.h"
+#include "services/network/public/interfaces/cors.mojom-shared.h"
+#include "services/network/public/interfaces/fetch_api.mojom-shared.h"
+#include "services/network/public/interfaces/request_context_frame_type.mojom-shared.h"
 #include "url/gurl.h"
 #include "url/origin.h"
 
diff --git a/services/network/public/cpp/typemaps.gni b/services/network/public/cpp/typemaps.gni
index 6e7bd9a94..316bd78 100644
--- a/services/network/public/cpp/typemaps.gni
+++ b/services/network/public/cpp/typemaps.gni
@@ -3,10 +3,16 @@
 # found in the LICENSE file.
 
 typemaps = [
+  "//services/network/public/cpp/cookie_manager.typemap",
+  "//services/network/public/cpp/cors_error_status.typemap",
+  "//services/network/public/cpp/http_request_headers.typemap",
   "//services/network/public/cpp/mutable_network_traffic_annotation_tag.typemap",
   "//services/network/public/cpp/mutable_partial_network_traffic_annotation_tag.typemap",
-  "//services/network/public/cpp/cookie_manager.typemap",
-  "//services/network/public/cpp/http_request_headers.typemap",
+  "//services/network/public/cpp/network_param.typemap",
   "//services/network/public/cpp/network_types.typemap",
   "//services/network/public/cpp/proxy_config.typemap",
+  "//services/network/public/cpp/url_loader_completion_status.typemap",
+  "//services/network/public/cpp/url_request.typemap",
+  "//services/network/public/cpp/url_request_redirect_info.typemap",
+  "//services/network/public/cpp/url_response_head.typemap",
 ]
diff --git a/content/public/common/url_loader_completion_status.typemap b/services/network/public/cpp/url_loader_completion_status.typemap
similarity index 65%
rename from content/public/common/url_loader_completion_status.typemap
rename to services/network/public/cpp/url_loader_completion_status.typemap
index 405cced2..65416e4 100644
--- a/content/public/common/url_loader_completion_status.typemap
+++ b/services/network/public/cpp/url_loader_completion_status.typemap
@@ -2,15 +2,16 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-mojom = "//content/public/common/url_loader.mojom"
+mojom = "//services/network/public/interfaces/url_loader.mojom"
 public_headers =
     [ "//services/network/public/cpp/url_loader_completion_status.h" ]
 traits_headers = [ "//services/network/public/cpp/network_param_ipc_traits.h" ]
 deps = [
   "//net",
-  "//services/network/public/cpp",
-  "//third_party/WebKit/public:blink_headers",
+]
+public_deps = [
+  "//services/network/public/cpp:typemap_dependencies",
 ]
 type_mappings = [
-  "content.mojom.URLLoaderCompletionStatus=network::URLLoaderCompletionStatus",
+  "network.mojom.URLLoaderCompletionStatus=network::URLLoaderCompletionStatus",
 ]
diff --git a/services/network/public/cpp/url_request.typemap b/services/network/public/cpp/url_request.typemap
new file mode 100644
index 0000000..92dac7e1
--- /dev/null
+++ b/services/network/public/cpp/url_request.typemap
@@ -0,0 +1,17 @@
+# Copyright 2016 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.
+
+mojom = "//services/network/public/interfaces/url_loader.mojom"
+public_headers = [ "//services/network/public/cpp/resource_request.h" ]
+traits_headers = [
+  "//services/network/public/cpp/network_param_ipc_traits.h",
+  "//services/network/public/cpp/url_request_struct_traits.h",
+]
+public_deps = [
+  "//services/network/public/cpp:typemap_dependencies",
+]
+type_mappings = [
+  "network.mojom.URLRequest=network::ResourceRequest",
+  "network.mojom.RequestPriority=net::RequestPriority",
+]
diff --git a/content/public/common/url_request_redirect_info.typemap b/services/network/public/cpp/url_request_redirect_info.typemap
similarity index 69%
rename from content/public/common/url_request_redirect_info.typemap
rename to services/network/public/cpp/url_request_redirect_info.typemap
index ef52349..9f77e3c8 100644
--- a/content/public/common/url_request_redirect_info.typemap
+++ b/services/network/public/cpp/url_request_redirect_info.typemap
@@ -2,10 +2,10 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-mojom = "//content/public/common/url_loader.mojom"
+mojom = "//services/network/public/interfaces/url_loader.mojom"
 public_headers = [ "//net/url_request/redirect_info.h" ]
 traits_headers = [ "//services/network/public/cpp/network_param_ipc_traits.h" ]
-deps = [
+public_deps = [
   "//net:net",
 ]
-type_mappings = [ "content.mojom.URLRequestRedirectInfo=net::RedirectInfo" ]
+type_mappings = [ "network.mojom.URLRequestRedirectInfo=net::RedirectInfo" ]
diff --git a/services/network/public/cpp/url_request_struct_traits.cc b/services/network/public/cpp/url_request_struct_traits.cc
new file mode 100644
index 0000000..61a1e198
--- /dev/null
+++ b/services/network/public/cpp/url_request_struct_traits.cc
@@ -0,0 +1,60 @@
+// Copyright 2017 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 "services/network/public/cpp/url_request_struct_traits.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+
+network::mojom::RequestPriority
+EnumTraits<network::mojom::RequestPriority, net::RequestPriority>::ToMojom(
+    net::RequestPriority priority) {
+  switch (priority) {
+    case net::THROTTLED:
+      return network::mojom::RequestPriority::kThrottled;
+    case net::IDLE:
+      return network::mojom::RequestPriority::kIdle;
+    case net::LOWEST:
+      return network::mojom::RequestPriority::kLowest;
+    case net::LOW:
+      return network::mojom::RequestPriority::kLow;
+    case net::MEDIUM:
+      return network::mojom::RequestPriority::kMedium;
+    case net::HIGHEST:
+      return network::mojom::RequestPriority::kHighest;
+  }
+  NOTREACHED();
+  return static_cast<network::mojom::RequestPriority>(priority);
+}
+
+bool EnumTraits<network::mojom::RequestPriority, net::RequestPriority>::
+    FromMojom(network::mojom::RequestPriority in, net::RequestPriority* out) {
+  switch (in) {
+    case network::mojom::RequestPriority::kThrottled:
+      *out = net::THROTTLED;
+      return true;
+    case network::mojom::RequestPriority::kIdle:
+      *out = net::IDLE;
+      return true;
+    case network::mojom::RequestPriority::kLowest:
+      *out = net::LOWEST;
+      return true;
+    case network::mojom::RequestPriority::kLow:
+      *out = net::LOW;
+      return true;
+    case network::mojom::RequestPriority::kMedium:
+      *out = net::MEDIUM;
+      return true;
+    case network::mojom::RequestPriority::kHighest:
+      *out = net::HIGHEST;
+      return true;
+  }
+
+  NOTREACHED();
+  *out = static_cast<net::RequestPriority>(in);
+  return true;
+}
+
+}  // namespace mojo
diff --git a/services/network/public/cpp/url_request_struct_traits.h b/services/network/public/cpp/url_request_struct_traits.h
new file mode 100644
index 0000000..30f4b7ab5
--- /dev/null
+++ b/services/network/public/cpp/url_request_struct_traits.h
@@ -0,0 +1,23 @@
+// Copyright 2017 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 SERVICES_NETWORK_PUBLIC_CPP_URL_REQUEST_STRUCT_TRAITS_H_
+#define SERVICES_NETWORK_PUBLIC_CPP_URL_REQUEST_STRUCT_TRAITS_H_
+
+#include "mojo/public/cpp/bindings/enum_traits.h"
+#include "net/base/request_priority.h"
+#include "services/network/public/interfaces/url_loader.mojom-shared.h"
+
+namespace mojo {
+
+template <>
+struct EnumTraits<network::mojom::RequestPriority, net::RequestPriority> {
+  static network::mojom::RequestPriority ToMojom(net::RequestPriority priority);
+  static bool FromMojom(network::mojom::RequestPriority in,
+                        net::RequestPriority* out);
+};
+
+}  // namespace mojo
+
+#endif  // SERVICES_NETWORK_PUBLIC_CPP_URL_REQUEST_STRUCT_TRAITS_H_
diff --git a/services/network/public/cpp/url_response_head.typemap b/services/network/public/cpp/url_response_head.typemap
new file mode 100644
index 0000000..66e8663
--- /dev/null
+++ b/services/network/public/cpp/url_response_head.typemap
@@ -0,0 +1,12 @@
+# Copyright 2016 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.
+
+mojom = "//services/network/public/interfaces/url_loader.mojom"
+public_headers = [ "//services/network/public/cpp/resource_response.h" ]
+traits_headers = [ "//services/network/public/cpp/network_param_ipc_traits.h" ]
+public_deps = [
+  "//services/network/public/cpp:typemap_dependencies",
+]
+type_mappings =
+    [ "network.mojom.URLResponseHead=network::ResourceResponseHead" ]
diff --git a/services/network/public/interfaces/BUILD.gn b/services/network/public/interfaces/BUILD.gn
index e25ed31..494d45a 100644
--- a/services/network/public/interfaces/BUILD.gn
+++ b/services/network/public/interfaces/BUILD.gn
@@ -4,11 +4,38 @@
 
 import("//mojo/public/tools/bindings/mojom.gni")
 
+# This interface is put in its own target to avoid a circular dependency, which
+# comes from the fact that the typemap for url_loader.mojom
+# (ResourceRequestBody) uses the interface from data_pipe_getter.mojom.
+mojom("data_pipe_interface") {
+  sources = [
+    "data_pipe_getter.mojom",
+  ]
+
+  public_deps = [
+    "//mojo/common:common_custom_types",
+  ]
+
+  # TODO(crbug/598073): When moving the service implementation to
+  # //services/network, add the correct values for export_class_attribute /
+  # export_define / export_header here. Context in https://crrev.com/2225673002.
+
+  if (!is_ios) {
+    export_class_attribute_blink = "BLINK_PLATFORM_EXPORT"
+    export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1"
+    export_header_blink = "third_party/WebKit/public/platform/WebCommon.h"
+  }
+}
+
 mojom("interfaces") {
+  # URLLoader & URLLoaderFactory are used in-process in the browser when
+  # navigation uses URLLoader (NavigationMojoResponse) and in the renderer
+  # when Service Worker uses direct communication (S13nServiceWorker).
+  support_lazy_serialization = true
+
   sources = [
     "cookie_manager.mojom",
     "cors.mojom",
-    "data_pipe_getter.mojom",
     "fetch_api.mojom",
     "http_request_headers.mojom",
     "mutable_network_traffic_annotation_tag.mojom",
@@ -18,9 +45,12 @@
     "proxy_config.mojom",
     "request_context_frame_type.mojom",
     "restricted_cookie_manager.mojom",
+    "url_loader.mojom",
+    "url_loader_factory.mojom",
   ]
 
   public_deps = [
+    ":data_pipe_interface",
     "//mojo/common:common_custom_types",
     "//url/mojo:url_mojom_gurl",
   ]
diff --git a/content/public/common/url_loader.mojom b/services/network/public/interfaces/url_loader.mojom
similarity index 95%
rename from content/public/common/url_loader.mojom
rename to services/network/public/interfaces/url_loader.mojom
index 05cac6f7..fa79646 100644
--- a/content/public/common/url_loader.mojom
+++ b/services/network/public/interfaces/url_loader.mojom
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module content.mojom;
+module network.mojom;
 
 [Native]
 struct URLRequest;
@@ -22,6 +22,14 @@
 [Native]
 struct URLLoaderCompletionStatus;
 
+// TODO(jam): move these two Native blocks to network_service_test.mojom once it
+// moves to services/network.
+[Native]
+struct CertVerifyResult;
+
+[Native]
+struct X509Certificate;
+
 // This enum corresponds to net::RequestPriority. See its comments for details.
 enum RequestPriority {
   kThrottled = 0,
diff --git a/content/public/common/url_loader_factory.mojom b/services/network/public/interfaces/url_loader_factory.mojom
similarity index 89%
rename from content/public/common/url_loader_factory.mojom
rename to services/network/public/interfaces/url_loader_factory.mojom
index 0a7c4c4c..6308b65c 100644
--- a/content/public/common/url_loader_factory.mojom
+++ b/services/network/public/interfaces/url_loader_factory.mojom
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-module content.mojom;
+module network.mojom;
 
-import "services/network/public/interfaces/mutable_network_traffic_annotation_tag.mojom";
+import "mutable_network_traffic_annotation_tag.mojom";
 import "url_loader.mojom";
 
 const uint32 kURLLoadOptionNone = 0;
@@ -38,8 +38,7 @@
                        uint32 options,
                        URLRequest request,
                        URLLoaderClient client,
-                       network.mojom.MutableNetworkTrafficAnnotationTag
-                           traffic_annotation);
+                       MutableNetworkTrafficAnnotationTag traffic_annotation);
 
   // Connects a new pipe to this instance of the URLLoaderFactory interface.
   Clone(URLLoaderFactory& factory);
diff --git a/services/ui/ws/display_manager.cc b/services/ui/ws/display_manager.cc
index 305a02e3..3265feb 100644
--- a/services/ui/ws/display_manager.cc
+++ b/services/ui/ws/display_manager.cc
@@ -141,8 +141,12 @@
     LOG(ERROR) << "SetDisplayConfiguration primary id not in displays";
     return false;
   }
+
+  // Ignore a temporarily missing interal display during ash unified mode setup.
   if (!found_internal_display &&
-      internal_display_id != display::kInvalidDisplayId) {
+      internal_display_id != display::kInvalidDisplayId &&
+      (displays.size() != 1 ||
+       displays[0].id() != display::kUnifiedDisplayId)) {
     LOG(ERROR) << "SetDisplayConfiguration internal display id not in displays";
     return false;
   }
diff --git a/services/video_capture/public/cpp/constants.cc b/services/video_capture/public/cpp/constants.cc
index 42390d7c..afbdc21 100644
--- a/services/video_capture/public/cpp/constants.cc
+++ b/services/video_capture/public/cpp/constants.cc
@@ -10,8 +10,7 @@
 
 const base::Feature kMojoVideoCapture {
   "MojoVideoCapture",
-#if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) || \
-    defined(OS_WIN)
+#if defined(OS_MACOSX) || defined(OS_WIN)
       base::FEATURE_ENABLED_BY_DEFAULT
 #else
       base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc
index c6b029e7..3d3a9a4a 100644
--- a/storage/browser/blob/blob_storage_context.cc
+++ b/storage/browser/blob/blob_storage_context.cc
@@ -49,15 +49,13 @@
       UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.Bytes", length / 1024);
       break;
     case network::DataElement::TYPE_BLOB:
-      UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.Blob",
-                              (length - input_element.offset()) / 1024);
+      UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.Blob", length / 1024);
       break;
     case network::DataElement::TYPE_FILE: {
       bool full_file = (length == std::numeric_limits<uint64_t>::max());
       UMA_HISTOGRAM_BOOLEAN("Storage.BlobItemSize.File.Unknown", full_file);
       if (!full_file) {
-        UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.File",
-                                (length - input_element.offset()) / 1024);
+        UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.File", length / 1024);
       }
       break;
     }
@@ -67,13 +65,12 @@
                             full_file);
       if (!full_file) {
         UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.FileSystem",
-                                (length - input_element.offset()) / 1024);
+                                length / 1024);
       }
       break;
     }
     case network::DataElement::TYPE_DISK_CACHE_ENTRY:
-      UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.CacheEntry",
-                              (length - input_element.offset()) / 1024);
+      UMA_HISTOGRAM_COUNTS_1M("Storage.BlobItemSize.CacheEntry", length / 1024);
       break;
     case network::DataElement::TYPE_RAW_FILE:
     case network::DataElement::TYPE_DATA_PIPE:
@@ -121,6 +118,7 @@
           (type == network::DataElement::TYPE_BYTES_DESCRIPTION);
       checked_transport_quota_needed += length;
       checked_total_size += length;
+      checked_total_memory_size += length;
       scoped_refptr<ShareableBlobDataItem> item = new ShareableBlobDataItem(
           std::move(input_item), ShareableBlobDataItem::QUOTA_NEEDED);
       pending_transport_items.push_back(item);
diff --git a/testing/buildbot/chromium.perf.json b/testing/buildbot/chromium.perf.json
index 69307f7..80ec356f 100644
--- a/testing/buildbot/chromium.perf.json
+++ b/testing/buildbot/chromium.perf.json
@@ -41832,27 +41832,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "8086:1626",
-              "id": "build126-b1",
-              "os": "Mac-10.11",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
@@ -49858,27 +49837,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "1002:6821",
-              "id": "build132-b1",
-              "os": "Mac-10.11",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
@@ -53879,27 +53837,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "8086:0d26",
-              "id": "build30-b4",
-              "os": "Mac-10.11",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
@@ -65591,27 +65528,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "1002:6613",
-              "id": "build103-m1",
-              "os": "Windows-2008ServerR2-SP1",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
@@ -69530,27 +69446,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "8086:041a",
-              "id": "build166-m1",
-              "os": "Windows-2008ServerR2-SP1",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
@@ -81353,27 +81248,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "102b:0532",
-              "id": "build140-m1",
-              "os": "Windows-2008ServerR2-SP1",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
@@ -85292,27 +85166,6 @@
         }
       },
       {
-        "args": [],
-        "isolate_name": "performance_browser_tests",
-        "name": "performance_browser_tests",
-        "swarming": {
-          "can_use_on_swarming_builders": true,
-          "dimension_sets": [
-            {
-              "gpu": "102b:0532",
-              "id": "build145-m1",
-              "os": "Windows-2012ServerR2-SP0",
-              "pool": "Chrome-perf"
-            }
-          ],
-          "expiration": 36000,
-          "hard_timeout": 10800,
-          "ignore_task_failure": false,
-          "io_timeout": 600,
-          "upload_test_results": true
-        }
-      },
-      {
         "args": [
           "power.idle_platform",
           "-v",
diff --git a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
index 2c89759..669d00a 100644
--- a/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
+++ b/testing/buildbot/filters/mojo.fyi.network_browser_tests.filter
@@ -15,6 +15,7 @@
 -ChromeSitePerProcessTest.LaunchExternalProtocolFromSubframe
 -ContentFaviconDriverTest.ReloadBypassingCache
 -CredentialManagerBrowserTest.CreatePublicKeyCredentialAlgorithmNotSupported
+-CredentialManagerBrowserTest.CreatePublicKeyCredentialInvalidRp
 -CredentialManagerBrowserTest.MojoConnectionRecreatedAfterNavigation
 -CredentialManagerBrowserTest.StoreInUnloadHandler_CrossSite_OnDemandMojoPipe
 -CredentialManagerBrowserTest.StoreInUnloadHandler_CrossSite_PreestablishedPipe
@@ -180,14 +181,6 @@
 -WebViewTests/WebViewTest.WebViewInBackgroundPage/1
 
 # crbug.com/776589 Intercepting requests with net::URLRequestFilter.
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithDownloads/0
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithDownloads/1
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithDownloadsFromDifferentProfiles/0
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithDownloadsFromDifferentProfiles/1
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithOffTheRecordDownloads/0
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithOffTheRecordDownloads/1
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithOffTheRecordWindowAndRegularDownload/0
--BrowserCloseManagerWithDownloadsBrowserTest/BrowserCloseManagerWithDownloadsBrowserTest.TestWithOffTheRecordWindowAndRegularDownload/1
 -ClientHintsBrowserTest.ClientHintsLifetimeNotAttachedCookiesBlocked
 -ContentSettingsTest.AllowCookiesForASessionUsingExceptions
 -ContentSettingsTest.BasicCookies
diff --git a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
index 37b4d98..ee6f517 100644
--- a/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
+++ b/testing/buildbot/filters/mojo.fyi.network_content_browsertests.filter
@@ -36,7 +36,6 @@
 -DataUrlNavigationBrowserTest.PDF_NavigationFromFrame_TopFrameIsDataURL_Block
 
 -AsyncResourceHandlerBrowserTest/AsyncResourceHandlerBrowserTest.UploadProgress*
--BrowserSideNavigationBrowserTest.FailedNavigation
 -CrossSiteResourceHandlerTest.NoDeliveryToDetachedFrame
 -CrossSiteTransferTest.NoLeakOnCrossSiteCancel
 -CrossSiteTransferTest.ReplaceEntryCrossProcessThenTransfer
@@ -53,11 +52,8 @@
 -IsolatedDevToolsProtocolTest.ControlNavigationsChildFrames
 -IsolateIcelandFrameTreeBrowserTest.ProcessSwitchForIsolatedBlob
 -ManifestBrowserTest.UseCredentialsSendCookies
--NavigationControllerBrowserTest.ErrorPageReplacement
 -NavigationHandleImplBrowserTest.ErrorCodeOnRedirect
 -NavigationHandleImplBrowserTest.RedirectToRendererDebugUrl
--NavigationMojoResponseBrowserTest.FailedNavigation
--PlzNavigateNavigationHandleImplBrowserTest.ErrorPageNetworkError
 -PowerMonitorTest.TestGpuProcess
 -PowerMonitorTest.TestRendererProcess
 -PowerMonitorTest.TestUtilityProcess
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json
index 94a1b3bf..1bdcb40 100644
--- a/testing/variations/fieldtrial_testing_config.json
+++ b/testing/variations/fieldtrial_testing_config.json
@@ -2803,6 +2803,26 @@
             ]
         }
     ],
+    "RendererSchedulerWakeUpThrottling": [
+        {
+            "platforms": [
+                "android",
+                "chromeos",
+                "ios",
+                "linux",
+                "mac",
+                "win"
+            ],
+            "experiments": [
+                {
+                    "name": "RendererSchedulerWakeUpThrottling",
+                    "params": {
+                        "wake_up_duration_ms": "5"
+                    }
+                }
+            ]
+        }
+    ],
     "RendererSideResourceScheduler": [
         {
             "platforms": [
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
index 04ffc04..03aa12ba4 100644
--- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
+++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG
@@ -1771,8 +1771,8 @@
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-053.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-055.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-057.xht [ Failure Pass ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-059.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-061.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-059.xht [ Failure Pass ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-061.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-063.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-065.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-067.xht [ Failure Pass ]
@@ -1783,19 +1783,19 @@
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-077.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-079.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-081.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-083.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-083.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-085.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-087.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-089.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-089.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-091.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-093.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-095.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-095.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-097.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-103.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-105.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-107.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-109.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-111.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-111.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-113.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-115.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-117.xht [ Failure Pass ]
@@ -1813,14 +1813,14 @@
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-141.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-143.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-145.xht [ Failure Pass ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-147.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-147.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-149.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-151.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-153.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-155.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-157.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-159.xht [ Failure Pass ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-161.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-161.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-163.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-165.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-167.xht [ Failure Pass ]
@@ -1829,7 +1829,7 @@
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-173.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-175.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-177.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-179.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-179.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-181.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-183.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-185.xht [ Failure ]
@@ -1842,14 +1842,14 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-199.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-201.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-203.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-205.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-205.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-207.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-209.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-211.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-213.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-215.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-215.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-217.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-219.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-219.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-221.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-223.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vlr-225.xht [ Failure ]
@@ -1895,13 +1895,13 @@
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-076.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-078.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-080.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-082.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-082.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-084.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-086.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-088.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-090.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-092.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-094.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-094.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-096.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-102.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-104.xht [ Failure ]
@@ -1916,7 +1916,7 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-122.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-124.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-126.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-128.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-128.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-130.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-132.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-134.xht [ Failure ]
@@ -1932,10 +1932,10 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-154.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-156.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-158.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-160.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-160.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-162.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-164.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-166.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-166.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-168.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-170.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-172.xht [ Failure ]
@@ -1948,7 +1948,7 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-186.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-188.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-190.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-192.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-192.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-194.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-196.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/abs-pos-non-replaced-vrl-198.xht [ Failure ]
@@ -1992,7 +1992,7 @@
 crbug.com/591099 external/wpt/css/css-writing-modes/float-lft-orthog-htb-in-vrl-002.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/float-shrink-to-fit-vrl-008.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-005.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-007.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/float-vlr-007.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/float-vlr-013.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-004.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/float-vrl-006.xht [ Failure ]
@@ -2076,7 +2076,7 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-015.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-017.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vlr-019.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-002.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-002.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-004.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-006.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-008.xht [ Failure Pass ]
@@ -2084,7 +2084,7 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-012.xht [ Failure Pass ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-014.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-016.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-018.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/text-align-vrl-018.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-baseline-vlr-007.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-baseline-vrl-006.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-combine-upright-decorations-001.html [ Failure ]
@@ -2092,9 +2092,9 @@
 crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-003.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-005.xht [ Failure ]
 crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-011.xht [ Failure ]
-crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-013.xht [ Failure ]
+crbug.com/714962 external/wpt/css/css-writing-modes/text-indent-vlr-013.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-002.xht [ Failure ]
-crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-004.xht [ Failure ]
+crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-004.xht [ Failure Pass ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-006.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-008.xht [ Failure ]
 crbug.com/591099 external/wpt/css/css-writing-modes/text-indent-vrl-010.xht [ Failure ]
@@ -2154,8 +2154,8 @@
 crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-min-height-auto-004.html [ Failure ]
 crbug.com/714962 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/selectors4/class-id-attr-selector-invalidation-01.html [ Failure ]
 crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-declaration-15.html [ Failure Pass ]
-crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-01.html [ Failure ]
-crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-02.html [ Failure ]
+crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-01.html [ Failure Pass ]
+crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/variables/variable-font-face-02.html [ Failure Pass ]
 crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-break-inside-001.html [ Failure ]
 crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-compression-001.html [ Crash ]
 crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/text-combine-upright-compression-002.html [ Crash ]
@@ -2210,7 +2210,7 @@
 crbug.com/591099 external/wpt/editing/run/removeformat.html [ Timeout ]
 crbug.com/591099 external/wpt/editing/run/strikethrough.html [ Timeout ]
 crbug.com/591099 external/wpt/editing/run/subscript.html [ Timeout ]
-crbug.com/591099 external/wpt/editing/run/superscript.html [ Timeout ]
+crbug.com/591099 external/wpt/editing/run/superscript.html [ Pass Timeout ]
 crbug.com/591099 external/wpt/editing/run/underline.html [ Timeout ]
 crbug.com/591099 external/wpt/encoding/api-invalid-label.html [ Timeout ]
 crbug.com/591099 external/wpt/encoding/legacy-mb-japanese/euc-jp/eucjp-decode-cseucpkdfmtjapanese.html [ Timeout ]
@@ -2412,7 +2412,7 @@
 crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-auto-css_touch-manual.html [ Timeout ]
 crbug.com/591099 external/wpt/pointerevents/pointerevent_touch-action-button-test_touch-manual.html [ Timeout ]
 crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-keyboard-manual.html [ Pass Timeout ]
-crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-mouse-manual.html [ Timeout ]
+crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-mouse-manual.html [ Pass Timeout ]
 crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-pan-left-css_touch-manual.html [ Pass ]
 crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-pan-right-css_touch-manual.html [ Failure ]
 crbug.com/714962 external/wpt/pointerevents/pointerevent_touch-action-pan-x-pan-y_touch-manual.html [ Timeout ]
@@ -2532,7 +2532,7 @@
 crbug.com/591099 fast/backgrounds/animated-gif-as-background-rounded.html [ Failure ]
 crbug.com/591099 fast/backgrounds/animated-gif-as-background.html [ Failure ]
 crbug.com/591099 fast/backgrounds/animated-svg-as-mask.html [ Failure ]
-crbug.com/591099 fast/backgrounds/background-clip-text-multiline.html [ Failure ]
+crbug.com/591099 fast/backgrounds/background-clip-text-multiline.html [ Failure Pass ]
 crbug.com/591099 fast/backgrounds/background-clip-text.html [ Failure ]
 crbug.com/591099 fast/backgrounds/background-inherit-color-bug.html [ Failure ]
 crbug.com/591099 fast/backgrounds/background-leakage-transforms.html [ Failure ]
@@ -3489,7 +3489,7 @@
 crbug.com/591099 fast/events/keypress-focus-change.html [ Failure ]
 crbug.com/591099 fast/events/media-element-focus-tab.html [ Failure ]
 crbug.com/714962 fast/events/middleClickAutoscroll-click-hyperlink.html [ Timeout ]
-crbug.com/714962 fast/events/middleClickAutoscroll-latching.html [ Timeout ]
+crbug.com/714962 fast/events/middleClickAutoscroll-latching.html [ Pass Timeout ]
 crbug.com/714962 fast/events/mouse-down-on-pseudo-element-remove-crash.html [ Failure ]
 crbug.com/591099 fast/events/mouse-drag-from-frame-to-other-frame.html [ Failure ]
 crbug.com/591099 fast/events/mouse-event-buttons-attribute.html [ Timeout ]
@@ -4972,6 +4972,7 @@
 crbug.com/714962 fast/spatial-navigation/snav-radio.html [ Failure ]
 crbug.com/714962 fast/spatial-navigation/snav-single-select-list.html [ Failure ]
 crbug.com/714962 fast/spatial-navigation/snav-single-select.html [ Timeout ]
+crbug.com/591099 fast/spatial-navigation/snav-stay-in-overflow-div.html [ Failure ]
 crbug.com/714962 fast/spatial-navigation/snav-table-traversal.html [ Failure ]
 crbug.com/714962 fast/spatial-navigation/snav-textarea.html [ Failure ]
 crbug.com/714962 fast/spatial-navigation/snav-tiny-table-traversal.html [ Failure ]
@@ -5469,7 +5470,7 @@
 crbug.com/591099 fullscreen/full-screen-element-stack.html [ Crash ]
 crbug.com/591099 fullscreen/full-screen-iframe-not-allowed.html [ Failure ]
 crbug.com/714962 fullscreen/full-screen-remove-ancestor-after.html [ Crash Pass ]
-crbug.com/591099 fullscreen/full-screen-ruleset-crash.html [ Crash ]
+crbug.com/591099 fullscreen/full-screen-ruleset-crash.html [ Crash Pass ]
 crbug.com/591099 fullscreen/full-screen-twice-newapi.html [ Crash ]
 crbug.com/591099 fullscreen/full-screen-with-css-reference-filter.html [ Crash ]
 crbug.com/591099 fullscreen/full-screen-with-flex-item.html [ Crash ]
@@ -5645,7 +5646,7 @@
 crbug.com/714962 http/tests/devtools/elements/edit/set-attribute.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/edit/set-outer-html-2.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/edit/set-outer-html-for-xhtml.js [ Crash ]
-crbug.com/714962 http/tests/devtools/elements/edit/set-outer-html.js [ Crash ]
+crbug.com/714962 http/tests/devtools/elements/edit/set-outer-html.js [ Crash Pass ]
 crbug.com/714962 http/tests/devtools/elements/edit/undo-dom-edits-2.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/edit/undo-dom-edits.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/edit/undo-set-outer-html-2.js [ Crash ]
@@ -5689,7 +5690,7 @@
 crbug.com/591099 http/tests/devtools/elements/styles-1/edit-value-inside-property.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/styles-1/edit-value-url-with-color.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/styles-2/force-pseudo-state.js [ Crash ]
-crbug.com/591099 http/tests/devtools/elements/styles-2/inject-stylesheet.js [ Crash ]
+crbug.com/591099 http/tests/devtools/elements/styles-2/inject-stylesheet.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/elements/styles-2/page-reload-update-sidebar.js [ Crash ]
 crbug.com/714962 http/tests/devtools/elements/styles-2/paste-property.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles-2/perform-undo-perform-of-mergable-action.js [ Crash ]
@@ -5708,7 +5709,7 @@
 crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-property-after-selector-edit.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-then-change.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-then-delete.js [ Crash ]
-crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-then-enable-overriden-ua.js [ Crash ]
+crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-then-enable-overriden-ua.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/elements/styles-3/styles-disable-then-enable.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/elements/styles-4/disable-last-property-without-semicolon.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles-4/styles-do-not-detach-sourcemap-on-edits.js [ Crash ]
@@ -5721,6 +5722,7 @@
 crbug.com/591099 http/tests/devtools/elements/styles-4/undo-add-rule-crash.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles/cancel-upon-invalid-property.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles/edit-css-with-source-url.js [ Crash ]
+crbug.com/591099 http/tests/devtools/elements/styles/selector-line-deprecated.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/elements/styles/styles-mouse-test.js [ Failure ]
 crbug.com/714962 http/tests/devtools/elements/styles/stylesheet-tracking.js [ Crash ]
 crbug.com/591099 http/tests/devtools/elements/styles/undo-after-cancelled-editing.js [ Crash ]
@@ -5741,11 +5743,12 @@
 crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-dom-xhr-event-breakpoints.js [ Crash ]
 crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-jquery.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/sources/debugger-frameworks/frameworks-steppings.js [ Crash Pass ]
-crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-eval-on-call-frame-inside-iframe.js [ Crash ]
+crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-eval-on-call-frame-inside-iframe.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-eval-while-paused.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-pause-in-internal.js [ Failure ]
 crbug.com/591099 http/tests/devtools/sources/debugger-pause/debugger-pause-on-promise-rejection.js [ Crash ]
 crbug.com/591099 http/tests/devtools/sources/debugger-step/debugger-step-into-custom-element-callbacks.js [ Crash Pass ]
+crbug.com/591099 http/tests/devtools/sources/debugger-step/debugger-step-out-custom-element-callbacks.js [ Crash Pass ]
 crbug.com/591099 http/tests/devtools/sources/debugger-ui/debugger-inline-values.js [ Crash ]
 crbug.com/591099 http/tests/devtools/sources/debugger-ui/function-generator-details.js [ Failure ]
 crbug.com/591099 http/tests/devtools/sources/debugger-ui/watch-expressions-panel-switch.js [ Crash Pass ]
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 9e771710..9c99421 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -2526,7 +2526,7 @@
 
 crbug.com/702837 fast/text/aat-morx.html [ Skip ]
 
-crbug.com/688670 media/track/track-cue-rendering-after-controls-removed.html [ Pass Failure ]
+crbug.com/688670 external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html [ Pass Failure ]
 
 crbug.com/664858 virtual/threaded/fast/scroll-behavior/overflow-scroll-animates.html [ Skip ]
 crbug.com/664858 virtual/threaded/fast/scroll-behavior/smooth-scroll/horizontal-smooth-scroll-in-rtl.html [ Skip ]
@@ -3510,4 +3510,10 @@
 crbug.com/800359 [ Win7 ] external/wpt/mimesniff/mime-types/parsing.any.html [ Pass Timeout ]
 crbug.com/800359 [ Win7 ] external/wpt/mimesniff/mime-types/parsing.any.worker.html [ Pass Timeout ]
 
-crbug.com/799929 external/wpt/performance-timeline/po-takeRecords.html [ Failure ]
+# Sheriff failures 2018-01-18
+# This test is failing regularly on Win 7 (dgb), WebKit Mac10.11 (dgb),
+# WebKit Linux Trusty (dbg).
+crbug.com/803449 http/tests/devtools/sources/debugger-breakpoints/breakpoints-ui-restored-breakpoint.js [ Pass Failure ]
+
+# This test has been flaky for some time on Win 7 (dgb)
+crbug.com/800078 [ Win7 ] http/tests/devtools/console/console-link-to-snippet.js [ Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
index 9b97d95..496057b 100644
--- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
+++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST.json
@@ -85187,6 +85187,30 @@
      {}
     ]
    ],
+   "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html": [
+    [
+     "/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html",
+     [
+      [
+       "/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added-ref.html",
+       "=="
+      ]
+     ],
+     {}
+    ]
+   ],
+   "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html": [
+    [
+     "/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html",
+     [
+      [
+       "/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed-ref.html",
+       "=="
+      ]
+     ],
+     {}
+    ]
+   ],
    "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-line-doesnt-fit.html": [
     [
      "/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-line-doesnt-fit.html",
@@ -94761,11 +94785,6 @@
      {}
     ]
    ],
-   "css/CSS2/floats-clear/OWNERS": [
-    [
-     {}
-    ]
-   ],
    "css/CSS2/floats-clear/adjacent-floats-001-ref.xht": [
     [
      {}
@@ -95566,11 +95585,6 @@
      {}
     ]
    ],
-   "css/CSS2/floats/OWNERS": [
-    [
-     {}
-    ]
-   ],
    "css/CSS2/floats/floats-placement-vertical-001-ref.xht": [
     [
      {}
@@ -96056,11 +96070,6 @@
      {}
     ]
    ],
-   "css/CSS2/normal-flow/OWNERS": [
-    [
-     {}
-    ]
-   ],
    "css/CSS2/normal-flow/block-formatting-context-height-003-ref.xht": [
     [
      {}
@@ -96991,11 +97000,6 @@
      {}
     ]
    ],
-   "css/CSS2/positioning/OWNERS": [
-    [
-     {}
-    ]
-   ],
    "css/CSS2/positioning/absolute-non-replaced-height-002-ref.xht": [
     [
      {}
@@ -110171,6 +110175,11 @@
      {}
     ]
    ],
+   "css/css-grid/alignment/support/100x100-green.png": [
+    [
+     {}
+    ]
+   ],
    "css/css-grid/alignment/support/style-change.js": [
     [
      {}
@@ -137491,6 +137500,16 @@
      {}
     ]
    ],
+   "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added-ref.html": [
+    [
+     {}
+    ]
+   ],
+   "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed-ref.html": [
+    [
+     {}
+    ]
+   ],
    "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-line-doesnt-fit-ref.html": [
     [
      {}
@@ -171754,6 +171773,18 @@
      {}
     ]
    ],
+   "css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html": [
+    [
+     "/css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html",
+     {}
+    ]
+   ],
+   "css/css-typed-om/the-stylepropertymap/declared/delete.html": [
+    [
+     "/css/css-typed-om/the-stylepropertymap/declared/delete.html",
+     {}
+    ]
+   ],
    "css/css-typed-om/the-stylepropertymap/declared/get.tentative.html": [
     [
      "/css/css-typed-om/the-stylepropertymap/declared/get.tentative.html",
@@ -171808,9 +171839,15 @@
      {}
     ]
    ],
-   "css/css-typed-om/the-stylepropertymap/inline/delete.tentative.html": [
+   "css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html": [
     [
-     "/css/css-typed-om/the-stylepropertymap/inline/delete.tentative.html",
+     "/css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html",
+     {}
+    ]
+   ],
+   "css/css-typed-om/the-stylepropertymap/inline/delete.html": [
+    [
+     "/css/css-typed-om/the-stylepropertymap/inline/delete.html",
      {}
     ]
    ],
@@ -215730,6 +215767,18 @@
      {}
     ]
    ],
+   "svg/types/scripted/SVGAnimatedAngle.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedAngle.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedBoolean.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedBoolean.html",
+     {}
+    ]
+   ],
    "svg/types/scripted/SVGAnimatedEnumeration-SVGClipPathElement.html": [
     [
      "/svg/types/scripted/SVGAnimatedEnumeration-SVGClipPathElement.html",
@@ -215832,6 +215881,48 @@
      {}
     ]
    ],
+   "svg/types/scripted/SVGAnimatedInteger.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedInteger.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedLength.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedLength.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedLengthList.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedLengthList.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedNumber.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedNumber.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedNumberList.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedNumberList.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedPreserveAspectRatio.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedPreserveAspectRatio.html",
+     {}
+    ]
+   ],
+   "svg/types/scripted/SVGAnimatedRect.html": [
+    [
+     "/svg/types/scripted/SVGAnimatedRect.html",
+     {}
+    ]
+   ],
    "svg/types/scripted/SVGLength-px-with-context.html": [
     [
      "/svg/types/scripted/SVGLength-px-with-context.html",
@@ -239878,11 +239969,11 @@
    "support"
   ],
   "css/CSS2/OWNERS": [
-   "5498c55b57270bb257281f8f2076a29a8af28fc4",
+   "677c447c86eaa873833bfc778238aec6d6681917",
    "support"
   ],
   "css/CSS2/abspos/OWNERS": [
-   "326990e9bbbfc94acba8ec7853097907adc72512",
+   "e00a50fe8b69cf7c3eab3e02fd784adaacd2fd6e",
    "support"
   ],
   "css/CSS2/abspos/abspos-containing-block-initial-001-ref.xht": [
@@ -240781,10 +240872,6 @@
    "74869c22d5441ad5a9a2c05c3ce231ca69c7650a",
    "manual"
   ],
-  "css/CSS2/floats-clear/OWNERS": [
-   "484f4a54e0dcba760efd8e3d407de6031a65a9db",
-   "support"
-  ],
   "css/CSS2/floats-clear/adjacent-floats-001-ref.xht": [
    "5c57364aaca7482f6347f9653affccf85fa5c935",
    "support"
@@ -242273,10 +242360,6 @@
    "078e1dd6dd61d36cec239ed75d02051f61fe60a5",
    "support"
   ],
-  "css/CSS2/floats/OWNERS": [
-   "484f4a54e0dcba760efd8e3d407de6031a65a9db",
-   "support"
-  ],
   "css/CSS2/floats/floats-placement-vertical-001-ref.xht": [
    "219c3d13a6859b58907f35df0a5602ba215a0335",
    "support"
@@ -243757,10 +243840,6 @@
    "b7c7725481ac65f637548740e9f7eb5dc257e9cc",
    "reftest"
   ],
-  "css/CSS2/normal-flow/OWNERS": [
-   "484f4a54e0dcba760efd8e3d407de6031a65a9db",
-   "support"
-  ],
   "css/CSS2/normal-flow/block-formatting-context-height-001.xht": [
    "6339215a18ef36150d8da77ab2a76442f7007e05",
    "reftest"
@@ -247817,10 +247896,6 @@
    "7c30f983fe0de798db50271f1b2927d886c250c7",
    "visual"
   ],
-  "css/CSS2/positioning/OWNERS": [
-   "484f4a54e0dcba760efd8e3d407de6031a65a9db",
-   "support"
-  ],
   "css/CSS2/positioning/absolute-non-replaced-height-001.xht": [
    "ab3813879cd95fb5aa28607960bf29557878ca8b",
    "visual"
@@ -269098,35 +269173,35 @@
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-011.html": [
-   "e1befaf27f4defef626b8c423f3a82f661160655",
+   "77ae9907a7eddd78821890b70bce2c0543a978f5",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-012.html": [
-   "84eb6de9bb892de373129df60f10bdf0cf9b59d8",
+   "aa3823158eb43bb1fa623a1686402bc965c7f4a6",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-013.html": [
-   "f527bc3b0669b048268a8c59274150f3adeabd01",
+   "c0c5447dd16a89783d5c6b46ab1a6d17bdb719f3",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-014.html": [
-   "eee651407a75b74ba32d60312a347bef95a6501f",
+   "52aa385eb6a0defe54f2b7ea5ef272da4ad37709",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-015.html": [
-   "cccb3afaab2bb61b26229a5bb5713348c9d4a519",
+   "76feb090c78632d8e09767b89e7245970015b007",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-016.html": [
-   "661f7bbd9c211bb29f14bf9124676e40e44d21cd",
+   "c8f7ba2331a80b123206cae0a11dbd76f0f8a235",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-017.html": [
-   "c5aeba430655c90997b790b922ba7aaed087211b",
+   "e25652288f94377e3b5082c7d7244f706903905f",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-018.html": [
-   "89abc2805c57b1c79b65288efbf82fb9f98fc31a",
+   "a1236f5cf353218bcf5565c42df0f44564690ffd",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-019.html": [
@@ -269170,35 +269245,35 @@
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-029.html": [
-   "2c99765c101af32aff4ef16b615930a650db52f2",
+   "633de23d59e98b4380c7aa36c11c3e25e939f417",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-030.html": [
-   "6c3e1b09a0a8e1268a3e2c513b7959972fee1632",
+   "83c7eb2b3ce96edf1d86b18bb59fd518fccad2a4",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-031.html": [
-   "627a1e421cbcc93dbf5b5beb028482495aa96ea9",
+   "1c81a3ecfbbbd52f058b6968d629571e335dd15f",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-032.html": [
-   "a3b9af60a41c8baa60f5ec891a56d3c2e075d6c1",
+   "23a4f14974e70b29a9d618d2c627bc121558ffd1",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-033.html": [
-   "ab9eda7db315fdd67240c93d5544fe3230101509",
+   "319d6241cb92af28d38eb82830f14dd5e3ff1d1a",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-034.html": [
-   "1f506f17eeaf10ca4728c0b3b40ec825e85a4438",
+   "a1527212bd8be336ad27bba260ec350fc1cdef98",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-035.html": [
-   "2bfd66cdd546bf0151c1aaa800903bf974a10b75",
+   "805bbc917117c9df0831c3dcd3c9b6ae951a60c8",
    "testharness"
   ],
   "css/css-grid/alignment/grid-alignment-implies-size-change-036.html": [
-   "d9ab0bc1deb8a9a8b29c80b446ee9f7cb720d214",
+   "e209b20fc006be859a18de232223a5f9bf1d7a8f",
    "testharness"
   ],
   "css/css-grid/alignment/grid-column-axis-alignment-positioned-items-001.html": [
@@ -269945,6 +270020,10 @@
    "dc9d15b18538afb38790de51e31095ce9f93e0a9",
    "reftest"
   ],
+  "css/css-grid/alignment/support/100x100-green.png": [
+   "ff6fda3a436fa54df17a321e2458204fd963dfb2",
+   "support"
+  ],
   "css/css-grid/alignment/support/style-change.js": [
    "021db5d6c4e974ab0c8d7e59666a785db03942c4",
    "support"
@@ -284754,7 +284833,7 @@
    "support"
   ],
   "css/css-typed-om/resources/testhelper.js": [
-   "08f2394f7dfa11460d1e67b8d0c6e556620bf65a",
+   "73fd40cdcca16318de32c214b00e24c6f30d98ee",
    "support"
   ],
   "css/css-typed-om/styleMap-update-function.html": [
@@ -284889,6 +284968,14 @@
    "0a2097381fd03a532db7e2b1fb85dd7a901fb011",
    "testharness"
   ],
+  "css/css-typed-om/the-stylepropertymap/declared/delete-invalid.html": [
+   "fe2d4e5f02b1c931e479253d523f7ec2f59c67a7",
+   "testharness"
+  ],
+  "css/css-typed-om/the-stylepropertymap/declared/delete.html": [
+   "5e2a8ca9f0246aaba3e7d7d038cad125194c5f14",
+   "testharness"
+  ],
   "css/css-typed-om/the-stylepropertymap/declared/get.tentative.html": [
    "944052a99d1b5cc1a574c07339c33fdb6b1423d4",
    "testharness"
@@ -284925,8 +285012,12 @@
    "df640de5b24c8276459a1a7fbc8a02cc97db6223",
    "testharness"
   ],
-  "css/css-typed-om/the-stylepropertymap/inline/delete.tentative.html": [
-   "352917486fa593e0d3f6f645c9c67846aa303ed8",
+  "css/css-typed-om/the-stylepropertymap/inline/delete-invalid.html": [
+   "df4903a2c18099bb5291a307f50778ee757824ed",
+   "testharness"
+  ],
+  "css/css-typed-om/the-stylepropertymap/inline/delete.html": [
+   "922297b80497c164d4217559658a9043a99ebbf8",
    "testharness"
   ],
   "css/css-typed-om/the-stylepropertymap/inline/get.tentative.html": [
@@ -311106,7 +311197,7 @@
    "testharness"
   ],
   "html/dom/usvstring-reflection.html": [
-   "a48e32b268a8117ed803c8ede806a879e1556d76",
+   "353c2ad8b640e34a8bc71d5fe1b5be3c101a4dc2",
    "testharness"
   ],
   "html/editing/.gitkeep": [
@@ -317989,6 +318080,22 @@
    "eeab6b02e728aea21878cf72664929766be057b7",
    "testharness"
   ],
+  "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added-ref.html": [
+   "93575c87d29ce6637a976f01d81edf15051d7c79",
+   "support"
+  ],
+  "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html": [
+   "063fae44970221248485c887a861dd695dad9ae5",
+   "reftest"
+  ],
+  "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed-ref.html": [
+   "eac59788fa5c75d30cdc6a2bb6196ee3b13c11d3",
+   "support"
+  ],
+  "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html": [
+   "bd59e65de7e465c469e00d81cfb9e568da72e9c1",
+   "reftest"
+  ],
   "html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-empty-cue.html": [
    "688c592e8fc4b4dbc2d7d6ea16e17380c13f440a",
    "testharness"
@@ -320590,11 +320697,11 @@
    "testharness"
   ],
   "html/semantics/forms/the-input-element/range-expected.txt": [
-   "e3f8058b2ddf7cc2cfd230566b33e2b96fd90823",
+   "d5893bf15ad9ac1332703d7249a1883dc7f4ec10",
    "support"
   ],
   "html/semantics/forms/the-input-element/range.html": [
-   "dd51c517a149c51e939a30dcad5e93f196e35cff",
+   "e992526fb5f117456a870e52c84eab5a7f4b14ab",
    "testharness"
   ],
   "html/semantics/forms/the-input-element/required_attribute.html": [
@@ -349933,6 +350040,14 @@
    "08237002915323f41dd5590ce4226f95ae79f285",
    "testharness"
   ],
+  "svg/types/scripted/SVGAnimatedAngle.html": [
+   "a3d0e532c846efdbcf0f51967b7c9531ed19768c",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedBoolean.html": [
+   "1d9ed6c9b089bbd43c5dae5f34fa8faaafa9a8e5",
+   "testharness"
+  ],
   "svg/types/scripted/SVGAnimatedEnumeration-SVGClipPathElement.html": [
    "0f81d16badaade09929ca0b35faf89cc420ef199",
    "testharness"
@@ -350001,6 +350116,34 @@
    "b2c5c52669b802412b085529a2babf0ec2ec3ee1",
    "testharness"
   ],
+  "svg/types/scripted/SVGAnimatedInteger.html": [
+   "c4a838233710207e7eb5631a242a9f2f0db83488",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedLength.html": [
+   "b60dfae30ec8af58d6a4f6b024b8a917e3d1f55c",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedLengthList.html": [
+   "28b583d0d5e55379fdc69f182505d37d85929509",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedNumber.html": [
+   "6085f272c222d53838f3c4e9d94dc8260dc846d7",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedNumberList.html": [
+   "6a2920d16df72b0d890c3dff6c2350c65ba08010",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedPreserveAspectRatio.html": [
+   "e2667461c918fceecc4aca58ff5713a98df347c0",
+   "testharness"
+  ],
+  "svg/types/scripted/SVGAnimatedRect.html": [
+   "dfc7ec677df247b015ef360793c7e5f0c926e45f",
+   "testharness"
+  ],
   "svg/types/scripted/SVGLength-px-expected.txt": [
    "96ef321212d43fdc4808262e16e92392fd4d941c",
    "support"
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-011.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-011.html
index ff184f16..d219cab 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-011.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-011.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-012.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-012.html
index b9a9d9b..d8b24be 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-012.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-012.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-013.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-013.html
index 356220b..5520a4c 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-013.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-013.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-014.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-014.html
index 3561ae3d..26ff656 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-014.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-014.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-015.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-015.html
index c56c139..1a5e52c 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-015.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-015.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-016.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-016.html
index 7815a057..66e7e2b4 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-016.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-016.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-017.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-017.html
index c8a2ed8..d9947625 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-017.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-017.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-018.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-018.html
index 547e6a42..f6d0bcb 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-018.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-018.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-029.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-029.html
index 766db6b..5247247 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-029.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-029.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-030.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-030.html
index 3db3b831..4254fd6 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-030.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-030.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-031.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-031.html
index 7b0c26d..35d0dcc8 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-031.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-031.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-032.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-032.html
index d161e19..152c641 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-032.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-032.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-width="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-width="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-033.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-033.html
index 92a74561..5db0980 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-033.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-033.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-034.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-034.html
index 7831440..98e0436 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-034.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-034.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-035.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-035.html
index 4293670..c9810b3 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-035.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-035.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-036.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-036.html
index 23b0190..634e5c7 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-036.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/grid-alignment-implies-size-change-036.html
@@ -37,6 +37,6 @@
 </script>
 <body onload="runTest()">
 <div class="grid" id="grid">
-  <img data-expected-height="100" id="item" src="../grid-items/support/100x100-green.png"></img>
+  <img data-expected-height="100" id="item" src="support/100x100-green.png"></img>
 </div>
 </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/support/100x100-green.png b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/support/100x100-green.png
new file mode 100644
index 0000000..0dcda08
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-grid/alignment/support/100x100-green.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom-ref.html
deleted file mode 100644
index 7d4953d..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom-ref.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<title>Reference for position:sticky elements should respect the top constraint</title>
-
-<style>
-.group {
-  display: inline-block;
-  position: relative;
-  width: 150px;
-  height: 250px;
-}
-
-.scroller {
-  position: relative;
-  width: 100px;
-  height: 200px;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
-
-.contents {
-  height: 500px;
-}
-
-.indicator {
-  background-color: green;
-  position: absolute;
-  left: 0;
-}
-
-.box {
-  width: 100%;
-  height: 100px;
-}
-
-</style>
-
-<script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollTop = 100;
-  document.getElementById('scroller2').scrollTop = 175;
-  document.getElementById('scroller3').scrollTop = 250;
-});
-</script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="top: 200px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="top: 250px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="top: 300px;"></div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom.html
index 18c5cc4..ba23f01 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-bottom.html
@@ -1,104 +1,41 @@
 <!DOCTYPE html>
 <title>position:sticky elements should respect the bottom constraint</title>
-<link rel="match" href="position-sticky-bottom-ref.html" />
 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
 <meta name="assert" content="This test checks that position:sticky elements obey their bottom anchor after scrolling" />
 
-<style>
-.group {
-  display: inline-block;
-  position: relative;
-  width: 150px;
-  height: 250px;
-}
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
 
-.scroller {
-  position: relative;
-  width: 100px;
-  height: 200px;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
+<script src="resources/sticky-util.js"></script>
 
-.contents {
-  height: 500px;
-}
-
-.prepadding {
-  height: 200px;
-}
-
-.container {
-  height: 200px;
-}
-
-.filler {
-  height: 100px;
-}
-
-.indicator {
-  background-color: red;
-  position: absolute;
-  left: 0;
-}
-
-.sticky {
-  background-color: green;
-  position: sticky;
-  bottom: 25px;
-}
-
-.box {
-  width: 100%;
-  height: 100px;
-}
-</style>
+<body></body>
 
 <script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollTop = 100;
-  document.getElementById('scroller2').scrollTop = 175;
-  document.getElementById('scroller3').scrollTop = 250;
-});
+test(() => {
+  const elements = setupStickyTest('bottom', 25);
+  elements.scroller.scrollTop = 300;
+  const nonStickyTopY = elements.container.offsetTop +
+      elements.filler.clientHeight;
+  assert_equals(elements.sticky.offsetTop, nonStickyTopY);
+}, 'before reaching the sticking point the sticky box should not be offset');
+
+test(() => {
+  const elements = setupStickyTest('bottom', 25);
+  elements.scroller.scrollTop = 100;
+
+  const nonStickyTopY = elements.container.offsetTop +
+      elements.filler.clientHeight;
+  const nonStickyBottomY = nonStickyTopY + elements.sticky.clientHeight;
+  const targetBottomY = elements.scroller.clientHeight +
+      elements.scroller.scrollTop - 25;
+  const stickyOffset = nonStickyBottomY - targetBottomY;
+
+  assert_equals(elements.sticky.offsetTop, nonStickyTopY - stickyOffset);
+}, 'after reaching the sticking point the sticky box should be offset');
+
+test(() => {
+  const elements = setupStickyTest('bottom', 25);
+  elements.scroller.scrollTop = 0;
+  assert_equals(elements.sticky.offsetTop, elements.container.offsetTop);
+}, 'the sticky box should not be pushed outside its containing block');
 </script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="indicator box" style="top: 200px;"></div>
-    <div class="contents">
-      <div class="prepadding"></div>
-      <div class="container">
-        <div class="filler"></div>
-        <div class="sticky box"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="indicator box" style="top: 250px;"></div>
-    <div class="contents">
-      <div class="prepadding"></div>
-      <div class="container">
-        <div class="filler"></div>
-        <div class="sticky box"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="indicator box" style="top: 300px;"></div>
-    <div class="contents">
-      <div class="prepadding"></div>
-      <div class="container">
-        <div class="filler"></div>
-        <div class="sticky box"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left-ref.html
deleted file mode 100644
index e0de6fb..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left-ref.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<title>Reference for position:sticky elements should respect the left constraint</title>
-
-<style>
-.group {
-  position: relative;
-  width: 250px;
-  height: 150px;
-}
-
-.scroller {
-  position: relative;
-  width: 200px;
-  height: 100px;
-  overflow-x: auto;
-  overflow-y: hidden;
-}
-
-.contents {
-  height: 100%;
-  width: 500px;
-}
-
-.indicator {
-  background-color: green;
-  position: absolute;
-  top: 0;
-}
-
-.box {
-  height: 100%;
-  width: 100px;
-}
-</style>
-
-<script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollLeft = 50;
-  document.getElementById('scroller2').scrollLeft = 125;
-  document.getElementById('scroller3').scrollLeft = 200;
-});
-</script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="left: 150px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="left: 175px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="left: 200px;"></div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left.html
index 40a4d728..0c8bb58 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-left.html
@@ -1,103 +1,44 @@
 <!DOCTYPE html>
 <title>position:sticky elements should respect the left constraint</title>
-<link rel="match" href="position-sticky-left-ref.html" />
 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
 <meta name="assert" content="This test checks that position:sticky elements obey their left anchor after scrolling" />
 
-<style>
-.group {
-  position: relative;
-  width: 250px;
-  height: 150px;
-}
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
 
-.scroller {
-  position: relative;
-  width: 200px;
-  height: 100px;
-  overflow-x: auto;
-  overflow-y: hidden;
-}
+<script src="resources/sticky-util.js"></script>
 
-.contents {
-  height: 100%;
-  width: 500px;
-}
-
-.prepadding {
-  display: inline-block;
-  height: 100%;
-  width: 100px;
-}
-
-.container {
-  display: inline-block;
-  height: 100%;
-  width: 200px;
-}
-
-.innerpadding {
-  display: inline-block;
-  height: 100%;
-  width: 50px;
-}
-
-.indicator {
-  background-color: red;
-  position: absolute;
-  top: 0;
-}
-
-.sticky {
-  background-color: green;
-  position: sticky;
-  left: 50px;
-}
-
-.box {
-  display: inline-block;
-  height: 100%;
-  width: 100px;
-}
-
-</style>
+<body></body>
 
 <script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollLeft = 50;
-  document.getElementById('scroller2').scrollLeft = 125;
-  document.getElementById('scroller3').scrollLeft = 200;
-});
+test(() => {
+  const elements = setupStickyTest('left', 50, true);
+  elements.scroller.scrollLeft = 100;
+  const nonStickyLeftY = elements.container.offsetLeft +
+      elements.filler.clientWidth;
+  assert_equals(elements.sticky.offsetLeft, nonStickyLeftY);
+}, 'before reaching the sticking point the sticky box should not be offset');
+
+test(() => {
+  const elements = setupStickyTest('left', 50, true);
+  elements.scroller.scrollLeft = 200;
+
+  // This math actually cancels to sticky.offsetLeft == (scroller.scrollLeft + 50),
+  // but for clarity the calculations are left explicit.
+  const nonStickyLeftY = elements.container.offsetLeft +
+      elements.filler.clientWidth;
+  const targetLeftY = elements.scroller.scrollLeft + 50;
+  const stickyOffset = targetLeftY - nonStickyLeftY;
+
+  assert_equals(elements.sticky.offsetLeft, nonStickyLeftY + stickyOffset);
+}, 'after reaching the sticking point the sticky box should be offset');
+
+test(() => {
+  const elements = setupStickyTest('left', 50, true);
+  elements.scroller.scrollLeft = 300;
+  const maxOffsetInContainer = elements.container.offsetLeft +
+      elements.container.clientWidth - elements.sticky.clientWidth;
+  assert_equals(elements.sticky.offsetLeft, maxOffsetInContainer);
+}, 'the sticky box should not be pushed outside its containing block');
 </script>
 
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="indicator box" style="left: 150px;"></div>
-    <div class="contents">
-      <!-- As these elements are inline, they are whitespace sensitive. -->
-      <div class="prepadding"></div><div class="container"><div class="innerpadding"></div><div class="sticky box"></div></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="indicator box" style="left: 175px;"></div>
-    <div class="contents">
-      <!-- As these elements are inline, they are whitespace sensitive. -->
-      <div class="prepadding"></div><div class="container"><div class="innerpadding"></div><div class="sticky box"></div></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="indicator box" style="left: 200px;"></div>
-    <div class="contents">
-      <!-- As these elements are inline, they are whitespace sensitive. -->
-      <div class="prepadding"></div><div class="container"><div class="innerpadding"></div><div class="sticky box"></div></div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-rendering-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-rendering-ref.html
new file mode 100644
index 0000000..a052eae
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-rendering-ref.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<title>Reference for position:sticky elements should be rendered at their sticky offset</title>
+
+<style>
+.group {
+  display: inline-block;
+  position: relative;
+  width: 150px;
+  height: 250px;
+}
+
+.inlineGroup {
+  display: inline-block;
+  position: relative;
+  width: 250px;
+  height: 150px;
+}
+
+.scroller {
+  position: relative;
+  width: 100px;
+  height: 200px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.inlineGroup .scroller {
+  position: relative;
+  width: 200px;
+  height: 100px;
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.contents {
+  height: 500px;
+}
+
+.inlineGroup .contents {
+  height: 100%;
+  width: 500px;
+}
+
+.indicator {
+  background-color: green;
+  position: absolute;
+}
+
+.box {
+  width: 100%;
+  height: 100px;
+}
+
+.inlineGroup .box {
+  height: 100%;
+  width: 100px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollTop = 125;
+  document.getElementById('scroller2').scrollTop = 50;
+  document.getElementById('scroller3').scrollLeft = 125;
+  document.getElementById('scroller4').scrollLeft = 75;
+});
+</script>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="contents">
+      <div class="indicator box" style="top: 175px;"></div>
+    </div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="contents">
+      <div class="indicator box" style="top: 125px;"></div>
+    </div>
+  </div>
+</div>
+
+<!-- Force break to make sure we are within 800px wide. -->
+<div></div>
+
+<div class="inlineGroup">
+  <div id="scroller3" class="scroller">
+    <div class="contents">
+      <div class="indicator box" style="left: 175px;"></div>
+    </div>
+  </div>
+</div>
+
+<div class="inlineGroup">
+  <div id="scroller4" class="scroller">
+    <div class="contents">
+      <div class="indicator box" style="left: 150px;"></div>
+    </div>
+  </div>
+</div>
+
+<div>You should see four green squares above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-rendering.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-rendering.html
new file mode 100644
index 0000000..39afca1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-rendering.html
@@ -0,0 +1,156 @@
+<!DOCTYPE html>
+<title>position:sticky elements should be rendered at their sticky offset</title>
+<link rel="match" href="position-sticky-rendering-ref.html" />
+<link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
+<meta name="assert" content="This test checks that position:sticky elements are rendered correctly" />
+
+<style>
+.group {
+  display: inline-block;
+  position: relative;
+  width: 150px;
+  height: 250px;
+}
+
+.inlineGroup {
+  display: inline-block;
+  position: relative;
+  width: 250px;
+  height: 150px;
+}
+
+.scroller {
+  position: relative;
+  width: 100px;
+  height: 200px;
+  overflow-x: hidden;
+  overflow-y: auto;
+}
+
+.inlineGroup .scroller {
+  position: relative;
+  width: 200px;
+  height: 100px;
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.contents {
+  height: 500px;
+}
+
+.inlineGroup .contents {
+  height: 100%;
+  width: 500px;
+}
+
+.prepadding {
+  height: 100px;
+}
+
+.inlineGroup .prepadding {
+  display: inline-block;
+  height: 100%;
+  width: 100px;
+}
+
+.container {
+  height: 200px;
+}
+
+.inlineGroup .container {
+  display: inline-block;
+  height: 100%;
+  width: 200px;
+}
+
+.filler {
+  height: 100px;
+}
+
+.inlineGroup .filler {
+  display: inline-block;
+  height: 100%;
+  width: 100px;
+}
+
+.indicator {
+  background-color: red;
+  position: absolute;
+}
+
+.sticky {
+  background-color: green;
+  position: sticky;
+}
+
+.box {
+  width: 100%;
+  height: 100px;
+}
+
+.inlineGroup .box {
+  display: inline-block;
+  height: 100%;
+  width: 100px;
+}
+</style>
+
+<script>
+window.addEventListener('load', function() {
+  document.getElementById('scroller1').scrollTop = 125;
+  document.getElementById('scroller2').scrollTop = 50;
+  document.getElementById('scroller3').scrollLeft = 125;
+  document.getElementById('scroller4').scrollLeft = 75;
+});
+</script>
+
+<div class="group">
+  <div id="scroller1" class="scroller">
+    <div class="indicator box" style="top: 175px;"></div>
+    <div class="contents">
+      <div class="prepadding"></div>
+      <div class="container">
+        <div style="top: 50px;" class="sticky box"></div>
+      </div>
+    </div>
+  </div>
+</div>
+
+<div class="group">
+  <div id="scroller2" class="scroller">
+    <div class="indicator box" style="top: 125px;"></div>
+    <div class="contents">
+      <div class="prepadding"></div>
+      <div class="container">
+        <div class="filler"></div>
+        <div style="bottom: 25px;" class="sticky box"></div>
+      </div>
+    </div>
+  </div>
+</div>
+
+<!-- Force break to make sure we are within 800px wide. -->
+<div></div>
+
+<div class="inlineGroup">
+  <div id="scroller3" class="scroller">
+    <div class="indicator box" style="left: 175px;"></div>
+    <div class="contents">
+      <!-- As these elements are inline, they are whitespace sensitive. -->
+      <div class="prepadding"></div><div class="container"><div style="left: 50px;" class="sticky box"></div></div>
+    </div>
+  </div>
+</div>
+
+<div class="inlineGroup">
+  <div id="scroller4" class="scroller">
+    <div class="indicator box" style="left: 150px;"></div>
+    <div class="contents">
+      <!-- As these elements are inline, they are whitespace sensitive. -->
+      <div class="prepadding"></div><div class="container"><div class="filler"></div><div style="right: 25px;" class="sticky box"></div></div>
+    </div>
+  </div>
+</div>
+
+<div>You should see four green squares above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right-ref.html
deleted file mode 100644
index 14ed476..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right-ref.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<title>Reference for position:sticky elements should respect the right constraint</title>
-
-<style>
-.group {
-  position: relative;
-  width: 250px;
-  height: 150px;
-}
-
-.scroller {
-  position: relative;
-  width: 200px;
-  height: 100px;
-  overflow-x: auto;
-  overflow-y: hidden;
-}
-
-.contents {
-  height: 100%;
-  width: 500px;
-}
-
-.indicator {
-  background-color: green;
-  position: absolute;
-  top: 0;
-}
-
-.box {
-  height: 100%;
-  width: 100px;
-}
-</style>
-
-<script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollLeft = 100;
-  document.getElementById('scroller2').scrollLeft = 175;
-  document.getElementById('scroller3').scrollLeft = 250;
-});
-</script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="left: 200px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="left: 250px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="left: 300px;"></div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right.html
index 6c4e696..afa0f880 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-right.html
@@ -1,102 +1,41 @@
 <!DOCTYPE html>
 <title>position:sticky elements should respect the right constraint</title>
-<link rel="match" href="position-sticky-right-ref.html" />
 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
 <meta name="assert" content="This test checks that position:sticky elements obey their right anchor after scrolling" />
 
-<style>
-.group {
-  position: relative;
-  width: 250px;
-  height: 150px;
-}
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
 
-.scroller {
-  position: relative;
-  width: 200px;
-  height: 100px;
-  overflow-x: auto;
-  overflow-y: hidden;
-}
+<script src="resources/sticky-util.js"></script>
 
-.contents {
-  height: 100%;
-  width: 500px;
-}
-
-.prepadding {
-  display: inline-block;
-  height: 100%;
-  width: 200px;
-}
-
-.container {
-  display: inline-block;
-  height: 100%;
-  width: 200px;
-}
-
-.filler {
-  display: inline-block;
-  height: 100%;
-  width: 100px;
-}
-
-.indicator {
-  background-color: red;
-  position: absolute;
-  top: 0;
-}
-
-.sticky {
-  background-color: green;
-  position: sticky;
-  right: 25px;
-}
-
-.box {
-  display: inline-block;
-  height: 100%;
-  width: 100px;
-}
-</style>
+<body></body>
 
 <script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollLeft = 100;
-  document.getElementById('scroller2').scrollLeft = 175;
-  document.getElementById('scroller3').scrollLeft = 250;
-});
+test(() => {
+  const elements = setupStickyTest('right', 25, true);
+  elements.scroller.scrollLeft = 200;
+  const nonStickyLeftY = elements.container.offsetLeft +
+    elements.filler.clientWidth;
+  assert_equals(elements.sticky.offsetLeft, nonStickyLeftY);
+}, 'before reaching the sticking point the sticky box should not be offset');
+
+test(() => {
+  const elements = setupStickyTest('right', 25, true);
+  elements.scroller.scrollLeft = 75;
+
+  const nonStickyLeftY = elements.container.offsetLeft +
+      elements.filler.clientWidth;
+  const nonStickyBottomY = nonStickyLeftY + elements.sticky.clientWidth;
+  const targetBottomY = elements.scroller.clientWidth +
+      elements.scroller.scrollLeft - 25;
+  const stickyOffset = nonStickyBottomY - targetBottomY;
+
+  assert_equals(elements.sticky.offsetLeft, nonStickyLeftY - stickyOffset);
+}, 'after reaching the sticking point the sticky box should be offset');
+
+test(() => {
+  const elements = setupStickyTest('right', 25, true);
+  elements.scroller.scrollLeft = 15;
+  assert_equals(elements.sticky.offsetLeft, elements.container.offsetLeft);
+}, 'the sticky box should not be pushed outside its containing block');
 </script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="indicator box" style="left: 200px;"></div>
-    <div class="contents">
-      <!-- As these elements are inline, they are whitespace sensitive. -->
-      <div class="prepadding"></div><div class="container"><div class="filler"></div><div class="sticky box"></div></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="indicator box" style="left: 250px;"></div>
-    <div class="contents">
-      <!-- As these elements are inline, they are whitespace sensitive. -->
-      <div class="prepadding"></div><div class="container"><div class="filler"></div><div class="sticky box"></div></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="indicator box" style="left: 300px;"></div>
-    <div class="contents">
-      <!-- As these elements are inline, they are whitespace sensitive. -->
-      <div class="prepadding"></div><div class="container"><div class="filler"></div><div class="sticky box"></div></div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top-ref.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top-ref.html
deleted file mode 100644
index 3003b94..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top-ref.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<title>Reference for position:sticky elements should respect the top constraint</title>
-
-<style>
-.group {
-  display: inline-block;
-  position: relative;
-  width: 150px;
-  height: 250px;
-}
-
-.scroller {
-  position: relative;
-  width: 100px;
-  height: 200px;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
-
-.contents {
-  height: 500px;
-}
-
-.indicator {
-  background-color: green;
-  position: absolute;
-  left: 0;
-}
-
-.box {
-  width: 100%;
-  height: 100px;
-}
-</style>
-
-<script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollTop = 50;
-  document.getElementById('scroller2').scrollTop = 125;
-  document.getElementById('scroller3').scrollTop = 200;
-});
-</script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="top: 150px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="top: 175px;"></div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="contents">
-      <div class="indicator box" style="top: 200px;"></div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top.html b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top.html
index fc07313..e4889d1 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/position-sticky-top.html
@@ -1,104 +1,43 @@
 <!DOCTYPE html>
 <title>position:sticky elements should respect the top constraint</title>
-<link rel="match" href="position-sticky-top-ref.html" />
 <link rel="help" href="https://www.w3.org/TR/css-position-3/#sticky-pos" />
 <meta name="assert" content="This test checks that position:sticky elements obey their top anchor after scrolling" />
 
-<style>
-.group {
-  display: inline-block;
-  position: relative;
-  width: 150px;
-  height: 250px;
-}
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
 
-.scroller {
-  position: relative;
-  width: 100px;
-  height: 200px;
-  overflow-x: hidden;
-  overflow-y: auto;
-}
+<script src="resources/sticky-util.js"></script>
 
-.contents {
-  height: 500px;
-}
-
-.prepadding {
-  height: 100px;
-}
-
-.container {
-  height: 200px;
-}
-
-.innerpadding {
-  height: 50px;
-}
-
-.indicator {
-  background-color: red;
-  position: absolute;
-  left: 0;
-}
-
-.sticky {
-  background-color: green;
-  position: sticky;
-  top: 50px;
-}
-
-.box {
-  width: 100%;
-  height: 100px;
-}
-</style>
+<body></body>
 
 <script>
-window.addEventListener('load', function() {
-  document.getElementById('scroller1').scrollTop = 50;
-  document.getElementById('scroller2').scrollTop = 125;
-  document.getElementById('scroller3').scrollTop = 200;
-});
+test(() => {
+  const elements = setupStickyTest('top', 50);
+  elements.scroller.scrollTop = 100;
+  const nonStickyTopY = elements.container.offsetTop +
+      elements.filler.clientHeight;
+  assert_equals(elements.sticky.offsetTop, nonStickyTopY);
+}, 'before reaching the sticking point the sticky box should not be offset');
+
+test(() => {
+  const elements = setupStickyTest('top', 50);
+  elements.scroller.scrollTop = 200;
+
+  // This math cancels to sticky.offsetTop == (scroller.scrollTop + 50), but
+  // for clarity the calculations are left explicit.
+  const nonStickyTopY = elements.container.offsetTop +
+      elements.filler.clientHeight;
+  const targetTopY = elements.scroller.scrollTop + 50;
+  const stickyOffset = targetTopY - nonStickyTopY;
+
+  assert_equals(elements.sticky.offsetTop, nonStickyTopY + stickyOffset);
+}, 'after reaching the sticking point the sticky box should be offset');
+
+test(() => {
+  const elements = setupStickyTest('top', 50);
+  elements.scroller.scrollTop = 300;
+  const maxOffsetInContainer = elements.container.offsetTop +
+      elements.container.clientHeight - elements.sticky.clientHeight;
+  assert_equals(elements.sticky.offsetTop, maxOffsetInContainer);
+}, 'the sticky box should not be pushed outside its containing block');
 </script>
-
-<div class="group">
-  <div id="scroller1" class="scroller">
-    <div class="indicator box" style="top: 150px;"></div>
-    <div class="contents">
-      <div class="prepadding"></div>
-      <div class="container">
-        <div class="innerpadding"></div>
-        <div class="sticky box"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller2" class="scroller">
-    <div class="indicator box" style="top: 175px;"></div>
-    <div class="contents">
-      <div class="prepadding"></div>
-      <div class="container">
-        <div class="innerpadding"></div>
-        <div class="sticky box"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-<div class="group">
-  <div id="scroller3" class="scroller">
-    <div class="indicator box" style="top: 200px;"></div>
-    <div class="contents">
-      <div class="prepadding"></div>
-      <div class="container">
-        <div class="innerpadding"></div>
-        <div class="sticky box"></div>
-      </div>
-    </div>
-  </div>
-</div>
-
-<div>You should see three green boxes above. No red should be visible.</div>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/css-position/resources/sticky-util.js b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/resources/sticky-util.js
new file mode 100644
index 0000000..821fa9b5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/css/css-position/resources/sticky-util.js
@@ -0,0 +1,69 @@
+/**
+ * Builds a generic structure that looks like:
+ *
+ * <div class="scroller">  // 100x200 viewport
+ *   <div class="contents">  // 100x500
+ *     <div class="prepadding"></div> // 100x100
+ *     <div class="container">  // 300x300 containing block
+ *       <div class="filler"></div>  // 100x100
+ *       <div class="sticky box"></div>  // 100x100
+ *     </div>
+ *   </div>
+ * </div>
+ *
+ * If 'inline' is true, the necessary blocks will be marked as inline-block,
+ * and the dimensions above are flipped.
+ *
+ * Returns an 'elements' object which has each of the above elements as an
+ * accessible property.
+ */
+function setupStickyTest(stickyDirection, stickyOffset, inline = false) {
+  const elements = {};
+
+  elements.scroller = document.createElement('div');
+  elements.scroller.style.position = 'relative';
+  elements.scroller.style.width = (inline ? '200px' : '100px');
+  elements.scroller.style.height = (inline ? '100px' : '200px');
+  elements.scroller.style.overflow = 'scroll';
+
+  elements.contents = document.createElement('div');
+  elements.contents.style.height = (inline ? '100%' : '500px');
+  elements.contents.style.width = (inline ? '500px' : '100%');
+
+  elements.prepadding = document.createElement('div');
+  elements.prepadding.style.height = (inline ? '100%' : '100px');
+  elements.prepadding.style.width = (inline ? '100px' : '100%');
+  if (inline)
+    elements.prepadding.style.display = 'inline-block';
+
+  elements.container = document.createElement('div');
+  elements.container.style.height = (inline ? '100%' : '300px');
+  elements.container.style.width = (inline ? '300px' : '100%');
+  if (inline)
+    elements.container.style.display = 'inline-block';
+
+  elements.filler = document.createElement('div');
+  elements.filler.style.height = (inline ? '100%' : '100px');
+  elements.filler.style.width = (inline ? '100px' : '100%');
+  if (inline)
+    elements.filler.style.display = 'inline-block';
+
+  elements.sticky = document.createElement('div');
+  elements.sticky.style = `${stickyDirection}: ${stickyOffset}px;`;
+  elements.sticky.style.position = 'sticky';
+  elements.sticky.style.height = (inline ? '100%' : '100px');
+  elements.sticky.style.width = (inline ? '100px' : '100%');
+  elements.sticky.style.backgroundColor = 'green';
+  if (inline)
+    elements.sticky.style.display = 'inline-block';
+
+  elements.scroller.appendChild(elements.contents);
+  elements.contents.appendChild(elements.prepadding);
+  elements.contents.appendChild(elements.container);
+  elements.container.appendChild(elements.filler);
+  elements.container.appendChild(elements.sticky);
+
+  document.body.appendChild(elements.scroller);
+
+  return elements;
+}
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added-ref.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added-ref.html
new file mode 100644
index 0000000..bd43c46
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<script src="/common/reftest-wait.js"></script>
+<title>Text track cue layout after controls are added (reference)</title>
+<style>
+::cue {
+  font-size: 50px;
+}
+
+/* Video width should be large enough to display all of the media controls. */
+video {
+  border: 1px solid gray;
+  width: 500px;
+}
+</style>
+<video controls onloadeddata="this.onloadeddata = null; takeScreenshot();">
+  <source src="/media/white.webm" type="video/webm">
+  <source src="/media/white.mp4" type="video/mp4">
+</video>
+<script>
+// Add a single cue at line -2, where it would be if there were controls visible
+// at the bottom. (This assumes that those controls are less than 50px high.)
+// cue at line -1.
+var video = document.querySelector("video");
+var track = video.addTextTrack("captions");
+var cue = new VTTCue(0, 1, "text");
+cue.line = -2;
+track.addCue(cue);
+track.mode = "showing";
+</script>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html
new file mode 100644
index 0000000..23c27e4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-added.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<script src="/common/reftest-wait.js"></script>
+<link rel="match" href="track-cue-rendering-after-controls-added-ref.html">
+<title>Text track cue layout after controls are added</title>
+<style>
+::cue {
+  font-size: 50px;
+}
+</style>
+<!-- Width should be large enough to display all of the media controls. -->
+<video style="border:1px solid gray; width: 500px;">
+  <source src="/media/white.webm" type="video/webm">
+  <source src="/media/white.mp4" type="video/mp4">
+</video>
+<script>
+// Add a cue that will overlap with the video controls.
+var video = document.querySelector("video");
+var track = video.addTextTrack("captions");
+track.addCue(new VTTCue(0, 1, "text"));
+track.mode = "showing";
+
+video.onloadeddata = function() {
+  // Double nesting of requestAnimationFrame to
+  // make sure cue layout and paint happens.
+  window.requestAnimationFrame(function() {
+    window.requestAnimationFrame(function() {
+      video.controls = true;
+      // Wait for the relayout before screenshot.
+      window.requestAnimationFrame(function() {
+        takeScreenshot();
+      });
+    });
+  });
+};
+</script>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-removed-expected.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed-ref.html
similarity index 63%
rename from third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-removed-expected.html
rename to third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed-ref.html
index 5979937..96afaef3 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-removed-expected.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed-ref.html
@@ -1,13 +1,19 @@
 <!DOCTYPE html>
+<html class="reftest-wait">
+<script src="/common/reftest-wait.js"></script>
 <title>Text track cue layout after controls are removed (reference)</title>
 <style>
 ::cue {
   font-size: 50px;
 }
+
+video {
+  border: 1px solid gray;
+}
 </style>
-<video style="border:1px solid gray">
-  <source src="../content/white.webm" type="video/webm">
-  <source src="../content/white.mp4" type="video/mp4">
+<video onloadeddata="this.onloadeddata = null; takeScreenshot();">
+  <source src="/media/white.webm" type="video/webm">
+  <source src="/media/white.mp4" type="video/mp4">
 </video>
 <script>
 // Add a single cue at line -2, where it would be if there were controls visible
@@ -20,3 +26,4 @@
 track.addCue(cue);
 track.mode = "showing";
 </script>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html
new file mode 100644
index 0000000..76019c9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-after-controls-removed.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<script src="/common/reftest-wait.js"></script>
+<link rel="match" href="track-cue-rendering-after-controls-removed-ref.html">
+<title>Text track cue layout after controls are removed</title>
+<style>
+::cue {
+  font-size: 50px;
+}
+</style>
+<video controls style="border:1px solid gray">
+  <source src="/media/white.webm" type="video/webm">
+  <source src="/media/white.mp4" type="video/mp4">
+</video>
+<script>
+// Add a cue that will overlap with the video controls.
+var video = document.querySelector("video");
+var track = video.addTextTrack("captions");
+track.addCue(new VTTCue(0, 1, "text"));
+track.mode = "showing";
+
+video.onloadeddata = function() {
+  // Double nesting of requestAnimationFrame to
+  // make sure cue layout and paint happens.
+  window.requestAnimationFrame(function() {
+    window.requestAnimationFrame(function() {
+      // Remove the controls. The cue should not move.
+      video.controls = false;
+      takeScreenshot();
+    });
+  });
+};
+</script>
+</html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range-expected.txt
index 97ce3d1..423f1cc 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range-expected.txt
@@ -21,5 +21,8 @@
 PASS Performing stepDown()
 PASS Performing stepUp() beyond the value of the max attribute
 PASS Performing stepDown() beyond the value of the min attribute
+FAIL Skip ASCII whitespace within input assert_equals: expected "123" but got "50"
+PASS Multiply value by ten raised to the exponentth power with `e`
+PASS Multiply value by ten raised to the exponentth power with `E`
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range.html b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range.html
index 6ae5b8aeb..209ce253 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-input-element/range.html
@@ -34,6 +34,9 @@
       <input type="range" id="stepdown_beyond_min" min=3 max=11 value=6 step=3 />
       <input type="range" id="illegal_min_and_max" min="ab" max="f" />
       <input type="range" id="illegal_value_and_step" min=0 max=5 value="ppp" step="xyz" />
+      <input type="range" id="should_skip_whitespace" value=" 123"/>
+      <input type="range" id="exponent_value1" value=""/>
+      <input type="range" id="exponent_value2" value=""/>
     </div>
 
     <div id="log">
@@ -280,6 +283,35 @@
         }
       );
 
+      test(
+        function() {
+          var e = document.getElementById('should_skip_whitespace');
+          assert_equals(e.value, "123")
+        }, "Skip ASCII whitespace within input", {
+          "help" : "https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number"
+        }
+      );
+
+      test(
+        function() {
+          var e = document.getElementById('exponent_value1');
+          e.value = 1e2;
+          assert_equals(e.value, "100")
+        }, "Multiply value by ten raised to the exponentth power with `e`", {
+          "help" : "https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number"
+        }
+      );
+
+      test(
+        function() {
+          var e = document.getElementById('exponent_value2');
+          e.value = 1E2;
+          assert_equals(e.value, "100")
+        }, "Multiply value by ten raised to the exponentth power with `E`", {
+          "help" : "https://html.spec.whatwg.org/multipage/#best-representation-of-the-number-as-a-floating-point-number"
+        }
+      );
+
     </script>
 
   </body>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/performance-timeline/idlharness.html b/third_party/WebKit/LayoutTests/external/wpt/performance-timeline/idlharness.html
index 8185386..8cef4fb3 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/performance-timeline/idlharness.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/performance-timeline/idlharness.html
@@ -67,6 +67,7 @@
 interface PerformanceObserver {
     void observe(PerformanceObserverInit options);
     void disconnect();
+    PerformanceEntryList takeRecords();
 };
 </pre>
 
diff --git a/third_party/WebKit/LayoutTests/fast/backgrounds/background-clip-text-with-blend-mode-expected.html b/third_party/WebKit/LayoutTests/fast/backgrounds/background-clip-text-with-blend-mode-expected.html
new file mode 100644
index 0000000..78460362
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/backgrounds/background-clip-text-with-blend-mode-expected.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<script src="../../resources/ahem.js"></script>
+<div style="font: 100px/1 Ahem; color: lime">X</div>
diff --git a/third_party/WebKit/LayoutTests/fast/backgrounds/background-clip-text-with-blend-mode.html b/third_party/WebKit/LayoutTests/fast/backgrounds/background-clip-text-with-blend-mode.html
new file mode 100644
index 0000000..b858f3e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/backgrounds/background-clip-text-with-blend-mode.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<title>A 'background-clip: text' background layer should blend with the underlying layer</title>
+<script src="../../resources/ahem.js"></script>
+<style>
+#target {
+  font: 100px/1 Ahem;
+  background-image: linear-gradient(#f00, #f00), linear-gradient(#ff0, #ff0);
+  background-color: red;
+  background-blend-mode: difference, normal;
+  -webkit-background-clip: text;
+  background-clip: text;
+  color: transparent;
+}
+</style>
+<div id="target">X</div>
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-ime.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-ime.html
index 79e4f75..2bc95b42 100644
--- a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-ime.html
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-ime.html
@@ -75,6 +75,7 @@
     resetEventLog();
     textInputController.setComposition('');
     assert_array_equals(eventLog, [
+      'beforeinput: isComposing=false, data="null"',
       'input: isComposing=false, data="null", inputType=deleteContentBackward',
     ]);
   }, 'setComposition with no composition open, empty text replacing selection');
@@ -344,7 +345,9 @@
 
     textInputController.deleteSurroundingText(1, 1);
     assert_array_equals(eventLog, [
+      'beforeinput: isComposing=false, data="null"',
       'input: isComposing=false, data="null", inputType=deleteContentBackward',
+      'beforeinput: isComposing=false, data="null"',
       'input: isComposing=false, data="null", inputType=deleteContentBackward',
     ]);
   }, 'deleteSurroundingText, no composition open');
@@ -363,7 +366,9 @@
 
     textInputController.deleteSurroundingText(1, 1);
     assert_array_equals(eventLog, [
+      'beforeinput: isComposing=false, data="null"',
       'input: isComposing=false, data="null", inputType=deleteContentBackward',
+      'beforeinput: isComposing=false, data="null"',
       'input: isComposing=false, data="null", inputType=deleteContentBackward',
     ]);
   }, 'deleteSurroundingText, composition open');
diff --git a/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-stay-in-overflow-div-expected.txt b/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-stay-in-overflow-div-expected.txt
new file mode 100644
index 0000000..dc75391
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-stay-in-overflow-div-expected.txt
@@ -0,0 +1,13 @@
+a
+b
+c
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS gFocusedDocument.activeElement.getAttribute("id") is "a"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "b"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "c"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "b"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "b"
+PASS gFocusedDocument.activeElement.getAttribute("id") is "a"
+
diff --git a/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-stay-in-overflow-div.html b/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-stay-in-overflow-div.html
new file mode 100644
index 0000000..17b0e5e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-stay-in-overflow-div.html
@@ -0,0 +1,51 @@
+<script src="../../resources/js-test.js"></script>
+<script src="resources/spatial-navigation-utils.js"></script>
+<script>
+var resultMap = [
+  ["Down", "a"], // Scrolled so no focus change.
+  ["Down", "b"],
+  ["Down", "c"],
+  ["Up", "b"],
+  ["Up", "b"],   // Scrolled so no focus change.
+  ["Up", "a"],
+  ["DONE", "DONE"]
+];
+
+if (window.testRunner) {
+  testRunner.dumpAsText();
+  testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
+  testRunner.overridePreference("WebKitSpatialNavigationEnabled", 1);
+  testRunner.waitUntilDone();
+}
+
+function runTest()
+{
+  // Start at a known place.
+  document.getElementById("a").focus();
+  initTest(resultMap, testCompleted);
+}
+
+function testCompleted()
+{
+  if (window.testRunner)
+    testRunner.notifyDone();
+}
+
+window.onload = runTest;
+</script>
+
+<style>
+  div.scroll {
+    /* The div displays one line of text at once. */
+    line-height: 1.5em;
+    height: 1.5em;
+    overflow-y: scroll;
+  }
+</style>
+
+<div class="scroll">
+  <a href="#" id="a">a</a><br>
+  <a href="#" id="b">b</a>
+</div>
+<a href="#" id="c">c</a>
+<div id="console"></div>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-basics.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-basics.html
index 9c9e84cf..7e6b02c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-basics.html
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-basics.html
@@ -8,65 +8,6 @@
 <script src="resources/credential-helpers.js"></script>
 <script>
 
-// Common mock values for the mockAuthenticator.
-var challenge = new TextEncoder().encode("climb a mountain");
-
-var public_key_rp = {
-    id: "1098237235409872",
-    name: "Acme"
-};
-
-var public_key_user = {
-    id: new TextEncoder().encode("1098237235409872"),
-    name: "avery.a.jones@example.com",
-    displayName: "Avery A. Jones",
-    icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
-};
-
-var public_key_parameters =  [{
-    type: "public-key",
-    alg: -7,
-},];
-
-var publicKey = {
-    challenge,
-    rp: public_key_rp,
-    user: public_key_user,
-    pubKeyCredParams: public_key_parameters,
-    excludeCredentials: [],
-};
-
-var raw_id = new TextEncoder("utf-8").encode("rawId");
-var id = btoa("rawId");
-var client_data_json = new TextEncoder("utf-8").encode("clientDataJSON");
-var attestation_object = new TextEncoder("utf-8").encode("attestationObject");
-
-promise_test(_ => {
-    mockAuthenticator.setRawId(raw_id);
-    mockAuthenticator.setId(id);
-    mockAuthenticator.setClientDataJson(client_data_json);
-    mockAuthenticator.setAttestationObject(attestation_object);
-
-    mockAuthenticator.setAuthenticatorStatus(
-        webauth.mojom.AuthenticatorStatus.SUCCESS);
-
-    return navigator.credentials.create({publicKey}).then(r => {
-        assert_equals(r.id, id, "id");
-        assert_true(r.rawId instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.rawId),
-            raw_id, "rawId returned is the same");
-        assert_true(r.response instanceof AuthenticatorAttestationResponse);
-        assert_true(r.response.clientDataJSON instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.response.clientDataJSON),
-            client_data_json, "clientDataJSON returned is the same");
-        assert_true(r.response.attestationObject instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.response.attestationObject),
-            attestation_object, "attestationObject returned is the same");
-        assert_not_exists(r.response, 'authenticatorData');
-        assert_not_exists(r.response, 'signature');
-    });
-}, "Verify that the mock returns the values we give it.");
-
 promise_test(t => {
     return promise_rejects(t, "NotSupportedError",
         navigator.credentials.create());
@@ -74,210 +15,142 @@
 
 promise_test(t => {
     mockAuthenticator.setAuthenticatorStatus(
-      webauth.mojom.AuthenticatorStatus.PENDING_REQUEST);
-    return promise_rejects(t, "InvalidStateError",
-        navigator.credentials.create({ publicKey }));
-}, "Verify that pending request error returned by mock is properly handled.");
-
-promise_test(function (t) {
-    mockAuthenticator.setAuthenticatorStatus(
-        webauth.mojom.AuthenticatorStatus.UNKNOWN_ERROR);
-    return promise_rejects(t, "NotReadableError",
-        navigator.credentials.create({ publicKey }));
-}, "Verify that unknown error returned by mock is properly handled.");
+        webauth.mojom.AuthenticatorStatus.INVALID_DOMAIN);
+    return promise_rejects(t, "SecurityError",
+        navigator.credentials.create({publicKey : MAKE_CREDENTIAL_OPTIONS}));
+}, "Verify that invalid domain error returned by mock is properly handled.");
 
 promise_test(t => {
     mockAuthenticator.setAuthenticatorStatus(
-        webauth.mojom.AuthenticatorStatus.NOT_ALLOWED_ERROR);
-    return promise_rejects(t, "NotAllowedError",
-        navigator.credentials.create({ publicKey }));
-}, "Verify that not allowed error returned by mock is properly handled.");
+        webauth.mojom.AuthenticatorStatus.INSECURE_ORIGIN);
+    return promise_rejects(t, "SecurityError",
+        navigator.credentials.create({publicKey : MAKE_CREDENTIAL_OPTIONS}));
+}, "Verify that insecure origin error returned by mock is properly handled.");
 
 promise_test(t => {
-    mockAuthenticator.setAuthenticatorStatus(
-        webauth.mojom.AuthenticatorStatus.NOT_SUPPORTED_ERROR);
-    return promise_rejects(t, "NotSupportedError",
-        navigator.credentials.create({ publicKey }));
-}, "Verify that not supported error returned by mock is properly handled.");
-
-promise_test(t => {
-    var publicKey = {
+    var customMakeCredOptions = {
         // No challenge.
-        rp: public_key_rp,
-        user: public_key_user,
-        pubKeyCredParams: public_key_parameters,
+        rp: PUBLIC_KEY_RP,
+        user: PUBLIC_KEY_USER,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey}));
+            navigator.credentials.create({publicKey : customMakeCredOptions}));
 }, "navigator.credentials.create() with missing challenge");
 
 promise_test(t => {
-    var publicKey = {
-        challenge,
-        rp: public_key_rp,
-        user: public_key_user,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
+        rp: PUBLIC_KEY_RP,
+        user: PUBLIC_KEY_USER,
         // No parameters.
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey}));
+            navigator.credentials.create({publicKey : customMakeCredOptions}));
 }, "navigator.credentials.create() with missing parameters");
 
 promise_test(t => {
-    var custom_public_key = {
-        challenge,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
         // No rp.
-        user: public_key_user,
-        pubKeyCredParams: public_key_parameters,
+        user: PUBLIC_KEY_USER,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey: custom_public_key}));
+            navigator.credentials.create({publicKey: customMakeCredOptions}));
 }, "navigator.credentials.create() with missing rp");
 
 promise_test(t => {
-    var custom_public_key = {
-        challenge,
-        rp: public_key_rp,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
+        rp: PUBLIC_KEY_RP,
         // No user.
-        pubKeyCredParams: public_key_parameters,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey: custom_public_key}));
+            navigator.credentials.create({publicKey: customMakeCredOptions}));
 }, "navigator.credentials.create() with missing user");
 
-promise_test(_ => {
-    mockAuthenticator.reset();
-    mockAuthenticator.setRawId(raw_id);
-    mockAuthenticator.setId(id);
-    mockAuthenticator.setClientDataJson(client_data_json);
-    mockAuthenticator.setAttestationObject(attestation_object);
-    mockAuthenticator.setAuthenticatorStatus(
-          webauth.mojom.AuthenticatorStatus.SUCCESS);
-
-    var custom_public_key = {
-        challenge,
-        rp: { name: "Acme" },
-        user: public_key_user,
-        pubKeyCredParams: public_key_parameters,
-    };
-
-    return navigator.credentials.create({publicKey: custom_public_key}).then(r => {
-        assert_equals(r.id, id, 'id');
-        assert_true(r.rawId instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.rawId),
-            raw_id, "rawId returned is the same");
-        assert_true(r.response instanceof AuthenticatorAttestationResponse);
-        assert_true(r.response.clientDataJSON instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.response.clientDataJSON),
-            client_data_json, "clientDataJSON returned is the same");
-        assert_true(r.response.attestationObject instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.response.attestationObject),
-            attestation_object, "attestationObject returned is the same");
-        assert_not_exists(r.response, 'authenticatorData');
-        assert_not_exists(r.response, 'signature');
-    });
-}, "navigator.credentials.create() with missing rp.id");
-
-
 promise_test(t => {
-    var custom_public_key = {
-        challenge,
-        rp: { id: "1098237235409872" },
-        user: public_key_user,
-        pubKeyCredParams: public_key_parameters,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
+        rp: { id: "google.com" },
+        user: PUBLIC_KEY_USER,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey: custom_public_key}));
+            navigator.credentials.create({publicKey: customMakeCredOptions}));
 }, "navigator.credentials.create() with missing rp.name");
 
 promise_test(t => {
-    var custom_public_key = {
-        challenge,
-        rp: public_key_rp,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
+        rp: PUBLIC_KEY_RP,
         user: {
             name: "avery.a.jones@example.com",
             displayName: "Avery A. Jones",
             icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
         },
-        pubKeyCredParams: public_key_parameters,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey: custom_public_key}));
+            navigator.credentials.create({publicKey: customMakeCredOptions}));
 }, "navigator.credentials.create() with missing user.id");
 
 promise_test(t => {
-    var custom_public_key = {
-        challenge,
-        rp: public_key_rp,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
+        rp: PUBLIC_KEY_RP,
         user: {
             id: new TextEncoder().encode("1098237235409872"),
             displayName: "Avery A. Jones",
             icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
         },
-        pubKeyCredParams: public_key_parameters,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
         timeout: 60000,  // 1 minute
         excludeCredentials: [], // No already-registered credentials.
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey: custom_public_key}));
+            navigator.credentials.create({publicKey: customMakeCredOptions}));
 }, "navigator.credentials.create() with missing user.name");
 
 promise_test(t => {
-    var custom_public_key = {
-        challenge,
-        rp: public_key_rp,
+    var customMakeCredOptions = {
+        challenge: CHALLENGE,
+        rp: PUBLIC_KEY_RP,
         user: {
             id: new TextEncoder().encode("1098237235409872"),
             name: "avery.a.jones@example.com",
             icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
         },
-        pubKeyCredParams: public_key_parameters,
+        pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
     };
 
     return promise_rejects(t, new TypeError(),
-            navigator.credentials.create({publicKey: custom_public_key}));
+            navigator.credentials.create({publicKey: customMakeCredOptions}));
 }, "navigator.credentials.create() with missing user.displayName");
 
-promise_test(_ => {
-    mockAuthenticator.reset();
-    mockAuthenticator.setRawId(raw_id);
-    mockAuthenticator.setId(id);
-    mockAuthenticator.setClientDataJson(client_data_json);
-    mockAuthenticator.setAttestationObject(attestation_object);
-    mockAuthenticator.setAuthenticatorStatus(
-          webauth.mojom.AuthenticatorStatus.SUCCESS);
+promise_test(function (t) {
+    return promise_rejects(t, "NotSupportedError",
+        navigator.credentials.create());
+}, "navigator.credentials.get() with no argument.");
 
-    var custom_public_key = {
-        challenge,
-        rp: public_key_rp,
-        user: {
-            id: new TextEncoder().encode("1098237235409872"),
-            name: "avery.a.jones@example.com",
-            displayName: "Avery A. Jones",
-        },
-        pubKeyCredParams: public_key_parameters,
+promise_test(function(t) {
+    var customGetAssertionOptions = {
+        // No challenge.
+        rpId: "google.com",
+        allowCredentials: [ACCEPTABLE_CREDENTIAL]
     };
 
-    return navigator.credentials.create({publicKey: custom_public_key}).then(r => {
-        assert_equals(r.id, id, 'id');
-        assert_true(r.rawId instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.rawId),
-            raw_id, "rawId returned is the same");
-        assert_true(r.response instanceof AuthenticatorAttestationResponse);
-        assert_true(r.response.clientDataJSON instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.response.clientDataJSON),
-            client_data_json, "clientDataJSON returned is the same");
-        assert_true(r.response.attestationObject instanceof ArrayBuffer);
-        assert_array_equals(new Uint8Array(r.response.attestationObject),
-            attestation_object, "attestationObject returned is the same");
-        assert_not_exists(r.response, 'authenticatorData');
-        assert_not_exists(r.response, 'signature');
-    });
-}, "navigator.credentials.create() with missing user.icon");
+    return promise_rejects(t, new TypeError(),
+            navigator.credentials.get({publicKey: customGetAssertionOptions}));
+}, "navigator.credentials.get() with missing challenge");
+
 </script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-from-nested-frame.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-from-nested-frame.html
new file mode 100644
index 0000000..5631ca9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-from-nested-frame.html
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<title>Credential Manager: Call create() across browsing contexts.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom.js"></script>
+<script src="resources/credential-helpers.js"></script>
+<body>
+<script>
+
+if (document.location.hostname == "127.0.0.1")
+document.location = "https://subdomain.example.test:8443/credentialmanager/credentialscontainer-create-from-nested-frame.html";
+
+function EncloseInScriptTag(code) {
+  return "<script>" + code + "</scr" + "ipt>";
+}
+
+promise_test(t => {
+  let PROBE_CREDENTIALS = "window.parent.postMessage(String(navigator.credentials), '*');";
+
+  let frame = document.createElement("iframe");
+  frame.src = "data:text/html," + EncloseInScriptTag(PROBE_CREDENTIALS);
+  window.setTimeout(_ => document.body.append(frame));
+
+  let eventWatcher = new EventWatcher(t, window, "message");
+  return eventWatcher.wait_for("message").then(message => {
+    assert_equals(message.data, "undefined");
+  });
+}, "navigator.credentials should be undefined in documents generated from `data:` URLs.");
+
+promise_test(t => {
+  let frame = document.createElement("iframe");
+  frame.src = "resources/nested-mock-authenticator-client.html";
+  window.setTimeout(_ => document.body.append(frame));
+
+  let loadWatcher = new EventWatcher(t, frame, "load");
+  loadWatcher.wait_for("load").then(_ =>
+      frame.contentWindow.location = "javascript:" + CREATE_CREDENTIALS);
+
+  let messageWatcher = new EventWatcher(t, window, "message");
+  return messageWatcher.wait_for("message").then(message => {
+    assert_equals(message.data, TEST_NESTED_CREDENTIAL_ID);
+  });
+}, "navigator.credentials.create({publicKey}) in a javascript url should should succeed.");
+
+// Load the content we want to inject into the nested frames below into 
+// |templateFrame| so that we don't have to use string literals here.
+var templateFrame = document.createElement("iframe");
+templateFrame.src = "resources/nested-mock-authenticator-client.html";
+templateFrame.addEventListener("load", _ => {
+
+  promise_test(t => {
+    let frame = document.createElement("iframe");
+    frame.srcdoc = templateFrame.contentDocument.documentElement.outerHTML;
+    window.setTimeout(_ => document.body.append(frame));
+
+    let loadWatcher = new EventWatcher(t, frame, "load");
+    loadWatcher.wait_for("load").then(_ => {
+      frame.contentWindow.eval(CREATE_CREDENTIALS);
+    });
+
+    let eventWatcher = new EventWatcher(t, window, "message");
+    return eventWatcher.wait_for("message").then(message => {
+      assert_equals(message.data, TEST_NESTED_CREDENTIAL_ID);
+    });
+  }, "navigator.credentials.create({publicKey}) in srcdoc should succeed.");
+
+  promise_test(t => {
+    let frame = document.createElement("iframe");
+    frame.src = "about:blank";
+    window.setTimeout(_ => document.body.append(frame));
+
+    let loadWatcher = new EventWatcher(t, frame, "load");
+    loadWatcher.wait_for("load").then(_ => {
+      frame.contentDocument.write(templateFrame.contentDocument.documentElement.outerHTML);
+      frame.contentDocument.write(EncloseInScriptTag(CREATE_CUSTOM_CREDENTIALS));
+    });
+
+    let eventWatcher = new EventWatcher(t, window, "message");
+    return eventWatcher.wait_for("message").then(message => {
+      assert_equals(message.data, TEST_NESTED_CREDENTIAL_ID);
+    });
+  }, "navigator.credentials.create({publicKey}) in about:blank embedded in a secure context should succeed.");
+
+  promise_test(t => {
+    let frame = document.createElement("iframe");
+    frame.src = "about:blank";
+    window.setTimeout(_ => document.body.append(frame));
+
+    let loadWatcher = new EventWatcher(t, frame, "load");
+    loadWatcher.wait_for("load").then(_ => {
+      frame.contentWindow.eval(CREATE_CUSTOM_CREDENTIALS);
+    });
+
+    let eventWatcher = new EventWatcher(t, window, "message");
+    return eventWatcher.wait_for("message").then(message => {
+      assert_equals(message.data, "NotSupportedError");
+    });
+  }, "navigator.credentials.create({publicKey}) in an about:blank page embedded in a secure context should pass rpID checks.");
+});
+document.body.append(templateFrame);
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-origins.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-origins.html
new file mode 100644
index 0000000..8a71a98
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/credentialscontainer-create-origins.html
@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<title>Credential Manager: create() with custom origins.</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom.js"></script>
+<script src="resources/credential-helpers.js"></script>
+<script>
+
+// For tests that don't require custom-set origins.
+if (document.location.hostname == "127.0.0.1")
+document.location = "https://subdomain.example.test:8443/credentialmanager/credentialscontainer-create-origins.html";
+
+promise_test(_ => {
+  mockAuthenticator.setRawId(RAW_ID);
+  mockAuthenticator.setId(ID);
+  mockAuthenticator.setClientDataJson(CLIENT_DATA_JSON);
+  mockAuthenticator.setAttestationObject(ATTESTATION_OBJECT);
+  mockAuthenticator.setAuthenticatorStatus(
+    webauth.mojom.AuthenticatorStatus.SUCCESS);
+
+    return navigator.credentials.create({publicKey : MAKE_CREDENTIAL_OPTIONS}).then(r => {
+        assertValidMakeCredentialResponse(r);
+    });
+}, "Verify that the mock returns the values we give it.");
+
+promise_test(t => {
+  mockAuthenticator.setAuthenticatorStatus(
+      webauth.mojom.AuthenticatorStatus.PENDING_REQUEST);
+  return promise_rejects(t, "InvalidStateError",
+    navigator.credentials.create({ publicKey : MAKE_CREDENTIAL_OPTIONS}));
+}, "Verify that pending request error returned by mock is properly handled.");
+
+promise_test(function (t) {
+  mockAuthenticator.setAuthenticatorStatus(
+      webauth.mojom.AuthenticatorStatus.UNKNOWN_ERROR);
+  return promise_rejects(t, "NotReadableError",
+      navigator.credentials.create({ publicKey : MAKE_CREDENTIAL_OPTIONS}));
+}, "Verify that unknown error returned by mock is properly handled.");
+
+promise_test(t => {
+  mockAuthenticator.setAuthenticatorStatus(
+      webauth.mojom.AuthenticatorStatus.NOT_ALLOWED_ERROR);
+  return promise_rejects(t, "NotAllowedError",
+      navigator.credentials.create({ publicKey : MAKE_CREDENTIAL_OPTIONS}));
+}, "Verify that not allowed error returned by mock is properly handled.");
+
+promise_test(t => {
+  mockAuthenticator.setAuthenticatorStatus(
+      webauth.mojom.AuthenticatorStatus.NOT_SUPPORTED_ERROR);
+  return promise_rejects(t, "NotSupportedError",
+      navigator.credentials.create({ publicKey : MAKE_CREDENTIAL_OPTIONS}));
+}, "Verify that not supported error returned by mock is properly handled.");
+
+promise_test(_ => {
+  mockAuthenticator.reset();
+  mockAuthenticator.setRawId(RAW_ID);
+  mockAuthenticator.setId(ID);
+  mockAuthenticator.setClientDataJson(CLIENT_DATA_JSON);
+  mockAuthenticator.setAttestationObject(ATTESTATION_OBJECT);
+  mockAuthenticator.setAuthenticatorStatus(
+      webauth.mojom.AuthenticatorStatus.SUCCESS);
+
+  var customPublicKey = {
+      challenge: CHALLENGE,
+      rp: { name: "Acme" },
+      user: PUBLIC_KEY_USER,
+      pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
+  };
+
+    return navigator.credentials.create({publicKey: customPublicKey}).then(r => {
+        assertValidMakeCredentialResponse(r);
+    });
+}, "navigator.credentials.create() with missing rp.id");
+
+// For tests that require custom-set origins.
+const VALID_ORIGIN_RPID_PAIRS = [
+    { 'origin': 'https://google.test:8443',
+      'rpId': 'google.test' },
+    { 'origin': 'https://google.test:8443',
+      'rpId': '' },
+    {'origin': 'https://subdomain.example.test:8443',
+      'rpId': 'example.test' },
+    {'origin': 'https://subdomain.example.test:8443',
+      'rpId': 'subdomain.example.test' },
+    {'origin': 'https://localhost:8443',
+      'rpId': 'localhost' },
+];
+
+for (let test of VALID_ORIGIN_RPID_PAIRS) {
+  promise_test(t => {
+    let eventWatcher = new EventWatcher(t, window, "message");
+
+    var w = window.open(test.origin
+        + "/credentialmanager/resources/publickey-create-helper.html?rpId="
+        + test.rpId);
+
+    return eventWatcher.wait_for("message").then(message => {
+        assert_equals(message.data, "SUCCESS");
+    });
+  }, "navigator.credentials.create({publicKey}) in '" +  test.origin
+      + "' with valid |rp.id| '" + test.rpId + "' should succeed.");
+}
+
+const INVALID_ORIGIN_RPID_PAIRS = [
+    { 'origin': 'https://google.test:8443',
+      'rpId': 'localhost' },
+    { 'origin': 'https://google.test:8443',
+      'rpId': 'foo.google.test' },
+    { 'origin': 'https://google.test:8443',
+      'rpId': null },
+    { 'origin': 'https://google.test:8443',
+      'rpId': String(0) }, 
+    { 'origin': 'https://google.test:8443',
+      'rpId': 'test' },
+];
+
+for (let test of INVALID_ORIGIN_RPID_PAIRS) {
+  promise_test(t => {
+    let eventWatcher = new EventWatcher(t, window, "message");
+
+    var w = window.open(test.origin
+        + "/credentialmanager/resources/publickey-create-helper.html?rpId="
+        + test.rpId);
+
+    return eventWatcher.wait_for("message").then(message => {
+        assert_equals(message.data, "SecurityError");
+    });
+  }, "navigator.credentials.create({publicKey}) in '" +  test.origin
+      + "' with invalid |rp.id| '" + test.rpId + "' should fail.");
+}
+
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/credential-helpers.js b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/credential-helpers.js
index 4670442..a427365 100644
--- a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/credential-helpers.js
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/credential-helpers.js
@@ -84,7 +84,8 @@
       let info = new webauth.mojom.CommonCredentialInfo(
           { id: this.id_,
             rawId: this.rawId_,
-            clientDataJson: this.clientDataJson_,});
+            clientDataJson: this.clientDataJson_,
+          });
       response = new webauth.mojom.MakeCredentialAuthenticatorResponse(
           { info: info,
             attestationObject: this.attestationObject_
@@ -95,6 +96,26 @@
     return {status, credential: response};
   }
 
+  async getAssertion(options) {
+    var response = null;
+    if (this.status_ == webauth.mojom.AuthenticatorStatus.SUCCESS) {
+      let info = new webauth.mojom.CommonCredentialInfo(
+          { id: this.id_,
+            rawId: this.rawId_,
+            clientDataJson: this.clientDataJson_,
+          });
+      response = new webauth.mojom.GetAssertionAuthenticatorResponse(
+          { info: info,
+            authenticatorData: this.authenticatorData_,
+            signature: this.signature_,
+            userHandle: this.userHandle_,
+          });
+    }
+    let status = this.status_;
+    this.reset();
+    return {status, credential: response};
+  }
+
   // Resets state of mock Authenticator.
   reset() {
     this.status_ = webauth.mojom.AuthenticatorStatus.UNKNOWN_ERROR;
@@ -104,7 +125,7 @@
     this.attestationObject_ = new Uint8Array(0);
     this.authenticatorData_ = new Uint8Array(0);
     this.signature_ = new Uint8Array(0);
-    this.userHandle = new Uint8Array(0);
+    this.userHandle_ = new Uint8Array(0);
   }
 
   setAuthenticatorStatus(status) {
@@ -136,9 +157,115 @@
   }
 
   setUserHandle(userHandle) {
-    this.userHandle = userHandle;
+    this.userHandle_ = userHandle;
   }
 }
 
 var mockAuthenticator = new MockAuthenticator();
 var mockCredentialManager = new MockCredentialManager();
+
+// Common mock values for the mockAuthenticator.
+var CHALLENGE = new TextEncoder().encode("climb a mountain");
+
+var PUBLIC_KEY_RP = {
+    id: "subdomain.example.test",
+    name: "Acme"
+};
+
+var PUBLIC_KEY_USER = {
+    id: new TextEncoder().encode("1098237235409872"),
+    name: "avery.a.jones@example.com",
+    displayName: "Avery A. Jones",
+    icon: "https://pics.acme.com/00/p/aBjjjpqPb.png"
+};
+
+var PUBLIC_KEY_PARAMETERS =  [{
+    type: "public-key",
+    alg: -7,
+},];
+
+var MAKE_CREDENTIAL_OPTIONS = {
+    challenge: CHALLENGE,
+    rp: PUBLIC_KEY_RP,
+    user: PUBLIC_KEY_USER,
+    pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
+    excludeCredentials: [],
+};
+
+var ACCEPTABLE_CREDENTIAL = {
+    type: "public-key",
+    id: new TextEncoder().encode("acceptableCredential"),
+    transports: ["usb", "nfc", "ble"]
+};
+
+var GET_ASSERTION_OPTIONS = {
+    challenge: CHALLENGE,
+    rpId: "subdomain.example.test",
+    allowCredentials: [ACCEPTABLE_CREDENTIAL]
+};
+
+var RAW_ID = new TextEncoder("utf-8").encode("rawId");
+var ID = btoa("rawId");
+var CLIENT_DATA_JSON = new TextEncoder("utf-8").encode("clientDataJSON");
+var ATTESTATION_OBJECT = new TextEncoder("utf-8").encode("attestationObject");
+var AUTHENTICATOR_DATA = new TextEncoder("utf-8").encode("authenticatorData");
+var SIGNATURE = new TextEncoder("utf-8").encode("signature");
+
+var TEST_NESTED_CREDENTIAL_ID = "nestedCredentialId";
+
+// Use an invalid algorithm in the parameters for "success" cases
+// so each test will exercise the rpID checks in  both the renderer
+// and browser but return prior to reaching the device layer.
+var CUSTOM_PUBLIC_KEY = 'var customPublicKey = '
+    + '{challenge : new TextEncoder().encode("challenge"), '
+    + 'rp: {id: "subdomain.example.test", name: "Acme"}, '
+    + 'user: {id: new TextEncoder().encode("1098237235409872"), '
+    + 'name: "acme@example.com", displayName: "Acme", icon:"iconUrl"}, '
+    + 'pubKeyCredParams: [{type: "public-key", alg: 0,},], excludeCredentials:[],};';
+
+var CREATE_CUSTOM_CREDENTIALS = CUSTOM_PUBLIC_KEY
+    + "navigator.credentials.create({publicKey : customPublicKey})"
+    + ".then(c => window.parent.postMessage(c.id, '*'))"
+    + ".catch(e => window.parent.postMessage(e.name, '*'));";
+
+var CREATE_CREDENTIALS = "navigator.credentials.create({publicKey : MAKE_CREDENTIAL_OPTIONS})"
+    + ".then(c => window.parent.postMessage(c.id, '*'));";
+
+// Verifies if |r| is the valid response to credentials.create(publicKey).
+function assertValidMakeCredentialResponse(r) {
+assert_equals(r.id, ID, 'id');
+    assert_true(r.rawId instanceof ArrayBuffer);
+    assert_array_equals(new Uint8Array(r.rawId),
+        RAW_ID, "rawId returned is the same");
+    assert_true(r.response instanceof AuthenticatorAttestationResponse);
+    assert_true(r.response.clientDataJSON instanceof ArrayBuffer);
+    assert_array_equals(new Uint8Array(r.response.clientDataJSON),
+        CLIENT_DATA_JSON, "clientDataJSON returned is the same");
+    assert_true(r.response.attestationObject instanceof ArrayBuffer);
+    assert_array_equals(new Uint8Array(r.response.attestationObject),
+        ATTESTATION_OBJECT, "attestationObject returned is the same");
+    assert_not_exists(r.response, 'authenticatorData');
+    assert_not_exists(r.response, 'signature');
+}
+
+// Verifies if |r| is the valid response to credentials.get(publicKey).
+function assertValidGetAssertionResponse(r) {
+    assert_equals(r.id, ID, 'id');
+    assert_true(r.rawId instanceof ArrayBuffer);
+    assert_array_equals(new Uint8Array(r.rawId),
+        RAW_ID, "rawId returned is the same");
+
+    // The call returned an AssertionResponse, meaning it has
+    //  authenticatorData and signature and does not have an attestationObject.
+    assert_true(r.response instanceof AuthenticatorAssertionResponse);
+    assert_true(r.response.clientDataJSON instanceof ArrayBuffer);
+    assert_array_equals(new Uint8Array(r.response.clientDataJSON),
+        CLIENT_DATA_JSON, "clientDataJSON returned is the same");
+    assert_true(r.response.authenticatorData instanceof ArrayBuffer);
+    assert_true(r.response.signature instanceof ArrayBuffer);
+    assert_array_equals(new Uint8Array(r.response.authenticatorData),
+        AUTHENTICATOR_DATA, "authenticator_data returned is the same");
+    assert_array_equals(new Uint8Array(r.response.signature),
+        SIGNATURE, "signature returned is the same");
+    assert_not_exists(r.response, 'attestationObject');
+}
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/nested-mock-authenticator-client.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/nested-mock-authenticator-client.html
new file mode 100644
index 0000000..b706f6e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/nested-mock-authenticator-client.html
@@ -0,0 +1,16 @@
+<!DOCTYPE HTML>
+<title>Credential Manager: Nested page that sets up a mock authenticator response.</title>
+<script src="/credentialmanager/resources/testharness.js"></script>
+<script src="/credentialmanager/resources/testharnessreport.js"></script>
+<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom.js"></script>
+<script src="/credentialmanager/resources/credential-helpers.js"></script>
+<script>
+mockAuthenticator.setRawId(RAW_ID);
+mockAuthenticator.setId(TEST_NESTED_CREDENTIAL_ID);
+mockAuthenticator.setClientDataJson(CLIENT_DATA_JSON);
+mockAuthenticator.setAttestationObject(ATTESTATION_OBJECT);
+mockAuthenticator.setAuthenticatorStatus(
+    webauth.mojom.AuthenticatorStatus.SUCCESS);
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/publickey-create-helper.html b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/publickey-create-helper.html
new file mode 100644
index 0000000..b583f814
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/credentialmanager/resources/publickey-create-helper.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom.js"></script>
+<script src="/gen/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom.js"></script>
+<script src="credential-helpers.js"></script>
+<script>
+mockAuthenticator.setRawId(RAW_ID);
+mockAuthenticator.setId(ID);
+mockAuthenticator.setClientDataJson(CLIENT_DATA_JSON);
+mockAuthenticator.setAttestationObject(ATTESTATION_OBJECT);
+mockAuthenticator.setAuthenticatorStatus(
+    webauth.mojom.AuthenticatorStatus.SUCCESS);
+let queryParams = new URLSearchParams(window.location.search);
+let relyingPartyId = queryParams.get('rpId');
+var customPublicKey = {
+    challenge: CHALLENGE,
+    rp: { id: relyingPartyId, name: "Acme" },
+    user: PUBLIC_KEY_USER,
+    pubKeyCredParams: PUBLIC_KEY_PARAMETERS,
+};
+
+navigator.credentials.create({publicKey : customPublicKey})
+  .then(r => window.opener.postMessage("SUCCESS", "*"))
+  .catch(t => window.opener.postMessage(t.name, "*"));
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index 6425ba7..7b06e36 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -984,6 +984,7 @@
     method constructor
     method disconnect
     method observe
+    method takeRecords
 interface PerformanceObserverEntryList
     attribute @@toStringTag
     method constructor
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-added-expected.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-added-expected.html
deleted file mode 100644
index f521d72..0000000
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-added-expected.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<title>Text track cue layout after controls are added (reference)</title>
-<style>
-::cue {
-  font-size: 50px;
-}
-</style>
-<!-- Width should be large enough to display all of the media controls. -->
-<video controls style="border:1px solid gray; width: 500px;">
-  <source src="../content/white.webm" type="video/webm">
-  <source src="../content/white.mp4" type="video/mp4">
-</video>
-<script>
-// Add a single cue at line -2, where it would be if there were controls visible
-// at the bottom. (This assumes that those controls are less than 50px high.)
-// cue at line -1.
-var video = document.querySelector("video");
-var track = video.addTextTrack("captions");
-var cue = new VTTCue(0, 1, "text");
-cue.line = -2;
-track.addCue(cue);
-track.mode = "showing";
-</script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-added.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-added.html
deleted file mode 100644
index e622a149..0000000
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-added.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<title>Text track cue layout after controls are added</title>
-<style>
-::cue {
-  font-size: 50px;
-}
-</style>
-<!-- Width should be large enough to display all of the media controls. -->
-<video style="border:1px solid gray; width: 500px;">
-  <source src="../content/white.webm" type="video/webm">
-  <source src="../content/white.mp4" type="video/mp4">
-</video>
-<script>
-// Without testRunner.layoutAndPaintAsyncThen there is no guarantee for when the first
-// cue layout is done, so make no attempt to work without testRunner.
-testRunner.waitUntilDone();
-
-// Add a cue that will overlap with the video controls.
-var video = document.querySelector("video");
-var track = video.addTextTrack("captions");
-track.addCue(new VTTCue(0, 1, "text"));
-track.mode = "showing";
-
-video.onloadeddata = function() {
-  testRunner.layoutAndPaintAsyncThen(function() {
-    // Add the controls. The cue should move to avoid overlap.  Defer this
-    // until the controls resize.
-    video.controls = true;
-    // Wait for the relayout to happen.
-    window.requestAnimationFrame(function() {
-        testRunner.notifyDone();
-    });
-  });
-};
-</script>
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-removed.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-removed.html
deleted file mode 100644
index 1bcfcfa..0000000
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering-after-controls-removed.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<title>Text track cue layout after controls are removed</title>
-<style>
-::cue {
-  font-size: 50px;
-}
-</style>
-<video controls style="border:1px solid gray">
-  <source src="../content/white.webm" type="video/webm">
-  <source src="../content/white.mp4" type="video/mp4">
-</video>
-<script>
-// Without testRunner.layoutAndPaintAsyncThen there is no guarantee for when the first
-// cue layout is done, so make no attempt to work without testRunner.
-testRunner.waitUntilDone();
-
-// Add a cue that will overlap with the video controls.
-var video = document.querySelector("video");
-var track = video.addTextTrack("captions");
-track.addCue(new VTTCue(0, 1, "text"));
-track.mode = "showing";
-
-video.onloadeddata = function() {
-  testRunner.layoutAndPaintAsyncThen(function() {
-    // Remove the controls. The cue should not move.
-    video.controls = false;
-    testRunner.notifyDone();
-  });
-};
-</script>
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index 9e2e034..3c41be67 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -669,6 +669,7 @@
     method constructor
     method disconnect
     method observe
+    method takeRecords
 interface PerformanceObserverEntryList
     attribute @@toStringTag
     method constructor
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/color-profile-image-canvas-svg-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/color-profile-image-canvas-svg-expected.png
index 3f5a57e..e138031 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/color-profile-image-canvas-svg-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/gpu-rasterization/images/color-profile-image-canvas-svg-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
index 9e2e034..3c41be67 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt
@@ -669,6 +669,7 @@
     method constructor
     method disconnect
     method observe
+    method takeRecords
 interface PerformanceObserverEntryList
     attribute @@toStringTag
     method constructor
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
index 11306722..b6eb4cd 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -644,6 +644,7 @@
 [Worker]     method constructor
 [Worker]     method disconnect
 [Worker]     method observe
+[Worker]     method takeRecords
 [Worker] interface PerformanceObserverEntryList
 [Worker]     attribute @@toStringTag
 [Worker]     method constructor
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
index c37494f..5bdac13 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -4079,6 +4079,7 @@
     method constructor
     method disconnect
     method observe
+    method takeRecords
 interface PerformanceObserverEntryList
     attribute @@toStringTag
     method constructor
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
index 3dd720fb..267758de 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -639,6 +639,7 @@
 [Worker]     method constructor
 [Worker]     method disconnect
 [Worker]     method observe
+[Worker]     method takeRecords
 [Worker] interface PerformanceObserverEntryList
 [Worker]     attribute @@toStringTag
 [Worker]     method constructor
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
index 1b1a537..17b33e8 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-dedicated-worker-expected.txt
@@ -905,6 +905,7 @@
 [Worker]     method constructor
 [Worker]     method disconnect
 [Worker]     method observe
+[Worker]     method takeRecords
 [Worker] interface PerformanceObserverEntryList
 [Worker]     attribute @@toStringTag
 [Worker]     method constructor
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index cea2aeae..0c2b5a2 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -4964,6 +4964,7 @@
     method constructor
     method disconnect
     method observe
+    method takeRecords
 interface PerformanceObserverEntryList
     attribute @@toStringTag
     method constructor
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
index 73ff624..d335790 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-shared-worker-expected.txt
@@ -900,6 +900,7 @@
 [Worker]     method constructor
 [Worker]     method disconnect
 [Worker]     method observe
+[Worker]     method takeRecords
 [Worker] interface PerformanceObserverEntryList
 [Worker]     attribute @@toStringTag
 [Worker]     method constructor
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorTest.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorTest.cpp
index 11e53f3..aa9b6dc 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorTest.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorTest.cpp
@@ -170,7 +170,7 @@
       V8PerIsolateData::From(scope.GetIsolate())->GetScriptWrappableVisitor();
   visitor->TracePrologue();
 
-  visitor->MarkAndPushToMarkingDeque(object);
+  visitor->TraceWrappersWithManualWriteBarrier(object);
 
   EXPECT_EQ(visitor->MarkingDeque()->front().RawObjectPointer(), object);
 
@@ -268,7 +268,7 @@
       : ScriptWrappableVisitor(isolate), marked_wrappers_(new size_t(0)) {}
   ~InterceptingScriptWrappableVisitor() { delete marked_wrappers_; }
 
-  virtual void MarkWrapper(const v8::PersistentBase<v8::Value>* handle) const {
+  void Visit(const TraceWrapperV8Reference<v8::Value>&) const override {
     *marked_wrappers_ += 1;
     // Do not actually mark this visitor, as this would call into v8, which
     // would require executing an actual GC.
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
index 5206c937..7dc18482 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp
@@ -136,7 +136,7 @@
 
   // Collect interesting V8 roots for the heap snapshot. Currently these are
   // DOM nodes.
-  void CollectV8Roots() { isolate_->VisitHandlesWithClassIds(this); }
+  void CollectV8Roots() { isolate()->VisitHandlesWithClassIds(this); }
 
   void VisitPersistentHandle(v8::Persistent<v8::Value>* value,
                              uint16_t class_id) override {
@@ -144,10 +144,10 @@
       return;
 
     v8::Local<v8::Object> wrapper = v8::Local<v8::Object>::New(
-        isolate_, v8::Persistent<v8::Object>::Cast(*value));
-    DCHECK(V8Node::hasInstance(wrapper, isolate_));
+        isolate(), v8::Persistent<v8::Object>::Cast(*value));
+    DCHECK(V8Node::hasInstance(wrapper, isolate()));
     Node* node = V8Node::ToImpl(wrapper);
-    Node* root = V8GCController::OpaqueRootForGC(isolate_, node);
+    Node* root = V8GCController::OpaqueRootForGC(isolate(), node);
     nodes_requiring_tracing_[root].push_back(node);
   }
 
@@ -158,7 +158,7 @@
     current_parent_ = nullptr;
 
     TracePrologue();
-    ActiveScriptWrappableBase::TraceActiveScriptWrappables(isolate_, this);
+    ActiveScriptWrappableBase::TraceActiveScriptWrappables(isolate(), this);
     AdvanceTracing(
         0,
         v8::EmbedderHeapTracer::AdvanceTracingActions(
@@ -191,6 +191,8 @@
   v8::HeapProfiler::RetainerEdges Edges() { return std::move(edges_); }
   v8::HeapProfiler::RetainerGroups Groups() { return std::move(groups_); }
 
+  // ScriptWrappableVisitor overrides.
+
   void MarkWrappersInAllWorlds(
       const ScriptWrappable* traceable) const override {
     // Only mark the main thread wrapper as we cannot properly intercept
@@ -199,12 +201,6 @@
     traceable->MarkWrapper(this);
   }
 
-  void MarkWrapper(const v8::PersistentBase<v8::Value>* value) const override {
-    if (current_parent_ && current_parent_ != value)
-      edges_.push_back(std::make_pair(current_parent_, value));
-    found_v8_wrappers_.insert(value);
-  }
-
   void DispatchTraceWrappers(const TraceWrapperBase* traceable) const override {
     if (!only_trace_single_level_ || !traceable->IsScriptWrappable() ||
         !reinterpret_cast<const ScriptWrappable*>(traceable)
@@ -215,6 +211,16 @@
     }
   }
 
+ protected:
+  // ScriptWrappableVisitor override.
+  void Visit(
+      const TraceWrapperV8Reference<v8::Value>& traced_wrapper) const override {
+    const v8::PersistentBase<v8::Value>* value = &traced_wrapper.Get();
+    if (current_parent_ && current_parent_ != value)
+      edges_.push_back(std::make_pair(current_parent_, value));
+    found_v8_wrappers_.insert(value);
+  }
+
  private:
   inline v8::PersistentBase<v8::Value>* PersistentForWrappable(
       ScriptWrappable* wrappable) {
diff --git a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp
index 4979f9f..eaa5826 100644
--- a/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueDeserializer.cpp
@@ -215,7 +215,10 @@
       if (!ReadUTF8String(&uuid) || !ReadUTF8String(&type) ||
           !ReadUint64(&size))
         return nullptr;
-      return Blob::Create(GetOrCreateBlobDataHandle(uuid, type, size));
+      auto blob_handle = GetOrCreateBlobDataHandle(uuid, type, size);
+      if (!blob_handle)
+        return nullptr;
+      return Blob::Create(std::move(blob_handle));
     }
     case kBlobIndexTag: {
       if (Version() < 6 || !blob_info_array_)
@@ -229,7 +232,9 @@
         blob_handle =
             GetOrCreateBlobDataHandle(info.Uuid(), info.GetType(), info.size());
       }
-      return Blob::Create(blob_handle);
+      if (!blob_handle)
+        return nullptr;
+      return Blob::Create(std::move(blob_handle));
     }
     case kFileTag:
       return ReadFile();
@@ -518,10 +523,12 @@
   const File::UserVisibility user_visibility =
       is_user_visible ? File::kIsUserVisible : File::kIsNotUserVisible;
   const uint64_t kSizeForDataHandle = static_cast<uint64_t>(-1);
+  auto blob_handle = GetOrCreateBlobDataHandle(uuid, type, kSizeForDataHandle);
+  if (!blob_handle)
+    return nullptr;
   return File::CreateFromSerialization(
       path, name, relative_path, user_visibility, has_snapshot, size,
-      last_modified_ms,
-      GetOrCreateBlobDataHandle(uuid, type, kSizeForDataHandle));
+      last_modified_ms, std::move(blob_handle));
 }
 
 File* V8ScriptValueDeserializer::ReadFileIndex() {
@@ -538,6 +545,8 @@
     blob_handle =
         GetOrCreateBlobDataHandle(info.Uuid(), info.GetType(), info.size());
   }
+  if (!blob_handle)
+    return nullptr;
   return File::CreateFromIndexedSerialization(info.FilePath(), info.FileName(),
                                               info.size(), last_modified_ms,
                                               blob_handle);
@@ -563,6 +572,11 @@
   BlobDataHandleMap::const_iterator it = handles.find(uuid);
   if (it != handles.end())
     return it->value;
+  // Creating a BlobDataHandle from an empty string will get this renderer
+  // killed, so since we're parsing untrusted data (from possibly another
+  // process/renderer) return null instead.
+  if (uuid.IsEmpty())
+    return nullptr;
   return BlobDataHandle::Create(uuid, type, size);
 }
 
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 8a0dfaf..daeae07 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -2498,18 +2498,11 @@
 ShadowRoot& Element::CreateShadowRootInternal() {
   DCHECK(!ClosedShadowRoot());
   DCHECK(AreAuthorShadowsAllowed());
-  if (AlwaysCreateUserAgentShadowRoot())
-    EnsureLegacyUserAgentShadowRootV0();
+  DCHECK(!AlwaysCreateUserAgentShadowRoot());
   GetDocument().SetShadowCascadeOrder(ShadowCascadeOrder::kShadowCascadeV0);
   return EnsureShadow().AddShadowRoot(*this, ShadowRootType::V0);
 }
 
-ShadowRoot& Element::CreateLegacyUserAgentShadowRootV0() {
-  DCHECK(!GetShadowRoot());
-  return EnsureShadow().AddShadowRoot(*this,
-                                      ShadowRootType::kLegacyUserAgentV0);
-}
-
 ShadowRoot& Element::CreateUserAgentShadowRootV1() {
   DCHECK(!GetShadowRoot());
   return EnsureShadow().AddShadowRoot(*this, ShadowRootType::kUserAgentV1);
@@ -2570,17 +2563,6 @@
   return nullptr;
 }
 
-ShadowRoot& Element::EnsureLegacyUserAgentShadowRootV0() {
-  if (ShadowRoot* shadow_root = UserAgentShadowRoot()) {
-    DCHECK(shadow_root->GetType() == ShadowRootType::kLegacyUserAgentV0);
-    return *shadow_root;
-  }
-  ShadowRoot& shadow_root =
-      EnsureShadow().AddShadowRoot(*this, ShadowRootType::kLegacyUserAgentV0);
-  DidAddUserAgentShadowRoot(shadow_root);
-  return shadow_root;
-}
-
 ShadowRoot& Element::EnsureUserAgentShadowRootV1() {
   if (ShadowRoot* shadow_root = UserAgentShadowRoot()) {
     DCHECK(shadow_root->GetType() == ShadowRootType::kUserAgentV1);
diff --git a/third_party/WebKit/Source/core/dom/Element.h b/third_party/WebKit/Source/core/dom/Element.h
index 51abfc4..5c86464 100644
--- a/third_party/WebKit/Source/core/dom/Element.h
+++ b/third_party/WebKit/Source/core/dom/Element.h
@@ -466,11 +466,11 @@
   void RecalcStyleForReattach();
   bool NeedsRebuildLayoutTree(
       const WhitespaceAttacher& whitespace_attacher) const {
-    // TODO(futhark@chromium.org): IsActiveSlotOrActiveV0InsertionPoint() can be
-    // replaced by IsActiveV0InsertionPoint() when slots are always part of the
-    // flat tree, and removed completely when Shadow DOM V0 support is removed.
+    // TODO(futhark@chromium.org): !CanParticipateInFlatTree() can be replaced
+    // by IsActiveV0InsertionPoint() when slots are always part of the flat
+    // tree, and removed completely when Shadow DOM V0 support is removed.
     return NeedsReattachLayoutTree() || ChildNeedsReattachLayoutTree() ||
-           IsActiveSlotOrActiveV0InsertionPoint() ||
+           !CanParticipateInFlatTree() ||
            (whitespace_attacher.TraverseIntoDisplayContents() &&
             HasDisplayContentsStyle());
   }
@@ -497,7 +497,6 @@
                            const ShadowRootInit&,
                            ExceptionState&);
   ShadowRoot& CreateShadowRootInternal();
-  ShadowRoot& CreateLegacyUserAgentShadowRootV0();
   ShadowRoot& CreateUserAgentShadowRootV1();
   ShadowRoot& AttachShadowRootInternal(ShadowRootType,
                                        bool delegates_focus = false);
@@ -511,7 +510,6 @@
 
   ShadowRoot* ShadowRootIfV1() const;
 
-  ShadowRoot& EnsureLegacyUserAgentShadowRootV0();
   ShadowRoot& EnsureUserAgentShadowRootV1();
 
   bool IsInDescendantTreeOf(const Element* shadow_host) const;
diff --git a/third_party/WebKit/Source/core/dom/ElementShadow.cpp b/third_party/WebKit/Source/core/dom/ElementShadow.cpp
index a737e76..b293c64 100644
--- a/third_party/WebKit/Source/core/dom/ElementShadow.cpp
+++ b/third_party/WebKit/Source/core/dom/ElementShadow.cpp
@@ -66,8 +66,7 @@
     for (ShadowRoot* root = &YoungestShadowRoot(); root;
          root = root->OlderShadowRoot())
       root->LazyReattachIfAttached();
-  } else if (type == ShadowRootType::V0 ||
-             type == ShadowRootType::kLegacyUserAgentV0) {
+  } else if (type == ShadowRootType::V0) {
     DCHECK(!element_shadow_v0_);
     element_shadow_v0_ = ElementShadowV0::Create(*this);
   }
diff --git a/third_party/WebKit/Source/core/dom/ShadowRoot.cpp b/third_party/WebKit/Source/core/dom/ShadowRoot.cpp
index 3d26e12..bcbd02b9 100644
--- a/third_party/WebKit/Source/core/dom/ShadowRoot.cpp
+++ b/third_party/WebKit/Source/core/dom/ShadowRoot.cpp
@@ -368,9 +368,6 @@
 
 std::ostream& operator<<(std::ostream& ostream, const ShadowRootType& type) {
   switch (type) {
-    case ShadowRootType::kLegacyUserAgentV0:
-      ostream << "UserAgentV0";
-      break;
     case ShadowRootType::kUserAgentV1:
       ostream << "UserAgent";
       break;
diff --git a/third_party/WebKit/Source/core/dom/ShadowRoot.h b/third_party/WebKit/Source/core/dom/ShadowRoot.h
index e217ca9..d5c08d55 100644
--- a/third_party/WebKit/Source/core/dom/ShadowRoot.h
+++ b/third_party/WebKit/Source/core/dom/ShadowRoot.h
@@ -50,7 +50,6 @@
 class WhitespaceAttacher;
 
 enum class ShadowRootType {
-  kLegacyUserAgentV0,
   V0,
   kOpen,
   kClosed,
@@ -102,10 +101,7 @@
            GetType() == ShadowRootType::kClosed ||
            GetType() == ShadowRootType::kUserAgentV1;
   }
-  bool IsUserAgent() const {
-    return GetType() == ShadowRootType::kLegacyUserAgentV0 ||
-           GetType() == ShadowRootType::kUserAgentV1;
-  }
+  bool IsUserAgent() const { return GetType() == ShadowRootType::kUserAgentV1; }
 
   void AttachLayoutTree(AttachContext&) override;
   void DetachLayoutTree(const AttachContext& = AttachContext()) override;
diff --git a/third_party/WebKit/Source/core/editing/ime/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/ime/InputMethodController.cpp
index f51280c..093932d 100644
--- a/third_party/WebKit/Source/core/editing/ime/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/ime/InputMethodController.cpp
@@ -801,7 +801,8 @@
       // It's weird to call |setComposition()| with empty text outside
       // composition, however some IME (e.g. Japanese IBus-Anthy) did this, so
       // we simply delete selection without sending extra events.
-      TypingCommand::DeleteSelection(GetDocument());
+      if (!DeleteSelection())
+        return;
     }
 
     // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets
@@ -1088,6 +1089,27 @@
   return PlainTextRange(start, end);
 }
 
+bool InputMethodController::DeleteSelection() {
+  if (!GetFrame().Selection().ComputeVisibleSelectionInDOMTree().IsRange())
+    return true;
+
+  Node* target = GetFrame().GetDocument()->FocusedElement();
+  if (target) {
+    DispatchBeforeInputEditorCommand(
+        target, InputEvent::InputType::kDeleteContentBackward,
+        TargetRangesForInputEvent(*target));
+
+    // Frame could have been destroyed by the beforeinput event.
+    if (!IsAvailable())
+      return false;
+  }
+
+  TypingCommand::DeleteSelection(GetDocument());
+
+  // Frame could have been destroyed by the input event.
+  return IsAvailable();
+}
+
 bool InputMethodController::MoveCaret(int new_caret_position) {
   GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
   PlainTextRange selected_range =
@@ -1133,13 +1155,7 @@
                                    .End() &&
            before <= static_cast<int>(selection_offsets.Start()));
   // TODO(chongz): Find a way to distinguish Forward and Backward.
-  Node* target = GetDocument().FocusedElement();
-  if (target) {
-    DispatchBeforeInputEditorCommand(
-        target, InputEvent::InputType::kDeleteContentBackward,
-        TargetRangesForInputEvent(*target));
-  }
-  TypingCommand::DeleteSelection(GetDocument());
+  ignore_result(DeleteSelection());
 }
 
 // TODO(yabinh): We should reduce the number of selectionchange events.
@@ -1177,7 +1193,8 @@
     const int adjusted_start = start - static_cast<int>(diff);
     if (!SetSelectionOffsets(PlainTextRange(adjusted_start, selection_start)))
       return;
-    TypingCommand::DeleteSelection(GetDocument());
+    if (!DeleteSelection())
+      return;
 
     selection_end = selection_end - (selection_start - adjusted_start);
     selection_start = adjusted_start;
@@ -1203,7 +1220,8 @@
     const int adjusted_end = end + static_cast<int>(diff);
     if (!SetSelectionOffsets(PlainTextRange(selection_end, adjusted_end)))
       return;
-    TypingCommand::DeleteSelection(GetDocument());
+    if (!DeleteSelection())
+      return;
   }
 
   SetSelectionOffsets(PlainTextRange(selection_start, selection_end));
diff --git a/third_party/WebKit/Source/core/editing/ime/InputMethodController.h b/third_party/WebKit/Source/core/editing/ime/InputMethodController.h
index 562ae158..f0e96d1 100644
--- a/third_party/WebKit/Source/core/editing/ime/InputMethodController.h
+++ b/third_party/WebKit/Source/core/editing/ime/InputMethodController.h
@@ -154,6 +154,9 @@
       int relative_caret_position,
       const Vector<ImeTextSpan>& ime_text_spans);
 
+  // Returns false if the frame was destroyed, true otherwise.
+  bool DeleteSelection() WARN_UNUSED_RESULT;
+
   // Returns true if moved caret successfully.
   bool MoveCaret(int new_caret_position);
 
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp
index d165dcd..ce70025 100644
--- a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.cpp
@@ -629,6 +629,11 @@
     web_frame_->Client()->DidStopLoading();
 }
 
+void LocalFrameClientImpl::ForwardResourceTimingToParent(
+    const WebResourceTimingInfo& info) {
+  web_frame_->Client()->ForwardResourceTimingToParent(info);
+}
+
 void LocalFrameClientImpl::DownloadURL(const ResourceRequest& request,
                                        const String& suggested_name) {
   if (!web_frame_->Client())
diff --git a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h
index 65f6153..74a293e 100644
--- a/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h
+++ b/third_party/WebKit/Source/core/exported/LocalFrameClientImpl.h
@@ -128,6 +128,7 @@
   void DidStartLoading(LoadStartType) override;
   void DidStopLoading() override;
   void ProgressEstimateChanged(double progress_estimate) override;
+  void ForwardResourceTimingToParent(const WebResourceTimingInfo&) override;
   void DownloadURL(const ResourceRequest&,
                    const String& suggested_name) override;
   void LoadErrorPage(int reason) override;
diff --git a/third_party/WebKit/Source/core/exported/WebFrame.cpp b/third_party/WebKit/Source/core/exported/WebFrame.cpp
index 0ad9c85..0659c23 100644
--- a/third_party/WebKit/Source/core/exported/WebFrame.cpp
+++ b/third_party/WebKit/Source/core/exported/WebFrame.cpp
@@ -120,11 +120,12 @@
     ToWebRemoteFrameImpl(frame)->InitializeCoreFrame(*page, owner, name);
   }
 
-  if (parent_ && old_frame->HasBeenActivated())
-    ToCoreFrame(*frame)->UpdateUserActivationInFrameTree();
+  Frame* new_frame = ToCoreFrame(*frame);
 
-  ToCoreFrame(*frame)->GetWindowProxyManager()->SetGlobalProxies(
-      global_proxies);
+  if (parent_ && old_frame->HasBeenActivated())
+    new_frame->UpdateUserActivationInFrameTree();
+
+  new_frame->GetWindowProxyManager()->SetGlobalProxies(global_proxies);
 
   parent_ = nullptr;
 
diff --git a/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp b/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp
index 8e32c32..8c38ed6b 100644
--- a/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp
+++ b/third_party/WebKit/Source/core/exported/WebFrameSerializer.cpp
@@ -357,7 +357,6 @@
 
   String shadow_mode;
   switch (shadow_root.GetType()) {
-    case ShadowRootType::kLegacyUserAgentV0:
     case ShadowRootType::kUserAgentV1:
       // No need to serialize.
       return std::pair<Node*, Element*>();
diff --git a/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp
index 1e2d131..dd7a3af 100644
--- a/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp
+++ b/third_party/WebKit/Source/core/exported/WebFrameSerializerSanitizationTest.cpp
@@ -166,9 +166,6 @@
     if (shadow_type == ShadowRootType::V0) {
       DCHECK(!delegates_focus);
       shadow_root = &host_element->CreateShadowRootInternal();
-    } else if (shadow_type == ShadowRootType::kLegacyUserAgentV0) {
-      DCHECK(!delegates_focus);
-      shadow_root = &host_element->CreateLegacyUserAgentShadowRootV0();
     } else {
       shadow_root =
           &host_element->AttachShadowRootInternal(shadow_type, delegates_focus);
diff --git a/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp b/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp
index f2a8ef91..13ff081 100644
--- a/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.cpp
@@ -20,6 +20,8 @@
 #include "core/layout/LayoutView.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Page.h"
+#include "core/timing/DOMWindowPerformance.h"
+#include "core/timing/Performance.h"
 #include "platform/bindings/DOMWrapperWorld.h"
 #include "platform/feature_policy/FeaturePolicy.h"
 #include "platform/geometry/FloatQuad.h"
@@ -270,7 +272,18 @@
   GetFrame()->GetSecurityContext()->SetInsecureNavigationsSet(set);
 }
 
-void WebRemoteFrameImpl::DispatchLoadEventOnFrameOwner() {
+void WebRemoteFrameImpl::ForwardResourceTimingToParent(
+    const WebResourceTimingInfo& info) {
+  DCHECK(Parent()->IsWebLocalFrame());
+  WebLocalFrameImpl* parent_frame =
+      ToWebLocalFrameImpl(Parent()->ToWebLocalFrame());
+  HTMLFrameOwnerElement* owner_element =
+      ToHTMLFrameOwnerElement(frame_->Owner());
+  DOMWindowPerformance::performance(*parent_frame->GetFrame()->DomWindow())
+      ->AddResourceTiming(info, owner_element->localName());
+}
+
+void WebRemoteFrameImpl::DispatchLoadEventForFrameOwner() {
   DCHECK(GetFrame()->Owner()->IsLocal());
   GetFrame()->Owner()->DispatchLoad();
 }
diff --git a/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.h b/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.h
index adc3721..3d66348 100644
--- a/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.h
+++ b/third_party/WebKit/Source/core/exported/WebRemoteFrameImpl.h
@@ -72,7 +72,8 @@
   void SetReplicatedInsecureRequestPolicy(WebInsecureRequestPolicy) override;
   void SetReplicatedInsecureNavigationsSet(
       const std::vector<unsigned>&) override;
-  void DispatchLoadEventOnFrameOwner() override;
+  void ForwardResourceTimingToParent(const WebResourceTimingInfo&) override;
+  void DispatchLoadEventForFrameOwner() override;
   void DidStartLoading() override;
   void DidStopLoading() override;
   bool IsIgnoredForHitTest() const override;
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
index 522efb7c..3c094f0 100644
--- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.cpp
@@ -350,9 +350,9 @@
   pause_worker_context_on_start_ = true;
 }
 
-void WebSharedWorkerImpl::GetDevToolsAgent(
+void WebSharedWorkerImpl::BindDevToolsAgent(
     mojo::ScopedInterfaceEndpointHandle devtools_agent_request) {
-  shadow_page_->GetDevToolsAgent(mojom::blink::DevToolsAgentAssociatedRequest(
+  shadow_page_->BindDevToolsAgent(mojom::blink::DevToolsAgentAssociatedRequest(
       std::move(devtools_agent_request)));
 }
 
diff --git a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h
index 4fd42a93..b67035c 100644
--- a/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h
+++ b/third_party/WebKit/Source/core/exported/WebSharedWorkerImpl.h
@@ -90,7 +90,7 @@
   void TerminateWorkerContext() override;
 
   void PauseWorkerContextOnStart() override;
-  void GetDevToolsAgent(
+  void BindDevToolsAgent(
       mojo::ScopedInterfaceEndpointHandle devtools_agent_request) override;
 
   // Callback methods for SharedWorkerReportingProxy.
diff --git a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
index d0c5134a..f666731 100644
--- a/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
@@ -3029,6 +3029,13 @@
   int width_scaled = document->GetLayoutView()
                          ->MinPreferredLogicalWidth()
                          .Round();  // Already accounts for zoom.
+  if (Scrollbar* scrollbar =
+          MainFrameImpl()->GetFrameView()->VerticalScrollbar()) {
+    DCHECK(!RuntimeEnabledFeatures::RootLayerScrollingEnabled());
+    // For RLS, this occurs in LayoutBlock::ComputeIntrinsicLogicalWidths.
+    if (!scrollbar->IsOverlayScrollbar())
+      width_scaled += scrollbar->ScrollbarThickness();
+  }
   int height_scaled =
       document->documentElement()->GetLayoutBox()->ScrollHeight().Round();
   return IntSize(width_scaled, height_scaled);
diff --git a/third_party/WebKit/Source/core/exported/WorkerShadowPage.cpp b/third_party/WebKit/Source/core/exported/WorkerShadowPage.cpp
index 74d152c..8530cee1 100644
--- a/third_party/WebKit/Source/core/exported/WorkerShadowPage.cpp
+++ b/third_party/WebKit/Source/core/exported/WorkerShadowPage.cpp
@@ -112,7 +112,7 @@
   }
 }
 
-void WorkerShadowPage::GetDevToolsAgent(
+void WorkerShadowPage::BindDevToolsAgent(
     mojom::blink::DevToolsAgentAssociatedRequest request) {
   main_frame_->DevToolsAgentImpl()->BindRequest(std::move(request));
 }
diff --git a/third_party/WebKit/Source/core/exported/WorkerShadowPage.h b/third_party/WebKit/Source/core/exported/WorkerShadowPage.h
index ba8a5153..336d409 100644
--- a/third_party/WebKit/Source/core/exported/WorkerShadowPage.h
+++ b/third_party/WebKit/Source/core/exported/WorkerShadowPage.h
@@ -74,7 +74,7 @@
   WebDocumentLoader* DocumentLoader() {
     return main_frame_->GetDocumentLoader();
   }
-  void GetDevToolsAgent(mojom::blink::DevToolsAgentAssociatedRequest);
+  void BindDevToolsAgent(mojom::blink::DevToolsAgentAssociatedRequest);
 
   bool WasInitialized() const;
 
diff --git a/third_party/WebKit/Source/core/frame/Frame.h b/third_party/WebKit/Source/core/frame/Frame.h
index a68bd6d..fff4e8716 100644
--- a/third_party/WebKit/Source/core/frame/Frame.h
+++ b/third_party/WebKit/Source/core/frame/Frame.h
@@ -54,7 +54,6 @@
 class LocalFrame;
 class KURL;
 class Page;
-class ResourceTimingInfo;
 class SecurityContext;
 class Settings;
 class WindowProxy;
@@ -87,8 +86,6 @@
   virtual void Navigate(const FrameLoadRequest&) = 0;
   virtual void Reload(FrameLoadType, ClientRedirectPolicy) = 0;
 
-  virtual void AddResourceTiming(const ResourceTimingInfo&) = 0;
-
   virtual void Detach(FrameDetachType);
   void DisconnectOwnerElement();
   virtual bool ShouldClose() = 0;
diff --git a/third_party/WebKit/Source/core/frame/FrameOwner.h b/third_party/WebKit/Source/core/frame/FrameOwner.h
index be966ee7..43d1d0df 100644
--- a/third_party/WebKit/Source/core/frame/FrameOwner.h
+++ b/third_party/WebKit/Source/core/frame/FrameOwner.h
@@ -14,6 +14,7 @@
 namespace blink {
 
 class Frame;
+class ResourceTimingInfo;
 
 // Oilpan: all FrameOwner instances are GCed objects. FrameOwner additionally
 // derives from GarbageCollectedMixin so that Member<FrameOwner> references can
@@ -21,6 +22,7 @@
 class CORE_EXPORT FrameOwner : public GarbageCollectedMixin {
  public:
   virtual ~FrameOwner() = default;
+
   virtual void Trace(blink::Visitor* visitor) {}
 
   virtual bool IsLocal() const = 0;
@@ -31,6 +33,10 @@
   virtual void ClearContentFrame() = 0;
 
   virtual SandboxFlags GetSandboxFlags() const = 0;
+  // Note: there is a subtle ordering dependency here: if a page load needs to
+  // report resource timing information, it *must* do so before calling
+  // DispatchLoad().
+  virtual void AddResourceTiming(const ResourceTimingInfo&) = 0;
   virtual void DispatchLoad() = 0;
 
   // On load failure, a frame can ask its owner to render fallback content
@@ -59,7 +65,7 @@
 // TODO(dcheng): This class is an internal implementation detail of provisional
 // frames. Move this into WebLocalFrameImpl.cpp and remove existing dependencies
 // on it.
-class CORE_EXPORT DummyFrameOwner
+class CORE_EXPORT DummyFrameOwner final
     : public GarbageCollectedFinalized<DummyFrameOwner>,
       public FrameOwner {
   USING_GARBAGE_COLLECTED_MIXIN(DummyFrameOwner);
@@ -74,6 +80,7 @@
   void SetContentFrame(Frame&) override {}
   void ClearContentFrame() override {}
   SandboxFlags GetSandboxFlags() const override { return kSandboxNone; }
+  void AddResourceTiming(const ResourceTimingInfo&) override {}
   void DispatchLoad() override {}
   bool CanRenderFallbackContent() const override { return false; }
   void RenderFallbackContent() override {}
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index 183d88e..b76797e 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -79,8 +79,6 @@
 #include "core/paint/compositing/PaintLayerCompositor.h"
 #include "core/probe/CoreProbes.h"
 #include "core/svg/SVGDocumentExtensions.h"
-#include "core/timing/DOMWindowPerformance.h"
-#include "core/timing/Performance.h"
 #include "platform/Histogram.h"
 #include "platform/WebFrameScheduler.h"
 #include "platform/bindings/ScriptForbiddenScope.h"
@@ -285,11 +283,6 @@
   }
 }
 
-void LocalFrame::AddResourceTiming(const ResourceTimingInfo& info) {
-  DCHECK(IsAttached());
-  DOMWindowPerformance::performance(*DomWindow())->AddResourceTiming(info);
-}
-
 void LocalFrame::Detach(FrameDetachType type) {
   // Note that detach() can be re-entered, so it's not possible to
   // DCHECK(isAttached()) here.
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.h b/third_party/WebKit/Source/core/frame/LocalFrame.h
index f58ba00f..ff53081 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.h
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.h
@@ -115,7 +115,6 @@
                 UserGestureStatus) override;
   void Navigate(const FrameLoadRequest&) override;
   void Reload(FrameLoadType, ClientRedirectPolicy) override;
-  void AddResourceTiming(const ResourceTimingInfo&) override;
   void Detach(FrameDetachType) override;
   bool ShouldClose() override;
   SecurityContext* GetSecurityContext() const override;
@@ -297,6 +296,13 @@
   void ForceSynchronousDocumentInstall(const AtomicString& mime_type,
                                        scoped_refptr<SharedBuffer> data);
 
+  bool should_send_resource_timing_info_to_parent() const {
+    return should_send_resource_timing_info_to_parent_;
+  }
+  void DidSendResourceTimingInfoToParent() {
+    should_send_resource_timing_info_to_parent_ = false;
+  }
+
  private:
   friend class FrameNavigationDisabler;
 
@@ -338,6 +344,11 @@
   const Member<TextSuggestionController> text_suggestion_controller_;
 
   int navigation_disable_count_;
+  // TODO(dcheng): In theory, this could be replaced by checking the
+  // FrameLoaderStateMachine if a real load has committed. Unfortunately, the
+  // internal state tracked there is incorrect today. See
+  // https://crbug.com/778318.
+  bool should_send_resource_timing_info_to_parent_ = true;
 
   float page_zoom_factor_;
   float text_zoom_factor_;
diff --git a/third_party/WebKit/Source/core/frame/LocalFrameClient.h b/third_party/WebKit/Source/core/frame/LocalFrameClient.h
index c3134964..a8a312e 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrameClient.h
+++ b/third_party/WebKit/Source/core/frame/LocalFrameClient.h
@@ -95,8 +95,9 @@
 class WebMediaPlayer;
 class WebMediaPlayerClient;
 class WebMediaPlayerSource;
-class WebRemotePlaybackClient;
 class WebRTCPeerConnectionHandler;
+class WebRemotePlaybackClient;
+struct WebResourceTimingInfo;
 class WebServiceWorkerProvider;
 class WebSpellCheckPanelHostClient;
 struct WebScrollIntoViewParams;
@@ -157,6 +158,8 @@
   virtual void ProgressEstimateChanged(double progress_estimate) = 0;
   virtual void DidStopLoading() = 0;
 
+  virtual void ForwardResourceTimingToParent(const WebResourceTimingInfo&) = 0;
+
   virtual void DownloadURL(const ResourceRequest&,
                            const String& suggested_name) = 0;
   virtual void LoadErrorPage(int reason) = 0;
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
index 94a3b61..2a84de1 100644
--- a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
@@ -85,11 +85,6 @@
   Client()->Reload(frame_load_type, client_redirect_policy);
 }
 
-void RemoteFrame::AddResourceTiming(const ResourceTimingInfo& info) {
-  DCHECK(info.IsMainResource());
-  // TODO(dcheng): Perform origin check, filter out fields, and forward via IPC.
-}
-
 void RemoteFrame::Detach(FrameDetachType type) {
   lifecycle_.AdvanceTo(FrameLifecycle::kDetaching);
 
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.h b/third_party/WebKit/Source/core/frame/RemoteFrame.h
index 472803d..f9de372 100644
--- a/third_party/WebKit/Source/core/frame/RemoteFrame.h
+++ b/third_party/WebKit/Source/core/frame/RemoteFrame.h
@@ -32,7 +32,6 @@
                 UserGestureStatus) override;
   void Navigate(const FrameLoadRequest& passed_request) override;
   void Reload(FrameLoadType, ClientRedirectPolicy) override;
-  void AddResourceTiming(const ResourceTimingInfo&) override;
   void Detach(FrameDetachType) override;
   RemoteSecurityContext* GetSecurityContext() const override;
   bool PrepareForCommit() override;
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameOwner.cpp b/third_party/WebKit/Source/core/frame/RemoteFrameOwner.cpp
index f4319b5b..0c0d51b 100644
--- a/third_party/WebKit/Source/core/frame/RemoteFrameOwner.cpp
+++ b/third_party/WebKit/Source/core/frame/RemoteFrameOwner.cpp
@@ -5,7 +5,10 @@
 #include "core/frame/RemoteFrameOwner.h"
 
 #include "core/frame/LocalFrame.h"
+#include "core/frame/LocalFrameClient.h"
 #include "core/frame/WebLocalFrameImpl.h"
+#include "core/timing/PerformanceBase.h"
+#include "public/platform/WebResourceTimingInfo.h"
 #include "public/web/WebFrameClient.h"
 
 namespace blink {
@@ -46,6 +49,15 @@
   frame_ = nullptr;
 }
 
+void RemoteFrameOwner::AddResourceTiming(const ResourceTimingInfo& info) {
+  LocalFrame* frame = ToLocalFrame(frame_);
+  WebResourceTimingInfo resource_timing =
+      PerformanceBase::GenerateResourceTiming(
+          *frame->Tree().Parent()->GetSecurityContext()->GetSecurityOrigin(),
+          info, *frame->GetDocument());
+  frame->Client()->ForwardResourceTimingToParent(resource_timing);
+}
+
 void RemoteFrameOwner::DispatchLoad() {
   WebLocalFrameImpl* web_frame =
       WebLocalFrameImpl::FromFrame(ToLocalFrame(*frame_));
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrameOwner.h b/third_party/WebKit/Source/core/frame/RemoteFrameOwner.h
index f770069..fd18eca4 100644
--- a/third_party/WebKit/Source/core/frame/RemoteFrameOwner.h
+++ b/third_party/WebKit/Source/core/frame/RemoteFrameOwner.h
@@ -37,6 +37,7 @@
   void ClearContentFrame() override;
   SandboxFlags GetSandboxFlags() const override { return sandbox_flags_; }
   void SetSandboxFlags(SandboxFlags flags) { sandbox_flags_ = flags; }
+  void AddResourceTiming(const ResourceTimingInfo&) override;
   void DispatchLoad() override;
   // TODO(dcheng): Implement.
   bool CanRenderFallbackContent() const override { return false; }
diff --git a/third_party/WebKit/Source/core/frame/Settings.json5 b/third_party/WebKit/Source/core/frame/Settings.json5
index cfa0be57..26091ba 100644
--- a/third_party/WebKit/Source/core/frame/Settings.json5
+++ b/third_party/WebKit/Source/core/frame/Settings.json5
@@ -790,7 +790,7 @@
 
     {
       name: "progressBarCompletion",
-      initial: "ProgressBarCompletion::kLoadEvent",
+      initial: "ProgressBarCompletion::kResourcesBeforeDCL",
       type: "ProgressBarCompletion",
     },
 
diff --git a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp
index 36d92361..9ba0b146 100644
--- a/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/core/frame/WebLocalFrameImpl.cpp
@@ -1971,16 +1971,6 @@
   return result;
 }
 
-static void EnsureFrameLoaderHasCommitted(FrameLoader& frame_loader) {
-  // Internally, Blink uses CommittedMultipleRealLoads to track whether the
-  // next commit should create a new history item or not. Ensure we have
-  // reached that state.
-  if (frame_loader.StateMachine()->CommittedMultipleRealLoads())
-    return;
-  frame_loader.StateMachine()->AdvanceTo(
-      FrameLoaderStateMachine::kCommittedMultipleRealLoads);
-}
-
 void WebLocalFrameImpl::SetAutofillClient(WebAutofillClient* autofill_client) {
   autofill_client_ = autofill_client;
 }
@@ -2186,7 +2176,9 @@
 
 void WebLocalFrameImpl::SetCommittedFirstRealLoad() {
   DCHECK(GetFrame());
-  EnsureFrameLoaderHasCommitted(GetFrame()->Loader());
+  GetFrame()->Loader().StateMachine()->AdvanceTo(
+      FrameLoaderStateMachine::kCommittedMultipleRealLoads);
+  GetFrame()->DidSendResourceTimingInfoToParent();
 }
 
 void WebLocalFrameImpl::SetHasReceivedUserGesture() {
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
index 8ee0ef34..86fee14b 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -36,6 +36,8 @@
 #include "core/loader/FrameLoader.h"
 #include "core/page/Page.h"
 #include "core/probe/CoreProbes.h"
+#include "core/timing/DOMWindowPerformance.h"
+#include "core/timing/Performance.h"
 #include "platform/heap/HeapAllocator.h"
 #include "platform/weborigin/SecurityOrigin.h"
 #include "public/platform/modules/fetch/fetch_api_request.mojom-shared.h"
@@ -78,8 +80,7 @@
     : HTMLElement(tag_name, document),
       content_frame_(nullptr),
       embedded_content_view_(nullptr),
-      sandbox_flags_(kSandboxNone),
-      did_load_non_empty_document_(false) {}
+      sandbox_flags_(kSandboxNone) {}
 
 LayoutEmbeddedContent* HTMLFrameOwnerElement::GetLayoutEmbeddedContent() const {
   // HTMLObjectElement and HTMLEmbedElement may return arbitrary layoutObjects
@@ -203,6 +204,13 @@
   }
 }
 
+void HTMLFrameOwnerElement::AddResourceTiming(const ResourceTimingInfo& info) {
+  // Resource timing info should only be reported if the subframe is attached.
+  DCHECK(ContentFrame() && ContentFrame()->IsLocalFrame());
+  DOMWindowPerformance::performance(*GetDocument().domWindow())
+      ->GenerateAndAddResourceTiming(info, localName());
+}
+
 void HTMLFrameOwnerElement::DispatchLoad() {
   DispatchScopedEvent(Event::Create(EventTypeNames::load));
 }
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
index 35765bb..9bc3515 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
@@ -63,9 +63,6 @@
 
   Document* getSVGDocument(ExceptionState&) const;
 
-  bool LoadedNonEmptyDocument() const { return did_load_non_empty_document_; }
-  void DidLoadNonEmptyDocument() { did_load_non_empty_document_ = true; }
-
   void SetEmbeddedContentView(EmbeddedContentView*);
   EmbeddedContentView* ReleaseEmbeddedContentView();
   EmbeddedContentView* OwnedEmbeddedContentView() const {
@@ -96,6 +93,7 @@
   Frame* ContentFrame() const final { return content_frame_; }
   void SetContentFrame(Frame&) final;
   void ClearContentFrame() final;
+  void AddResourceTiming(const ResourceTimingInfo&) final;
   void DispatchLoad() final;
   SandboxFlags GetSandboxFlags() const final { return sandbox_flags_; }
   bool CanRenderFallbackContent() const override { return false; }
@@ -171,7 +169,6 @@
   Member<Frame> content_frame_;
   Member<EmbeddedContentView> embedded_content_view_;
   SandboxFlags sandbox_flags_;
-  bool did_load_non_empty_document_;
 
   ParsedFeaturePolicy container_policy_;
 };
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
index 840d8f1..3dde75f6 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -326,7 +326,11 @@
 
 void HTMLSlotElement::DetachLayoutTree(const AttachContext& context) {
   if (SupportsAssignment()) {
-    for (auto& node : ChildrenInFlatTreeIfAssignmentIsSupported())
+    const HeapVector<Member<Node>>& flat_tree_children =
+        RuntimeEnabledFeatures::IncrementalShadowDOMEnabled()
+            ? assigned_nodes_
+            : distributed_nodes_;
+    for (auto& node : flat_tree_children)
       node->LazyReattachIfAttached();
   }
   HTMLElement::DetachLayoutTree(context);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
index 0b9f188..8caa621 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp
@@ -1386,7 +1386,6 @@
 static protocol::DOM::ShadowRootType GetShadowRootType(
     ShadowRoot* shadow_root) {
   switch (shadow_root->GetType()) {
-    case ShadowRootType::kLegacyUserAgentV0:
     case ShadowRootType::kUserAgentV1:
       return protocol::DOM::ShadowRootTypeEnum::UserAgent;
     case ShadowRootType::V0:
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index 9f1d8b9..933895a 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -293,11 +293,10 @@
     Clear();
     ResourceError error = ResourceError::CancelledDueToAccessCheckError(
         request.Url(), ResourceRequestBlockedReason::kOther,
-        WebCORS::GetErrorString(
-            network::mojom::CORSError::kDisallowedByMode, request.Url(),
-            WebURL(), 0 /* response_status_code */,
-            WebHTTPHeaderMap(HTTPHeaderMap()),
-            WebSecurityOrigin(GetSecurityOrigin()), request_context_));
+        CORS::GetErrorString(network::mojom::CORSError::kDisallowedByMode,
+                             request.Url(), KURL(),
+                             0 /* response_status_code */, HTTPHeaderMap(),
+                             *GetSecurityOrigin(), request_context_));
     GetExecutionContext()->AddConsoleMessage(ConsoleMessage::Create(
         kJSMessageSource, kErrorMessageLevel, error.LocalizedDescription()));
     client->DidFail(error);
@@ -699,16 +698,15 @@
       redirect_response, resource);
 
   WTF::Optional<network::mojom::CORSError> redirect_error =
-      WebCORS::CheckRedirectLocation(new_url);
+      CORS::CheckRedirectLocation(new_url);
   if (redirect_error) {
     DispatchDidFailAccessControlCheck(
         ResourceError::CancelledDueToAccessCheckError(
             original_url, ResourceRequestBlockedReason::kOther,
-            WebCORS::GetErrorString(*redirect_error, original_url, new_url,
-                                    redirect_response.HttpStatusCode(),
-                                    redirect_response.HttpHeaderFields(),
-                                    WebSecurityOrigin(GetSecurityOrigin()),
-                                    request_context_)));
+            CORS::GetErrorString(*redirect_error, original_url, new_url,
+                                 redirect_response.HttpStatusCode(),
+                                 redirect_response.HttpHeaderFields(),
+                                 *GetSecurityOrigin(), request_context_)));
     return false;
   }
 
@@ -723,11 +721,10 @@
       DispatchDidFailAccessControlCheck(
           ResourceError::CancelledDueToAccessCheckError(
               original_url, ResourceRequestBlockedReason::kOther,
-              WebCORS::GetErrorString(*access_error, original_url, new_url,
-                                      redirect_response.HttpStatusCode(),
-                                      redirect_response.HttpHeaderFields(),
-                                      WebSecurityOrigin(GetSecurityOrigin()),
-                                      request_context_)));
+              CORS::GetErrorString(*access_error, original_url, new_url,
+                                   redirect_response.HttpStatusCode(),
+                                   redirect_response.HttpHeaderFields(),
+                                   *GetSecurityOrigin(), request_context_)));
       return false;
     }
   }
@@ -851,10 +848,9 @@
     builder.Append(
         "Response to preflight request doesn't pass access "
         "control check: ");
-    builder.Append(WebCORS::GetErrorString(
-        *cors_error, response.Url(), WebURL(), response.HttpStatusCode(),
-        response.HttpHeaderFields(), WebSecurityOrigin(GetSecurityOrigin()),
-        request_context_));
+    builder.Append(CORS::GetErrorString(
+        *cors_error, response.Url(), KURL(), response.HttpStatusCode(),
+        response.HttpHeaderFields(), *GetSecurityOrigin(), request_context_));
     HandlePreflightFailure(response.Url(), builder.ToString());
     return;
   }
@@ -864,10 +860,10 @@
   if (preflight_error) {
     HandlePreflightFailure(
         response.Url(),
-        WebCORS::GetErrorString(
-            *preflight_error, response.Url(), WebURL(),
-            response.HttpStatusCode(), response.HttpHeaderFields(),
-            WebSecurityOrigin(GetSecurityOrigin()), request_context_));
+        CORS::GetErrorString(*preflight_error, response.Url(), KURL(),
+                             response.HttpStatusCode(),
+                             response.HttpHeaderFields(), *GetSecurityOrigin(),
+                             request_context_));
     return;
   }
 
@@ -877,10 +873,10 @@
     if (external_preflight_status) {
       HandlePreflightFailure(
           response.Url(),
-          WebCORS::GetErrorString(
-              *external_preflight_status, response.Url(), WebURL(),
-              response.HttpStatusCode(), response.HttpHeaderFields(),
-              WebSecurityOrigin(GetSecurityOrigin()), request_context_));
+          CORS::GetErrorString(*external_preflight_status, response.Url(),
+                               KURL(), response.HttpStatusCode(),
+                               response.HttpHeaderFields(),
+                               *GetSecurityOrigin(), request_context_));
       return;
     }
   }
@@ -970,11 +966,11 @@
       DispatchDidFailAccessControlCheck(
           ResourceError::CancelledDueToAccessCheckError(
               response.Url(), ResourceRequestBlockedReason::kOther,
-              WebCORS::GetErrorString(
-                  network::mojom::CORSError::kInvalidResponse, response.Url(),
-                  WebURL(), response.HttpStatusCode(),
-                  response.HttpHeaderFields(),
-                  WebSecurityOrigin(GetSecurityOrigin()), request_context_)));
+              CORS::GetErrorString(network::mojom::CORSError::kInvalidResponse,
+                                   response.Url(), KURL(),
+                                   response.HttpStatusCode(),
+                                   response.HttpHeaderFields(),
+                                   *GetSecurityOrigin(), request_context_)));
       return;
     }
 
@@ -1006,10 +1002,10 @@
       DispatchDidFailAccessControlCheck(
           ResourceError::CancelledDueToAccessCheckError(
               response.Url(), ResourceRequestBlockedReason::kOther,
-              WebCORS::GetErrorString(
-                  *access_error, response.Url(), WebURL(),
-                  response.HttpStatusCode(), response.HttpHeaderFields(),
-                  WebSecurityOrigin(GetSecurityOrigin()), request_context_)));
+              CORS::GetErrorString(*access_error, response.Url(), KURL(),
+                                   response.HttpStatusCode(),
+                                   response.HttpHeaderFields(),
+                                   *GetSecurityOrigin(), request_context_)));
       return;
     }
   }
@@ -1165,10 +1161,10 @@
     GetExecutionContext()->AddConsoleMessage(ConsoleMessage::Create(
         kJSMessageSource, kErrorMessageLevel,
         "Failed to load " + error.FailingURL() + ": " +
-            WebCORS::GetErrorString(
-                error.CORSErrorStatus()->cors_error, KURL(error.FailingURL()),
-                WebURL(), response_code, WebHTTPHeaderMap(HTTPHeaderMap()),
-                WebSecurityOrigin(GetSecurityOrigin()), request_context_)
+            CORS::GetErrorString(error.CORSErrorStatus()->cors_error,
+                                 KURL(error.FailingURL()), KURL(),
+                                 response_code, HTTPHeaderMap(),
+                                 *GetSecurityOrigin(), request_context_)
                 .Utf8()
                 .data()));
   }
diff --git a/third_party/WebKit/Source/core/loader/EmptyClients.h b/third_party/WebKit/Source/core/loader/EmptyClients.h
index d3f6f581..6f157d8c 100644
--- a/third_party/WebKit/Source/core/loader/EmptyClients.h
+++ b/third_party/WebKit/Source/core/loader/EmptyClients.h
@@ -289,6 +289,8 @@
   void ProgressEstimateChanged(double) override {}
   void DidStopLoading() override {}
 
+  void ForwardResourceTimingToParent(const WebResourceTimingInfo&) override {}
+
   void DownloadURL(const ResourceRequest&,
                    const String& suggested_name) override {}
   void LoadErrorPage(int reason) override {}
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 44d6ad8..5b25946 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -64,6 +64,7 @@
 #include "core/paint/FirstMeaningfulPaintDetector.h"
 #include "core/probe/CoreProbes.h"
 #include "core/svg/graphics/SVGImageChromeClient.h"
+#include "core/timing/DOMWindowPerformance.h"
 #include "core/timing/Performance.h"
 #include "core/timing/PerformanceBase.h"
 #include "platform/Histogram.h"
@@ -717,17 +718,24 @@
   // Normally, |document_| is cleared on Document shutdown. However, Documents
   // for HTML imports will also not have a LocalFrame set: in that case, also
   // early return, as there is nothing to report the resource timing to.
-  if (!document_ || !document_->GetFrame())
+  if (!document_)
+    return;
+  LocalFrame* frame = document_->GetFrame();
+  if (!frame)
     return;
 
-  Frame* initiator_frame = info.IsMainResource()
-                               ? document_->GetFrame()->Tree().Parent()
-                               : document_->GetFrame();
-
-  if (!initiator_frame)
+  if (info.IsMainResource()) {
+    DCHECK(frame->Owner());
+    // Main resource timing information is reported through the owner to be
+    // passed to the parent frame, if appropriate.
+    frame->Owner()->AddResourceTiming(info);
+    frame->DidSendResourceTimingInfoToParent();
     return;
+  }
 
-  initiator_frame->AddResourceTiming(info);
+  // All other resources are reported to the corresponding Document.
+  DOMWindowPerformance::performance(*document_->domWindow())
+      ->GenerateAndAddResourceTiming(info);
 }
 
 bool FrameFetchContext::AllowImage(bool images_enabled, const KURL& url) const {
@@ -803,16 +811,16 @@
 
   // <iframe>s should report the initial navigation requested by the parent
   // document, but not subsequent navigations.
-  // FIXME: Resource timing is broken when the parent is a remote frame.
-  if (!GetFrame()->DeprecatedLocalOwner() ||
-      GetFrame()->DeprecatedLocalOwner()->LoadedNonEmptyDocument())
+  if (!GetFrame()->Owner())
     return false;
-  GetFrame()->DeprecatedLocalOwner()->DidLoadNonEmptyDocument();
+  // Note that this can be racy since this information is forwarded over IPC
+  // when crossing process boundaries.
+  if (!GetFrame()->should_send_resource_timing_info_to_parent())
+    return false;
   // Do not report iframe navigation that restored from history, since its
   // location may have been changed after initial navigation.
   if (MasterDocumentLoader()->LoadType() == kFrameLoadTypeInitialHistoryLoad)
     return false;
-  info->SetInitiatorType(GetFrame()->DeprecatedLocalOwner()->localName());
   return true;
 }
 
diff --git a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
index 1864290d..0448661 100644
--- a/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/WorkerFetchContext.cpp
@@ -332,7 +332,7 @@
   if (global_scope_->IsWorkletGlobalScope())
     return;
   WorkerGlobalScopePerformance::performance(*ToWorkerGlobalScope(global_scope_))
-      ->AddResourceTiming(info);
+      ->GenerateAndAddResourceTiming(info);
 }
 
 void WorkerFetchContext::PopulateResourceRequest(
diff --git a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
index c63357f..bffef07 100644
--- a/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/WorkerThreadableLoader.cpp
@@ -415,7 +415,7 @@
   scoped_refptr<ResourceTimingInfo> info(
       ResourceTimingInfo::Adopt(std::move(timing_data)));
   WorkerGlobalScopePerformance::performance(*worker_global_scope_)
-      ->AddResourceTiming(*info);
+      ->GenerateAndAddResourceTiming(*info);
   client_->DidReceiveResourceTiming(*info);
 }
 
diff --git a/third_party/WebKit/Source/core/page/FocusController.cpp b/third_party/WebKit/Source/core/page/FocusController.cpp
index 859d2be..33ab688a 100644
--- a/third_party/WebKit/Source/core/page/FocusController.cpp
+++ b/third_party/WebKit/Source/core/page/FocusController.cpp
@@ -1491,8 +1491,7 @@
         starting_rect = VirtualRectForAreaElementAndDirection(*area, type);
       }
     }
-    container = ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-        type, focused_element);
+    container = ScrollableAreaOrDocumentOf(focused_element);
   }
 
   bool consumed = false;
@@ -1502,8 +1501,8 @@
     if (consumed)
       break;
 
-    container =
-        ScrollableEnclosingBoxOrParentFrameForNodeInDirection(type, container);
+    container = ScrollableAreaOrDocumentOf(container);
+
     if (container && container->IsDocumentNode())
       ToDocument(container)->UpdateStyleAndLayoutIgnorePendingStylesheets();
   }
diff --git a/third_party/WebKit/Source/core/page/SpatialNavigation.cpp b/third_party/WebKit/Source/core/page/SpatialNavigation.cpp
index 8780199d..e9fd8466 100644
--- a/third_party/WebKit/Source/core/page/SpatialNavigation.cpp
+++ b/third_party/WebKit/Source/core/page/SpatialNavigation.cpp
@@ -307,8 +307,7 @@
   return false;
 }
 
-Node* ScrollableEnclosingBoxOrParentFrameForNodeInDirection(WebFocusType type,
-                                                            Node* node) {
+Node* ScrollableAreaOrDocumentOf(Node* node) {
   DCHECK(node);
   Node* parent = node;
   do {
@@ -317,11 +316,21 @@
       parent = ToDocument(parent)->GetFrame()->DeprecatedLocalOwner();
     else
       parent = parent->ParentOrShadowHostNode();
-  } while (parent && !IsNavigableContainer(parent, type));
+  } while (parent && !IsScrollableAreaOrDocument(parent));
 
   return parent;
 }
 
+bool IsScrollableAreaOrDocument(const Node* node) {
+  if (!node)
+    return false;
+
+  return node->IsDocumentNode() ||
+         (node->IsFrameOwnerElement() &&
+          ToHTMLFrameOwnerElement(node)->ContentFrame()) ||
+         IsScrollableNode(node);
+}
+
 bool IsNavigableContainer(const Node* node, WebFocusType type) {
   if (!node)
     return false;
diff --git a/third_party/WebKit/Source/core/page/SpatialNavigation.h b/third_party/WebKit/Source/core/page/SpatialNavigation.h
index b73549d..09d17f9 100644
--- a/third_party/WebKit/Source/core/page/SpatialNavigation.h
+++ b/third_party/WebKit/Source/core/page/SpatialNavigation.h
@@ -132,6 +132,8 @@
 bool ScrollInDirection(LocalFrame*, WebFocusType);
 bool ScrollInDirection(Node* container, WebFocusType);
 bool IsNavigableContainer(const Node*, WebFocusType);
+CORE_EXPORT bool IsScrollableAreaOrDocument(const Node*);
+CORE_EXPORT Node* ScrollableAreaOrDocumentOf(Node*);
 bool CanScrollInDirection(const Node* container, WebFocusType);
 bool CanScrollInDirection(const LocalFrame*, WebFocusType);
 bool CanBeScrolledIntoView(WebFocusType, const FocusCandidate&);
@@ -140,9 +142,6 @@
 void DistanceDataForNode(WebFocusType,
                          const FocusCandidate& current,
                          FocusCandidate&);
-CORE_EXPORT Node* ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-    WebFocusType,
-    Node*);
 LayoutRect NodeRectInAbsoluteCoordinates(Node*, bool ignore_border = false);
 LayoutRect FrameRectInAbsoluteCoordinates(LocalFrame*);
 LayoutRect VirtualRectForDirection(WebFocusType,
diff --git a/third_party/WebKit/Source/core/page/SpatialNavigationTest.cpp b/third_party/WebKit/Source/core/page/SpatialNavigationTest.cpp
index 78834acf..db4f673 100644
--- a/third_party/WebKit/Source/core/page/SpatialNavigationTest.cpp
+++ b/third_party/WebKit/Source/core/page/SpatialNavigationTest.cpp
@@ -18,15 +18,13 @@
 TEST_F(SpatialNavigationTest, FindContainerWhenEnclosingContainerIsDocument) {
   SetBodyInnerHTML(
       "<!DOCTYPE html>"
-      "<div id='child'></div>");
+      "<a id='child'>link</a>");
 
   Element* child_element = GetDocument().getElementById("child");
-
-  Node* enclosing_container =
-      ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-          WebFocusType::kWebFocusTypeDown, child_element);
+  Node* enclosing_container = ScrollableAreaOrDocumentOf(child_element);
 
   EXPECT_EQ(enclosing_container, GetDocument());
+  EXPECT_TRUE(IsScrollableAreaOrDocument(enclosing_container));
 }
 
 TEST_F(SpatialNavigationTest, FindContainerWhenEnclosingContainerIsIframe) {
@@ -47,16 +45,14 @@
       "    height: 1000px;"
       "  }"
       "</style>"
-      "<div id='child'></div>");
+      "<a id='child'>link</a>");
+
   ChildDocument().View()->UpdateAllLifecyclePhases();
-
   Element* child_element = ChildDocument().getElementById("child");
-
-  Node* enclosing_container =
-      ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-          WebFocusType::kWebFocusTypeDown, child_element);
+  Node* enclosing_container = ScrollableAreaOrDocumentOf(child_element);
 
   EXPECT_EQ(enclosing_container, ChildDocument());
+  EXPECT_TRUE(IsScrollableAreaOrDocument(enclosing_container));
 }
 
 TEST_F(SpatialNavigationTest,
@@ -65,49 +61,24 @@
   SetBodyInnerHTML(
       "<!DOCTYPE html>"
       "<style>"
-      "  #child {"
-      "    height: 1000px;"
+      "  #content {"
+      "    margin-top: 600px;"
       "  }"
       "  #container {"
-      "    width: 100%;"
-      "    height: 100%;"
+      "    height: 100px;"
       "    overflow-y: scroll;"
       "  }"
       "</style>"
       "<div id='container'>"
-      "  <div id='child'></div>"
+      "  <div id='content'>some text here</div>"
       "</div>");
 
-  {
-    // <div id='container'> should be selected as container because
-    // it is scrollable in direction.
-    Element* child_element = GetDocument().getElementById("child");
-    Element* container_element = GetDocument().getElementById("container");
+  Element* content_element = GetDocument().getElementById("content");
+  Element* container_element = GetDocument().getElementById("container");
+  Node* enclosing_container = ScrollableAreaOrDocumentOf(content_element);
 
-    Node* enclosing_container =
-        ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-            WebFocusType::kWebFocusTypeDown, child_element);
-    EXPECT_EQ(enclosing_container, container_element);
-  }
-
-  {
-    // In following cases(up, left, right), <div id='container'> cannot be
-    // container because it is not scrollable in direction.
-    Element* child_element = GetDocument().getElementById("child");
-
-    Node* enclosing_container =
-        ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-            WebFocusType::kWebFocusTypeUp, child_element);
-    EXPECT_EQ(enclosing_container, GetDocument());
-
-    enclosing_container = ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-        WebFocusType::kWebFocusTypeLeft, child_element);
-    EXPECT_EQ(enclosing_container, GetDocument());
-
-    enclosing_container = ScrollableEnclosingBoxOrParentFrameForNodeInDirection(
-        WebFocusType::kWebFocusTypeRight, child_element);
-    EXPECT_EQ(enclosing_container, GetDocument());
-  }
+  EXPECT_EQ(enclosing_container, container_element);
+  EXPECT_TRUE(IsScrollableAreaOrDocument(enclosing_container));
 }
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/BoxModelObjectPainter.cpp b/third_party/WebKit/Source/core/paint/BoxModelObjectPainter.cpp
index 5773b18..5ffba0b 100644
--- a/third_party/WebKit/Source/core/paint/BoxModelObjectPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxModelObjectPainter.cpp
@@ -89,10 +89,10 @@
   GraphicsContextStateSaver background_clip_state_saver(context, false);
   background_clip_state_saver.Save();
   context.Clip(mask_rect);
-  context.BeginLayer();
+  context.BeginLayer(1, composite_op);
 
-  PaintFillLayerBackground(context, info, image, composite_op, geometry,
-                           scrolled_paint_rect);
+  PaintFillLayerBackground(context, info, image, SkBlendMode::kSrcOver,
+                           geometry, scrolled_paint_rect);
 
   // Create the text mask layer and draw the text into the mask. We do this by
   // painting using a special paint phase that signals to InlineTextBoxes that
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 9dc01dd..59d1b7d 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -792,7 +792,6 @@
   }
 
   switch (ToShadowRoot(root)->GetType()) {
-    case ShadowRootType::kLegacyUserAgentV0:
     case ShadowRootType::kUserAgentV1:
       return String("UserAgentShadowRoot");
     case ShadowRootType::V0:
diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp
index 4f4cccde..2295bc8 100644
--- a/third_party/WebKit/Source/core/timing/Performance.cpp
+++ b/third_party/WebKit/Source/core/timing/Performance.cpp
@@ -149,14 +149,13 @@
   ResourceTimingInfo* info = document_loader->GetNavigationTimingInfo();
   if (!info)
     return nullptr;
-  PerformanceServerTimingVector serverTiming =
+  WebVector<WebServerTimingInfo> server_timing =
       PerformanceServerTiming::ParseServerTiming(
           *info, PerformanceServerTiming::ShouldAllowTimingDetails::Yes);
-  if (serverTiming.size()) {
+  if (!server_timing.empty())
     UseCounter::Count(GetFrame(), WebFeature::kPerformanceServerTiming);
-  }
   return new PerformanceNavigationTiming(GetFrame(), info, GetTimeOrigin(),
-                                         serverTiming);
+                                         server_timing);
 }
 
 void Performance::UpdateLongTaskInstrumentation() {
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index 3cb4ac4..fe89486 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -320,58 +320,84 @@
   return true;
 }
 
-void PerformanceBase::AddResourceTiming(const ResourceTimingInfo& info) {
+void PerformanceBase::GenerateAndAddResourceTiming(
+    const ResourceTimingInfo& info,
+    const AtomicString& initiator_type) {
   if (IsResourceTimingBufferFull() &&
       !HasObserverFor(PerformanceEntry::kResource))
     return;
+
   ExecutionContext* context = GetExecutionContext();
   const SecurityOrigin* security_origin = GetSecurityOrigin(context);
   if (!security_origin)
     return;
+  AddResourceTiming(
+      GenerateResourceTiming(*security_origin, info, *context),
+      !initiator_type.IsNull() ? initiator_type : info.InitiatorType());
+}
 
+WebResourceTimingInfo PerformanceBase::GenerateResourceTiming(
+    const SecurityOrigin& destination_origin,
+    const ResourceTimingInfo& info,
+    ExecutionContext& context_for_use_counter) {
+  // TODO(dcheng): It would be nicer if the performance entries simply held this
+  // data internally, rather than requiring it be marshalled back and forth.
   const ResourceResponse& final_response = info.FinalResponse();
-  bool allow_timing_details =
-      PassesTimingAllowCheck(final_response, *security_origin,
-                             info.OriginalTimingAllowOrigin(), context);
-  double start_time = info.InitialTime();
+  WebResourceTimingInfo result;
+  result.name = info.InitialURL().GetString();
+  result.start_time = info.InitialTime();
+  result.alpn_negotiated_protocol = final_response.AlpnNegotiatedProtocol();
+  result.connection_info = final_response.ConnectionInfoString();
+  result.timing = final_response.GetResourceLoadTiming();
+  result.finish_time = info.LoadFinishTime();
 
-  PerformanceServerTimingVector serverTiming =
-      PerformanceServerTiming::ParseServerTiming(
-          info, allow_timing_details
-                    ? PerformanceServerTiming::ShouldAllowTimingDetails::Yes
-                    : PerformanceServerTiming::ShouldAllowTimingDetails::No);
-  if (serverTiming.size()) {
-    UseCounter::Count(context, WebFeature::kPerformanceServerTiming);
-  }
-
-  if (info.RedirectChain().IsEmpty()) {
-    PerformanceEntry* entry = PerformanceResourceTiming::Create(
-        info, GetTimeOrigin(), start_time, allow_timing_details, serverTiming);
-    NotifyObserversOfEntry(*entry);
-    if (!IsResourceTimingBufferFull())
-      AddResourceTimingBuffer(*entry);
-    return;
-  }
+  result.allow_timing_details = PassesTimingAllowCheck(
+      final_response, destination_origin, info.OriginalTimingAllowOrigin(),
+      &context_for_use_counter);
 
   const Vector<ResourceResponse>& redirect_chain = info.RedirectChain();
-  bool allow_redirect_details = AllowsTimingRedirect(
-      redirect_chain, final_response, *security_origin, context);
+  if (!redirect_chain.IsEmpty()) {
+    result.allow_redirect_details =
+        AllowsTimingRedirect(redirect_chain, final_response, destination_origin,
+                             &context_for_use_counter);
 
-  if (!allow_redirect_details) {
-    ResourceLoadTiming* final_timing = final_response.GetResourceLoadTiming();
-    DCHECK(final_timing);
-    if (final_timing)
-      start_time = final_timing->RequestTime();
+    result.last_redirect_end_time =
+        redirect_chain.back().GetResourceLoadTiming()->ReceiveHeadersEnd();
+
+    if (!result.allow_redirect_details) {
+      result.start_time = final_response.GetResourceLoadTiming()->RequestTime();
+    }
+  } else {
+    result.allow_redirect_details = false;
+    result.last_redirect_end_time = 0.0;
   }
 
-  ResourceLoadTiming* last_redirect_timing =
-      redirect_chain.back().GetResourceLoadTiming();
-  CHECK(last_redirect_timing);
-  double last_redirect_end_time = last_redirect_timing->ReceiveHeadersEnd();
+  result.transfer_size = info.TransferSize();
+  result.encoded_body_size = final_response.EncodedBodyLength();
+  result.decoded_body_size = final_response.DecodedBodyLength();
+  result.did_reuse_connection = final_response.ConnectionReused();
+  result.allow_negative_values = info.NegativeAllowed();
 
-  PerformanceEntry* entry = PerformanceResourceTiming::Create(
-      info, GetTimeOrigin(), start_time, last_redirect_end_time,
-      allow_timing_details, allow_redirect_details, serverTiming);
+  result.server_timing = PerformanceServerTiming::ParseServerTiming(
+      info, result.allow_timing_details
+                ? PerformanceServerTiming::ShouldAllowTimingDetails::Yes
+                : PerformanceServerTiming::ShouldAllowTimingDetails::No);
+  if (!result.server_timing.empty()) {
+    UseCounter::Count(&context_for_use_counter,
+                      WebFeature::kPerformanceServerTiming);
+  }
+
+  return result;
+}
+
+void PerformanceBase::AddResourceTiming(const WebResourceTimingInfo& info,
+                                        const AtomicString& initiator_type) {
+  if (IsResourceTimingBufferFull() &&
+      !HasObserverFor(PerformanceEntry::kResource))
+    return;
+
+  PerformanceEntry* entry =
+      PerformanceResourceTiming::Create(info, GetTimeOrigin(), initiator_type);
   NotifyObserversOfEntry(*entry);
   if (!IsResourceTimingBufferFull())
     AddResourceTimingBuffer(*entry);
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.h b/third_party/WebKit/Source/core/timing/PerformanceBase.h
index 8729126..760f51fde 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.h
@@ -46,6 +46,7 @@
 #include "platform/wtf/HashSet.h"
 #include "platform/wtf/LinkedHashSet.h"
 #include "platform/wtf/Vector.h"
+#include "public/platform/WebResourceTimingInfo.h"
 
 namespace blink {
 
@@ -117,7 +118,21 @@
       const String& culprit_frame_name,
       const SubTaskAttribution::EntriesVector& sub_task_attributions);
 
-  void AddResourceTiming(const ResourceTimingInfo&);
+  // Generates and add a performance entry for the given ResourceTimingInfo.
+  // |overridden_initiator_type| allows the initiator type to be overridden to
+  // the frame element name for the main resource.
+  void GenerateAndAddResourceTiming(
+      const ResourceTimingInfo&,
+      const AtomicString& overridden_initiator_type = g_null_atom);
+  // Generates timing info suitable for appending to the performance entries of
+  // a context with |origin|. This should be rarely used; most callsites should
+  // prefer the convenience method |GenerateAndAddResourceTiming()|.
+  static WebResourceTimingInfo GenerateResourceTiming(
+      const SecurityOrigin& destination_origin,
+      const ResourceTimingInfo&,
+      ExecutionContext& context_for_use_counter);
+  void AddResourceTiming(const WebResourceTimingInfo&,
+                         const AtomicString& initiator_type = g_null_atom);
 
   void NotifyNavigationTimingToObservers();
 
diff --git a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
index 14ef9f4..025b192 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.cpp
@@ -20,13 +20,11 @@
     LocalFrame* frame,
     ResourceTimingInfo* info,
     double time_origin,
-    PerformanceServerTimingVector& serverTiming)
+    const WebVector<WebServerTimingInfo>& server_timing)
     : PerformanceResourceTiming(info ? info->InitialURL().GetString() : "",
                                 "navigation",
                                 time_origin,
-                                0.0,
-                                0.0,
-                                serverTiming),
+                                server_timing),
       ContextClient(frame),
       resource_timing_info_(info) {
   DCHECK(frame);
diff --git a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h
index 82d8eeb..7b6e5e4 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceNavigationTiming.h
@@ -33,7 +33,7 @@
   PerformanceNavigationTiming(LocalFrame*,
                               ResourceTimingInfo*,
                               double time_origin,
-                              PerformanceServerTimingVector&);
+                              const WebVector<WebServerTimingInfo>&);
 
   // Attributes inheritted from PerformanceEntry.
   DOMHighResTimeStamp duration() const override;
diff --git a/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp b/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp
index 6f2be26b..3c61a03 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceObserver.cpp
@@ -96,6 +96,12 @@
   is_registered_ = false;
 }
 
+PerformanceEntryVector PerformanceObserver::takeRecords() {
+  PerformanceEntryVector performance_entries;
+  performance_entries.swap(performance_entries_);
+  return performance_entries;
+}
+
 void PerformanceObserver::EnqueuePerformanceEntry(PerformanceEntry& entry) {
   performance_entries_.push_back(&entry);
   if (performance_)
diff --git a/third_party/WebKit/Source/core/timing/PerformanceObserver.h b/third_party/WebKit/Source/core/timing/PerformanceObserver.h
index 73c3879..1c9ce16a 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceObserver.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceObserver.h
@@ -41,6 +41,7 @@
 
   void observe(const PerformanceObserverInit&, ExceptionState&);
   void disconnect();
+  PerformanceEntryVector takeRecords();
   void EnqueuePerformanceEntry(PerformanceEntry&);
   PerformanceEntryTypeMask FilterOptions() const { return filter_options_; }
 
diff --git a/third_party/WebKit/Source/core/timing/PerformanceObserver.idl b/third_party/WebKit/Source/core/timing/PerformanceObserver.idl
index d556573..c16e1a2 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceObserver.idl
+++ b/third_party/WebKit/Source/core/timing/PerformanceObserver.idl
@@ -14,4 +14,5 @@
 ] interface PerformanceObserver {
     [RaisesException] void observe(PerformanceObserverInit options);
     void disconnect();
+    PerformanceEntryList takeRecords();
 };
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
index 0e22f34..c3fe94a 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
@@ -36,54 +36,53 @@
 #include "platform/loader/fetch/ResourceRequest.h"
 #include "platform/loader/fetch/ResourceResponse.h"
 #include "platform/loader/fetch/ResourceTimingInfo.h"
+#include "public/platform/WebResourceTimingInfo.h"
 
 namespace blink {
 
 PerformanceResourceTiming::PerformanceResourceTiming(
-    const ResourceTimingInfo& info,
+    const WebResourceTimingInfo& info,
     double time_origin,
-    double start_time,
-    double last_redirect_end_time,
-    bool allow_timing_details,
-    bool allow_redirect_details,
-    PerformanceServerTimingVector& serverTiming)
-    : PerformanceEntry(info.InitialURL().GetString(),
+    const AtomicString& initiator_type)
+    : PerformanceEntry(info.name,
                        "resource",
                        PerformanceBase::MonotonicTimeToDOMHighResTimeStamp(
                            time_origin,
-                           start_time,
-                           info.NegativeAllowed()),
+                           info.start_time,
+                           info.allow_negative_values),
                        PerformanceBase::MonotonicTimeToDOMHighResTimeStamp(
                            time_origin,
-                           info.LoadFinishTime(),
-                           info.NegativeAllowed())),
-      initiator_type_(info.InitiatorType()),
-      alpn_negotiated_protocol_(info.FinalResponse().AlpnNegotiatedProtocol()),
-      connection_info_(info.FinalResponse().ConnectionInfoString()),
+                           info.finish_time,
+                           info.allow_negative_values)),
+      initiator_type_(initiator_type),
+      alpn_negotiated_protocol_(
+          static_cast<String>(info.alpn_negotiated_protocol)),
+      connection_info_(static_cast<String>(info.connection_info)),
       time_origin_(time_origin),
-      timing_(info.FinalResponse().GetResourceLoadTiming()),
-      last_redirect_end_time_(last_redirect_end_time),
-      finish_time_(info.LoadFinishTime()),
-      transfer_size_(info.TransferSize()),
-      encoded_body_size_(info.FinalResponse().EncodedBodyLength()),
-      decoded_body_size_(info.FinalResponse().DecodedBodyLength()),
-      did_reuse_connection_(info.FinalResponse().ConnectionReused()),
-      allow_timing_details_(allow_timing_details),
-      allow_redirect_details_(allow_redirect_details),
-      allow_negative_value_(info.NegativeAllowed()),
-      serverTiming_(serverTiming) {}
+      timing_(info.timing),
+      last_redirect_end_time_(info.last_redirect_end_time),
+      finish_time_(info.finish_time),
+      transfer_size_(info.transfer_size),
+      encoded_body_size_(info.encoded_body_size),
+      decoded_body_size_(info.decoded_body_size),
+      did_reuse_connection_(info.did_reuse_connection),
+      allow_timing_details_(info.allow_timing_details),
+      allow_redirect_details_(info.allow_redirect_details),
+      allow_negative_value_(info.allow_negative_values),
+      server_timing_(
+          PerformanceServerTiming::FromParsedServerTiming(info.server_timing)) {
+}
 
 // This constructor is for PerformanceNavigationTiming.
 PerformanceResourceTiming::PerformanceResourceTiming(
     const String& name,
     const String& entry_type,
     double time_origin,
-    double start_time,
-    double duration,
-    PerformanceServerTimingVector& serverTiming)
-    : PerformanceEntry(name, entry_type, start_time, duration),
+    const WebVector<WebServerTimingInfo>& server_timing)
+    : PerformanceEntry(name, entry_type, 0.0, 0.0),
       time_origin_(time_origin),
-      serverTiming_(serverTiming) {}
+      server_timing_(
+          PerformanceServerTiming::FromParsedServerTiming(server_timing)) {}
 
 PerformanceResourceTiming::~PerformanceResourceTiming() = default;
 
@@ -314,8 +313,9 @@
   return GetDecodedBodySize();
 }
 
-PerformanceServerTimingVector PerformanceResourceTiming::serverTiming() const {
-  return serverTiming_;
+const HeapVector<Member<PerformanceServerTiming>>&
+PerformanceResourceTiming::serverTiming() const {
+  return server_timing_;
 }
 
 void PerformanceResourceTiming::BuildJSONValue(V8ObjectBuilder& builder) const {
@@ -338,16 +338,17 @@
   builder.AddNumber("encodedBodySize", encodedBodySize());
   builder.AddNumber("decodedBodySize", decodedBodySize());
 
-  Vector<ScriptValue> serverTiming;
-  for (unsigned i = 0; i < serverTiming_.size(); i++) {
-    serverTiming.push_back(
-        serverTiming_[i]->toJSONForBinding(builder.GetScriptState()));
+  Vector<ScriptValue> server_timing;
+  server_timing.ReserveCapacity(server_timing_.size());
+  for (unsigned i = 0; i < server_timing_.size(); i++) {
+    server_timing.push_back(
+        server_timing_[i]->toJSONForBinding(builder.GetScriptState()));
   }
-  builder.Add("serverTiming", serverTiming);
+  builder.Add("serverTiming", server_timing);
 }
 
 void PerformanceResourceTiming::Trace(blink::Visitor* visitor) {
-  visitor->Trace(serverTiming_);
+  visitor->Trace(server_timing_);
   PerformanceEntry::Trace(visitor);
 }
 
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h
index 621f7896..d69b44e0 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.h
@@ -41,7 +41,7 @@
 namespace blink {
 
 class ResourceLoadTiming;
-class ResourceTimingInfo;
+struct WebResourceTimingInfo;
 
 class CORE_EXPORT PerformanceResourceTiming : public PerformanceEntry {
   DEFINE_WRAPPERTYPEINFO();
@@ -50,28 +50,12 @@
  public:
   ~PerformanceResourceTiming() override;
   static PerformanceResourceTiming* Create(
-      const ResourceTimingInfo& info,
+      const WebResourceTimingInfo& info,
       double time_origin,
-      double start_time,
-      double last_redirect_end_time,
-      bool allow_timing_details,
-      bool allow_redirect_details,
-      PerformanceServerTimingVector& serverTiming) {
-    return new PerformanceResourceTiming(
-        info, time_origin, start_time, last_redirect_end_time,
-        allow_timing_details, allow_redirect_details, serverTiming);
+      const AtomicString& initiator_type = g_null_atom) {
+    return new PerformanceResourceTiming(info, time_origin, initiator_type);
   }
 
-  static PerformanceResourceTiming* Create(
-      const ResourceTimingInfo& info,
-      double time_origin,
-      double start_time,
-      bool allow_timing_details,
-      PerformanceServerTimingVector& serverTiming) {
-    return new PerformanceResourceTiming(info, time_origin, start_time, 0.0,
-                                         allow_timing_details, false,
-                                         serverTiming);
-  }
   // Related doc: https://goo.gl/uNecAj.
   virtual AtomicString initiatorType() const;
   AtomicString nextHopProtocol() const;
@@ -90,7 +74,7 @@
   unsigned long long transferSize() const;
   unsigned long long encodedBodySize() const;
   unsigned long long decodedBodySize() const;
-  PerformanceServerTimingVector serverTiming() const;
+  const HeapVector<Member<PerformanceServerTiming>>& serverTiming() const;
 
   virtual void Trace(blink::Visitor*);
 
@@ -102,9 +86,7 @@
   PerformanceResourceTiming(const String& name,
                             const String& entry_type,
                             double time_origin,
-                            double start_time,
-                            double duration,
-                            PerformanceServerTimingVector&);
+                            const WebVector<WebServerTimingInfo>&);
   virtual AtomicString AlpnNegotiatedProtocol() const;
   virtual AtomicString ConnectionInfo() const;
 
@@ -112,13 +94,9 @@
   double TimeOrigin() const { return time_origin_; }
 
  private:
-  PerformanceResourceTiming(const ResourceTimingInfo&,
+  PerformanceResourceTiming(const WebResourceTimingInfo&,
                             double time_origin,
-                            double start_time,
-                            double last_redirect_end_time,
-                            bool allow_timing_details,
-                            bool allow_redirect_details,
-                            PerformanceServerTimingVector&);
+                            const AtomicString& initiator_type);
 
   static AtomicString GetNextHopProtocol(
       const AtomicString& alpn_negotiated_protocol,
@@ -147,7 +125,7 @@
   bool allow_timing_details_;
   bool allow_redirect_details_;
   bool allow_negative_value_;
-  PerformanceServerTimingVector serverTiming_;
+  HeapVector<Member<PerformanceServerTiming>> server_timing_;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/timing/PerformanceServerTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceServerTiming.cpp
index ed8d449..9316641 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceServerTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceServerTiming.cpp
@@ -10,33 +10,13 @@
 
 namespace blink {
 
-PerformanceServerTiming::PerformanceServerTiming(
-    const String& name,
-    double duration,
-    const String& description,
-    ShouldAllowTimingDetails shouldAllowTimingDetails)
-    : name_(name),
-      duration_(duration),
-      description_(description),
-      shouldAllowTimingDetails_(shouldAllowTimingDetails) {}
+PerformanceServerTiming::PerformanceServerTiming(const String& name,
+                                                 double duration,
+                                                 const String& description)
+    : name_(name), duration_(duration), description_(description) {}
 
 PerformanceServerTiming::~PerformanceServerTiming() = default;
 
-String PerformanceServerTiming::name() const {
-  return name_;
-}
-
-double PerformanceServerTiming::duration() const {
-  return shouldAllowTimingDetails_ == ShouldAllowTimingDetails::Yes ? duration_
-                                                                    : 0.0;
-}
-
-String PerformanceServerTiming::description() const {
-  return shouldAllowTimingDetails_ == ShouldAllowTimingDetails::Yes
-             ? description_
-             : "";
-}
-
 ScriptValue PerformanceServerTiming::toJSONForBinding(
     ScriptState* script_state) const {
   V8ObjectBuilder builder(script_state);
@@ -46,21 +26,36 @@
   return builder.GetScriptValue();
 }
 
-PerformanceServerTimingVector PerformanceServerTiming::ParseServerTiming(
+WebVector<WebServerTimingInfo> PerformanceServerTiming::ParseServerTiming(
     const ResourceTimingInfo& info,
-    ShouldAllowTimingDetails shouldAllowTimingDetails) {
-  PerformanceServerTimingVector entries;
+    ShouldAllowTimingDetails should_allow_timing_details) {
+  WebVector<WebServerTimingInfo> result;
   if (RuntimeEnabledFeatures::ServerTimingEnabled()) {
     const ResourceResponse& response = info.FinalResponse();
     std::unique_ptr<ServerTimingHeaderVector> headers = ParseServerTimingHeader(
         response.HttpHeaderField(HTTPNames::Server_Timing));
+    result.reserve(headers->size());
     for (const auto& header : *headers) {
-      entries.push_back(new PerformanceServerTiming(
-          header->Name(), header->Duration(), header->Description(),
-          shouldAllowTimingDetails));
+      if (should_allow_timing_details == ShouldAllowTimingDetails::Yes) {
+        result.emplace_back(header->Name(), header->Duration(),
+                            header->Description());
+      } else {
+        result.emplace_back(header->Name(), 0.0, String());
+      }
     }
   }
-  return entries;
+  return result;
+}
+
+HeapVector<Member<PerformanceServerTiming>>
+PerformanceServerTiming::FromParsedServerTiming(
+    const WebVector<WebServerTimingInfo>& entries) {
+  HeapVector<Member<PerformanceServerTiming>> result;
+  for (const auto& entry : entries) {
+    result.push_back(new PerformanceServerTiming(entry.name, entry.duration,
+                                                 entry.description));
+  }
+  return result;
 }
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/timing/PerformanceServerTiming.h b/third_party/WebKit/Source/core/timing/PerformanceServerTiming.h
index e9fab0ff..50724039 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceServerTiming.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceServerTiming.h
@@ -8,15 +8,14 @@
 #include "bindings/core/v8/V8ObjectBuilder.h"
 #include "platform/bindings/ScriptWrappable.h"
 #include "platform/wtf/text/WTFString.h"
+#include "public/platform/WebResourceTimingInfo.h"
+#include "public/platform/WebVector.h"
 
 namespace blink {
 
 class ResourceTimingInfo;
 class PerformanceServerTiming;
 
-using PerformanceServerTimingVector =
-    HeapVector<Member<PerformanceServerTiming>>;
-
 class CORE_EXPORT PerformanceServerTiming final : public ScriptWrappable {
   DEFINE_WRAPPERTYPEINFO();
 
@@ -26,27 +25,28 @@
     No,
   };
 
-  PerformanceServerTiming(const String& name,
-                          double duration,
-                          const String& description,
-                          ShouldAllowTimingDetails);
   ~PerformanceServerTiming();
 
-  String name() const;
-  double duration() const;
-  String description() const;
+  const String& name() const { return name_; }
+  double duration() const { return duration_; }
+  const String& description() const { return description_; }
 
-  static PerformanceServerTimingVector ParseServerTiming(
+  static WebVector<WebServerTimingInfo> ParseServerTiming(
       const ResourceTimingInfo&,
       ShouldAllowTimingDetails);
+  static HeapVector<Member<PerformanceServerTiming>> FromParsedServerTiming(
+      const WebVector<WebServerTimingInfo>&);
 
   ScriptValue toJSONForBinding(ScriptState*) const;
 
  private:
+  PerformanceServerTiming(const String& name,
+                          double duration,
+                          const String& description);
+
   const String name_;
   double duration_;
   const String description_;
-  ShouldAllowTimingDetails shouldAllowTimingDetails_;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
index 0433f8d..cf2bf872 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp
@@ -347,6 +347,8 @@
 
   if (IsHTMLSummaryElement(*GetNode())) {
     ContainerNode* parent = FlatTreeTraversal::Parent(*GetNode());
+    if (parent && IsHTMLSlotElement(parent))
+      parent = FlatTreeTraversal::Parent(*parent);
     if (parent && IsHTMLDetailsElement(parent))
       return kDisclosureTriangleRole;
     return kUnknownRole;
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.cpp
index ba5c85a..0f6d75d 100644
--- a/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.cpp
+++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.cpp
@@ -4,13 +4,18 @@
 
 #include "modules/credentialmanager/CredentialManagerTypeConverters.h"
 
+#include <algorithm>
+#include <utility>
+
 #include "bindings/core/v8/array_buffer_or_array_buffer_view.h"
 #include "modules/credentialmanager/Credential.h"
 #include "modules/credentialmanager/FederatedCredential.h"
 #include "modules/credentialmanager/MakePublicKeyCredentialOptions.h"
 #include "modules/credentialmanager/PasswordCredential.h"
 #include "modules/credentialmanager/PublicKeyCredential.h"
+#include "modules/credentialmanager/PublicKeyCredentialDescriptor.h"
 #include "modules/credentialmanager/PublicKeyCredentialParameters.h"
+#include "modules/credentialmanager/PublicKeyCredentialRequestOptions.h"
 #include "modules/credentialmanager/PublicKeyCredentialRpEntity.h"
 #include "modules/credentialmanager/PublicKeyCredentialUserEntity.h"
 #include "platform/wtf/Time.h"
@@ -19,6 +24,13 @@
 // Time to wait for an authenticator to successfully complete an operation.
 constexpr TimeDelta kAdjustedTimeoutLower = TimeDelta::FromMinutes(1);
 constexpr TimeDelta kAdjustedTimeoutUpper = TimeDelta::FromMinutes(2);
+
+WTF::TimeDelta AdjustTimeout(uint32_t timeout) {
+  WTF::TimeDelta adjusted_timeout;
+  adjusted_timeout = WTF::TimeDelta::FromMilliseconds(timeout);
+  return std::max(kAdjustedTimeoutLower,
+                  std::min(kAdjustedTimeoutUpper, adjusted_timeout));
+}
 }  // namespace
 
 namespace mojo {
@@ -29,12 +41,15 @@
 using password_manager::mojom::blink::CredentialManagerError;
 using webauth::mojom::blink::AuthenticatorStatus;
 using webauth::mojom::blink::MakePublicKeyCredentialOptionsPtr;
+using webauth::mojom::blink::PublicKeyCredentialDescriptor;
+using webauth::mojom::blink::PublicKeyCredentialDescriptorPtr;
 using webauth::mojom::blink::PublicKeyCredentialRpEntity;
 using webauth::mojom::blink::PublicKeyCredentialRpEntityPtr;
 using webauth::mojom::blink::PublicKeyCredentialUserEntity;
 using webauth::mojom::blink::PublicKeyCredentialUserEntityPtr;
 using webauth::mojom::blink::PublicKeyCredentialParameters;
 using webauth::mojom::blink::PublicKeyCredentialParametersPtr;
+using webauth::mojom::blink::PublicKeyCredentialRequestOptionsPtr;
 using webauth::mojom::blink::PublicKeyCredentialType;
 using webauth::mojom::blink::AuthenticatorTransport;
 
@@ -95,10 +110,16 @@
       return CredentialManagerError::UNKNOWN;
     case webauth::mojom::blink::AuthenticatorStatus::PENDING_REQUEST:
       return CredentialManagerError::PENDING_REQUEST;
+    case webauth::mojom::blink::AuthenticatorStatus::INVALID_DOMAIN:
+      return CredentialManagerError::INVALID_DOMAIN;
+    case webauth::mojom::blink::AuthenticatorStatus::TIMED_OUT:
+      return CredentialManagerError::TIMED_OUT;
+    case webauth::mojom::blink::AuthenticatorStatus::NOT_IMPLEMENTED:
+      return CredentialManagerError::NOT_IMPLEMENTED;
     case webauth::mojom::blink::AuthenticatorStatus::SUCCESS:
       NOTREACHED();
       break;
-  };
+  }
 
   NOTREACHED();
   return CredentialManagerError::UNKNOWN;
@@ -165,7 +186,9 @@
               blink::PublicKeyCredentialRpEntity>::
     Convert(const blink::PublicKeyCredentialRpEntity& rp) {
   auto entity = webauth::mojom::blink::PublicKeyCredentialRpEntity::New();
-  entity->id = rp.id();
+  if (rp.hasId()) {
+    entity->id = rp.id();
+  }
   entity->name = rp.name();
   if (rp.hasIcon()) {
     entity->icon = blink::KURL(blink::KURL(), rp.icon());
@@ -174,6 +197,25 @@
 }
 
 // static
+PublicKeyCredentialDescriptorPtr
+TypeConverter<PublicKeyCredentialDescriptorPtr,
+              blink::PublicKeyCredentialDescriptor>::
+    Convert(const blink::PublicKeyCredentialDescriptor& descriptor) {
+  auto mojo_descriptor =
+      webauth::mojom::blink::PublicKeyCredentialDescriptor::New();
+
+  mojo_descriptor->type = ConvertTo<PublicKeyCredentialType>(descriptor.type());
+  mojo_descriptor->id = ConvertTo<Vector<uint8_t>>(descriptor.id());
+  if (descriptor.hasTransports()) {
+    for (const auto& transport : descriptor.transports()) {
+      mojo_descriptor->transports.push_back(
+          ConvertTo<AuthenticatorTransport>(transport));
+    }
+  }
+  return mojo_descriptor;
+}
+
+// static
 PublicKeyCredentialParametersPtr
 TypeConverter<PublicKeyCredentialParametersPtr,
               blink::PublicKeyCredentialParameters>::
@@ -205,11 +247,7 @@
 
   // Step 4 of https://w3c.github.io/webauthn/#createCredential
   if (options.hasTimeout()) {
-    WTF::TimeDelta adjusted_timeout;
-    adjusted_timeout = WTF::TimeDelta::FromMilliseconds(options.timeout());
-    mojo_options->adjusted_timeout =
-        std::max(kAdjustedTimeoutLower,
-                 std::min(kAdjustedTimeoutUpper, adjusted_timeout));
+    mojo_options->adjusted_timeout = AdjustTimeout(options.timeout());
   } else {
     mojo_options->adjusted_timeout = kAdjustedTimeoutLower;
   }
@@ -233,20 +271,42 @@
 
   if (options.hasExcludeCredentials()) {
     // Adds the excludeCredentials members
-    for (const blink::PublicKeyCredentialDescriptor& descriptor :
-         options.excludeCredentials()) {
-      auto mojo_descriptor =
-          webauth::mojom::blink::PublicKeyCredentialDescriptor::New();
-      mojo_descriptor->type =
-          ConvertTo<PublicKeyCredentialType>(descriptor.type());
-      mojo_descriptor->id = ConvertTo<Vector<uint8_t>>((descriptor.id()));
-      if (descriptor.hasTransports()) {
-        for (const auto& transport : descriptor.transports()) {
-          mojo_descriptor->transports.push_back(
-              ConvertTo<AuthenticatorTransport>(transport));
-        }
+    for (const auto descriptor : options.excludeCredentials()) {
+      PublicKeyCredentialDescriptorPtr mojo_descriptor =
+          PublicKeyCredentialDescriptor::From(descriptor);
+      if (mojo_descriptor) {
+        mojo_options->exclude_credentials.push_back(std::move(mojo_descriptor));
       }
-      mojo_options->exclude_credentials.push_back(std::move(mojo_descriptor));
+    }
+  }
+  return mojo_options;
+}
+
+// static
+PublicKeyCredentialRequestOptionsPtr
+TypeConverter<PublicKeyCredentialRequestOptionsPtr,
+              blink::PublicKeyCredentialRequestOptions>::
+    Convert(const blink::PublicKeyCredentialRequestOptions& options) {
+  auto mojo_options =
+      webauth::mojom::blink::PublicKeyCredentialRequestOptions::New();
+  mojo_options->challenge = ConvertTo<Vector<uint8_t>>(options.challenge());
+
+  if (options.hasTimeout()) {
+    mojo_options->adjusted_timeout = AdjustTimeout(options.timeout());
+  } else {
+    mojo_options->adjusted_timeout = kAdjustedTimeoutLower;
+  }
+
+  mojo_options->relying_party_id = options.rpId();
+
+  if (options.hasAllowCredentials()) {
+    // Adds the allowList members
+    for (auto descriptor : options.allowCredentials()) {
+      PublicKeyCredentialDescriptorPtr mojo_descriptor =
+          PublicKeyCredentialDescriptor::From(descriptor);
+      if (mojo_descriptor) {
+        mojo_options->allow_credentials.push_back(std::move(mojo_descriptor));
+      }
     }
   }
   return mojo_options;
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.h b/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.h
index eaab935..0606141 100644
--- a/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.h
+++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialManagerTypeConverters.h
@@ -14,7 +14,9 @@
 class ArrayBufferOrArrayBufferView;
 class Credential;
 class MakePublicKeyCredentialOptions;
+class PublicKeyCredentialDescriptor;
 class PublicKeyCredentialParameters;
+class PublicKeyCredentialRequestOptions;
 class PublicKeyCredentialRpEntity;
 class PublicKeyCredentialUserEntity;
 }  // namespace blink
@@ -77,6 +79,13 @@
 };
 
 template <>
+struct TypeConverter<webauth::mojom::blink::PublicKeyCredentialDescriptorPtr,
+                     blink::PublicKeyCredentialDescriptor> {
+  static webauth::mojom::blink::PublicKeyCredentialDescriptorPtr Convert(
+      const blink::PublicKeyCredentialDescriptor&);
+};
+
+template <>
 struct TypeConverter<webauth::mojom::blink::PublicKeyCredentialParametersPtr,
                      blink::PublicKeyCredentialParameters> {
   static webauth::mojom::blink::PublicKeyCredentialParametersPtr Convert(
@@ -90,6 +99,14 @@
       const blink::MakePublicKeyCredentialOptions&);
 };
 
+template <>
+struct TypeConverter<
+    webauth::mojom::blink::PublicKeyCredentialRequestOptionsPtr,
+    blink::PublicKeyCredentialRequestOptions> {
+  static webauth::mojom::blink::PublicKeyCredentialRequestOptionsPtr Convert(
+      const blink::PublicKeyCredentialRequestOptions&);
+};
+
 }  // namespace mojo
 
 #endif  // CredentialManagerProxy_h
diff --git a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
index a6ed104..0c36b74 100644
--- a/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
+++ b/third_party/WebKit/Source/modules/credentialmanager/CredentialsContainer.cpp
@@ -19,8 +19,8 @@
 #include "core/inspector/ConsoleMessage.h"
 #include "core/page/FrameTree.h"
 #include "core/typed_arrays/DOMArrayBuffer.h"
+#include "modules/credentialmanager/AuthenticatorAssertionResponse.h"
 #include "modules/credentialmanager/AuthenticatorAttestationResponse.h"
-#include "modules/credentialmanager/AuthenticatorResponse.h"
 #include "modules/credentialmanager/Credential.h"
 #include "modules/credentialmanager/CredentialCreationOptions.h"
 #include "modules/credentialmanager/CredentialManagerProxy.h"
@@ -31,6 +31,8 @@
 #include "modules/credentialmanager/MakePublicKeyCredentialOptions.h"
 #include "modules/credentialmanager/PasswordCredential.h"
 #include "modules/credentialmanager/PublicKeyCredential.h"
+#include "modules/credentialmanager/PublicKeyCredentialRequestOptions.h"
+#include "platform/weborigin/OriginAccessEntry.h"
 #include "platform/weborigin/SecurityOrigin.h"
 #include "platform/wtf/Functional.h"
 #include "third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom-blink.h"
@@ -47,6 +49,9 @@
 using MojoMakePublicKeyCredentialOptions =
     ::webauth::mojom::blink::MakePublicKeyCredentialOptions;
 using ::webauth::mojom::blink::MakeCredentialAuthenticatorResponsePtr;
+using MojoPublicKeyCredentialRequestOptions =
+    ::webauth::mojom::blink::PublicKeyCredentialRequestOptions;
+using ::webauth::mojom::blink::GetAssertionAuthenticatorResponsePtr;
 
 enum class RequiredOriginType { kSecure, kSecureAndSameWithAncestors };
 
@@ -148,6 +153,58 @@
                  IsSameOriginWithAncestors(resolver->GetFrame()));
 }
 
+bool CheckPublicKeySecurityRequirements(ScriptPromiseResolver* resolver,
+                                        const String& relying_party_id) {
+  const SecurityOrigin* origin =
+      resolver->GetFrame()->GetSecurityContext()->GetSecurityOrigin();
+
+  if (origin->IsUnique()) {
+    String error_message =
+        "The origin ' " + origin->ToRawString() +
+        "' is an opaque origin and hence not allowed to access " +
+        "'PublicKeyCredential' objects.";
+    resolver->Reject(DOMException::Create(kNotAllowedError, error_message));
+    return false;
+  }
+
+  DCHECK_NE(origin->Protocol(), url::kAboutScheme);
+  DCHECK_NE(origin->Protocol(), url::kFileScheme);
+
+  // Validate the effective domain.
+  // For step 6 of both
+  // https://w3c.github.io/webauthn/#createCredential and
+  // https://w3c.github.io/webauthn/#discover-from-external-source.
+  String effective_domain = origin->Domain();
+
+  // TODO(crbug.com/803077): Avoid constructing an OriginAccessEntry just
+  // for the IP address check.
+  OriginAccessEntry access_entry(origin->Protocol(), effective_domain,
+                                 blink::OriginAccessEntry::kAllowSubdomains);
+  if (effective_domain.IsEmpty() || access_entry.HostIsIPAddress()) {
+    resolver->Reject(DOMException::Create(
+        kSecurityError, "Effective domain is not a valid domain."));
+    return false;
+  }
+
+  // For the steps detailed in
+  // https://w3c.github.io/webauthn/#CreateCred-DetermineRpId and
+  // https://w3c.github.io/webauthn/#GetAssn-DetermineRpId.
+  if (!relying_party_id.IsNull()) {
+    OriginAccessEntry access_entry(origin->Protocol(), relying_party_id,
+                                   blink::OriginAccessEntry::kAllowSubdomains);
+    if (access_entry.MatchesDomain(*origin) !=
+        blink::OriginAccessEntry::kMatchesOrigin) {
+      resolver->Reject(DOMException::Create(
+          kSecurityError,
+          "The relying party ID '" + relying_party_id +
+              "' is not a registrable domain suffix of, nor equal to '" +
+              origin->ToRawString() + "'."));
+      return false;
+    }
+  }
+  return true;
+}
+
 // Checks if the icon URL of |credential| is an a-priori authenticated URL.
 // https://w3c.github.io/webappsec-credential-management/#dom-credentialuserdata-iconurl
 bool IsIconURLEmptyOrSecure(const Credential* credential) {
@@ -186,6 +243,12 @@
       return DOMException::Create(
           kNotSupportedError,
           "Parameters for this operation are not supported.");
+    case CredentialManagerError::INVALID_DOMAIN:
+      return DOMException::Create(kSecurityError, "This is an invalid domain.");
+    case CredentialManagerError::TIMED_OUT:
+      return DOMException::Create(kNotAllowedError, "Operation timed out.");
+    case CredentialManagerError::NOT_IMPLEMENTED:
+      return DOMException::Create(kNotSupportedError, "Not implemented");
     case CredentialManagerError::UNKNOWN:
       return DOMException::Create(kNotReadableError,
                                   "An unknown error occurred while talking "
@@ -243,6 +306,8 @@
   auto* resolver = scoped_resolver->Release();
   const auto required_origin_type = RequiredOriginType::kSecure;
 
+  // TODO(crbug.com/803080): Introduce the assert counterpart of
+  // CheckPublicKeySecurityRequirements().
   AssertSecurityRequirementsBeforeResponse(resolver, required_origin_type);
   if (status == AuthenticatorStatus::SUCCESS) {
     DCHECK(credential);
@@ -250,10 +315,10 @@
     DCHECK(!credential->attestation_object.IsEmpty());
     DOMArrayBuffer* client_data_buffer =
         VectorToDOMArrayBuffer(std::move(credential->info->client_data_json));
-    DOMArrayBuffer* attestation_buffer =
-        VectorToDOMArrayBuffer(std::move(credential->attestation_object));
     DOMArrayBuffer* raw_id =
         VectorToDOMArrayBuffer(std::move(credential->info->raw_id));
+    DOMArrayBuffer* attestation_buffer =
+        VectorToDOMArrayBuffer(std::move(credential->attestation_object));
     AuthenticatorAttestationResponse* authenticator_response =
         AuthenticatorAttestationResponse::Create(client_data_buffer,
                                                  attestation_buffer);
@@ -266,6 +331,44 @@
   }
 }
 
+void OnGetAssertionComplete(
+    std::unique_ptr<ScopedPromiseResolver> scoped_resolver,
+    AuthenticatorStatus status,
+    GetAssertionAuthenticatorResponsePtr credential) {
+  auto resolver = scoped_resolver->Release();
+  const auto required_origin_type = RequiredOriginType::kSecure;
+
+  AssertSecurityRequirementsBeforeResponse(resolver, required_origin_type);
+  if (status == AuthenticatorStatus::SUCCESS) {
+    DCHECK(credential);
+    DCHECK(!credential->signature.IsEmpty());
+    DCHECK(!credential->authenticator_data.IsEmpty());
+    DOMArrayBuffer* client_data_buffer =
+        VectorToDOMArrayBuffer(std::move(credential->info->client_data_json));
+    DOMArrayBuffer* raw_id =
+        VectorToDOMArrayBuffer(std::move(credential->info->raw_id));
+
+    DOMArrayBuffer* authenticator_buffer =
+        VectorToDOMArrayBuffer(std::move(credential->authenticator_data));
+    DOMArrayBuffer* signature_buffer =
+        VectorToDOMArrayBuffer(std::move(credential->signature));
+    DOMArrayBuffer* user_handle =
+        credential->user_handle
+            ? VectorToDOMArrayBuffer(std::move(*credential->user_handle))
+            : DOMArrayBuffer::Create(nullptr, 0);
+    AuthenticatorAssertionResponse* authenticator_response =
+        AuthenticatorAssertionResponse::Create(client_data_buffer,
+                                               authenticator_buffer,
+                                               signature_buffer, user_handle);
+    resolver->Resolve(PublicKeyCredential::Create(credential->info->id, raw_id,
+                                                  authenticator_response));
+  } else {
+    DCHECK(!credential);
+    resolver->Reject(CredentialManagerErrorToDOMException(
+        mojo::ConvertTo<CredentialManagerError>(status)));
+  }
+}
+
 }  // namespace
 
 CredentialsContainer* CredentialsContainer::Create() {
@@ -287,6 +390,25 @@
   if (!CheckSecurityRequirementsBeforeRequest(resolver, required_origin_type))
     return promise;
 
+  if (options.hasPublicKey()) {
+    auto mojo_options =
+        MojoPublicKeyCredentialRequestOptions::From(options.publicKey());
+    if (mojo_options) {
+      auto* authenticator =
+          CredentialManagerProxy::From(script_state)->Authenticator();
+      authenticator->GetAssertion(
+          std::move(mojo_options),
+          WTF::Bind(
+              &OnGetAssertionComplete,
+              WTF::Passed(std::make_unique<ScopedPromiseResolver>(resolver))));
+    } else {
+      resolver->Reject(DOMException::Create(
+          kNotSupportedError,
+          "Required parameters missing in 'options.publicKey'."));
+    }
+    return promise;
+  }
+
   Vector<KURL> providers;
   if (options.hasFederated() && options.federated().hasProviders()) {
     for (const auto& string : options.federated().providers()) {
@@ -392,9 +514,19 @@
         FederatedCredential::Create(options.federated(), exception_state));
   } else {
     DCHECK(options.hasPublicKey());
+    const String& relying_party_id = options.publicKey().rp().id();
+    if (!CheckPublicKeySecurityRequirements(resolver, relying_party_id)) {
+      return promise;
+    }
     auto mojo_options =
         MojoMakePublicKeyCredentialOptions::From(options.publicKey());
     if (mojo_options) {
+      if (!mojo_options->relying_party->id) {
+        mojo_options->relying_party->id = resolver->GetFrame()
+                                              ->GetSecurityContext()
+                                              ->GetSecurityOrigin()
+                                              ->Domain();
+      }
       auto* authenticator =
           CredentialManagerProxy::From(script_state)->Authenticator();
       authenticator->MakeCredential(
diff --git a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
index 45c918f..c2489a01 100644
--- a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.cpp
@@ -224,9 +224,9 @@
                              message.column_number, nullptr)));
 }
 
-void WebEmbeddedWorkerImpl::GetDevToolsAgent(
+void WebEmbeddedWorkerImpl::BindDevToolsAgent(
     mojo::ScopedInterfaceEndpointHandle devtools_agent_request) {
-  shadow_page_->GetDevToolsAgent(mojom::blink::DevToolsAgentAssociatedRequest(
+  shadow_page_->BindDevToolsAgent(mojom::blink::DevToolsAgentAssociatedRequest(
       std::move(devtools_agent_request)));
 }
 
diff --git a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h
index 9fd7d26f..c14c3c7 100644
--- a/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h
+++ b/third_party/WebKit/Source/modules/exported/WebEmbeddedWorkerImpl.h
@@ -70,7 +70,7 @@
   void TerminateWorkerContext() override;
   void ResumeAfterDownload() override;
   void AddMessageToConsole(const WebConsoleMessage&) override;
-  void GetDevToolsAgent(
+  void BindDevToolsAgent(
       mojo::ScopedInterfaceEndpointHandle devtools_agent_request) override;
 
   void PostMessageToPageInspector(int session_id, const WTF::String&);
diff --git a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp
index 99d53db..48686c7 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp
@@ -197,7 +197,7 @@
   info->SetFinalResponse(resource_response);
   info->AddFinalTransferSize(encoded_data_length);
   WorkerGlobalScopePerformance::performance(*worker_global_scope)
-      ->AddResourceTiming(*info);
+      ->GenerateAndAddResourceTiming(*info);
 }
 
 void FetchEvent::Trace(blink::Visitor* visitor) {
diff --git a/third_party/WebKit/Source/modules/vr/BUILD.gn b/third_party/WebKit/Source/modules/vr/BUILD.gn
index d00089e6..f841c90f 100644
--- a/third_party/WebKit/Source/modules/vr/BUILD.gn
+++ b/third_party/WebKit/Source/modules/vr/BUILD.gn
@@ -30,5 +30,6 @@
 
   deps = [
     "//device/vr:mojo_bindings_blink",
+    "//services/metrics/public/cpp:ukm_builders",
   ]
 }
diff --git a/third_party/WebKit/Source/modules/vr/DEPS b/third_party/WebKit/Source/modules/vr/DEPS
index 11285ac..a48621b 100644
--- a/third_party/WebKit/Source/modules/vr/DEPS
+++ b/third_party/WebKit/Source/modules/vr/DEPS
@@ -3,4 +3,5 @@
     "+device/vr/vr_service.mojom-blink.h",
     "+gpu/command_buffer/client/gles2_interface.h",
     "+ui/gfx/geometry",
+    "+services/metrics/public/cpp/ukm_builders.h"
 ]
diff --git a/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp b/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp
index 86b0333..4de7dddc 100644
--- a/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp
+++ b/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp
@@ -22,6 +22,7 @@
 #include "modules/xr/XR.h"
 #include "platform/feature_policy/FeaturePolicy.h"
 #include "public/platform/Platform.h"
+#include "services/metrics/public/cpp/ukm_builders.h"
 
 namespace blink {
 
@@ -81,7 +82,7 @@
       if (frame->GetDocument()) {
         frame->GetDocument()->AddConsoleMessage(ConsoleMessage::Create(
             kOtherMessageSource, kErrorMessageLevel,
-            "Cannot use navigator.vr if the legacy VR API is already in use."));
+            "Cannot use navigator.xr if the legacy VR API is already in use."));
       }
       return nullptr;
     }
@@ -108,6 +109,14 @@
                                            kNotAssociatedWithDocumentMessage));
   }
 
+  if (!did_log_getVRDisplays_ && GetDocument()->IsInMainFrame()) {
+    did_log_getVRDisplays_ = true;
+
+    ukm::builders::XR_WebXR(GetDocument()->UkmSourceID())
+        .SetDidRequestAvailableDevices(1)
+        .Record(GetDocument()->UkmRecorder());
+  }
+
   LocalFrame* frame = GetDocument()->GetFrame();
   if (!frame) {
     return ScriptPromise::RejectWithDOMException(
diff --git a/third_party/WebKit/Source/modules/vr/NavigatorVR.h b/third_party/WebKit/Source/modules/vr/NavigatorVR.h
index ffae86f..9dd55fd4 100644
--- a/third_party/WebKit/Source/modules/vr/NavigatorVR.h
+++ b/third_party/WebKit/Source/modules/vr/NavigatorVR.h
@@ -82,6 +82,10 @@
   // Whether this page is listening for vrdisplayactivate event.
   bool listening_for_activate_ = false;
   bool focused_ = false;
+
+  // Metrics data - indicates whether we've already measured this data so we
+  // don't do it every frame.
+  bool did_log_getVRDisplays_ = false;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/modules/vr/VRController.cpp b/third_party/WebKit/Source/modules/vr/VRController.cpp
index b2205105..22e266f 100644
--- a/third_party/WebKit/Source/modules/vr/VRController.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRController.cpp
@@ -11,6 +11,7 @@
 #include "modules/vr/NavigatorVR.h"
 #include "modules/vr/VRGetDevicesCallback.h"
 #include "platform/wtf/Assertions.h"
+#include "services/metrics/public/cpp/ukm_builders.h"
 #include "services/service_manager/public/cpp/interface_provider.h"
 
 namespace blink {
@@ -39,6 +40,7 @@
   // connection just return the current list. In the case of the service being
   // disconnected this will be an empty array.
   if (!service_ || display_synced_) {
+    LogGetDisplayResult();
     resolver->Resolve(displays_);
     return;
   }
@@ -68,6 +70,10 @@
   vr_display->Update(display_info);
   vr_display->OnConnected();
   vr_display->FocusChanged();
+
+  has_presentation_capable_display_ = display_info->capabilities->canPresent;
+  has_display_ = true;
+
   displays_.push_back(vr_display);
 }
 
@@ -83,8 +89,21 @@
   OnGetDisplays();
 }
 
+void VRController::LogGetDisplayResult() {
+  Document* doc = navigator_vr_->GetDocument();
+  if (has_display_ && doc && doc->IsInMainFrame()) {
+    ukm::builders::XR_WebXR ukm_builder(doc->UkmSourceID());
+    ukm_builder.SetReturnedDevice(1);
+    if (has_presentation_capable_display_) {
+      ukm_builder.SetReturnedPresentationCapableDevice(1);
+    }
+    ukm_builder.Record(doc->UkmRecorder());
+  }
+}
+
 void VRController::OnGetDisplays() {
   while (!pending_get_devices_callbacks_.IsEmpty()) {
+    LogGetDisplayResult();
     std::unique_ptr<VRGetDevicesCallback> callback =
         pending_get_devices_callbacks_.TakeFirst();
     callback->OnSuccess(displays_);
diff --git a/third_party/WebKit/Source/modules/vr/VRController.h b/third_party/WebKit/Source/modules/vr/VRController.h
index 7c1455c9..8c76c22c 100644
--- a/third_party/WebKit/Source/modules/vr/VRController.h
+++ b/third_party/WebKit/Source/modules/vr/VRController.h
@@ -51,11 +51,16 @@
   void ContextDestroyed(ExecutionContext*) override;
   void Dispose();
 
+  void LogGetDisplayResult();
+
   Member<NavigatorVR> navigator_vr_;
   VRDisplayVector displays_;
 
   bool display_synced_;
 
+  bool has_presentation_capable_display_ = false;
+  bool has_display_ = false;
+
   Deque<std::unique_ptr<VRGetDevicesCallback>> pending_get_devices_callbacks_;
   device::mojom::blink::VRServicePtr service_;
   mojo::Binding<device::mojom::blink::VRServiceClient> binding_;
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index d01e5bb..c4393ae1 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -35,6 +35,7 @@
 #include "platform/wtf/Time.h"
 #include "public/platform/Platform.h"
 #include "public/platform/TaskType.h"
+#include "services/metrics/public/cpp/ukm_builders.h"
 
 #include <array>
 #include "core/dom/ExecutionContext.h"
@@ -161,6 +162,15 @@
 }
 
 bool VRDisplay::getFrameData(VRFrameData* frame_data) {
+  if (!did_log_getFrameData_ && GetDocument() &&
+      GetDocument()->IsInMainFrame()) {
+    did_log_getFrameData_ = true;
+
+    ukm::builders::XR_WebXR(GetDocument()->UkmSourceID())
+        .SetDidRequestPose(1)
+        .Record(GetDocument()->UkmRecorder());
+  }
+
   if (!FocusedOrPresenting() || !frame_pose_ || display_blurred_)
     return false;
 
@@ -328,6 +338,14 @@
                       WebFeature::kVRRequestPresentInsecureOrigin);
   }
 
+  if (!did_log_requestPresent_ && GetDocument() &&
+      GetDocument()->IsInMainFrame()) {
+    did_log_requestPresent_ = true;
+    ukm::builders::XR_WebXR(GetDocument()->UkmSourceID())
+        .SetDidRequestPresentation(1)
+        .Record(GetDocument()->UkmRecorder());
+  }
+
   ReportPresentationResult(PresentationResult::kRequested);
 
   ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state);
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.h b/third_party/WebKit/Source/modules/vr/VRDisplay.h
index c1702ad..350232e 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.h
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.h
@@ -214,6 +214,11 @@
   bool display_blurred_ = false;
   bool pending_present_request_ = false;
 
+  // Metrics data - indicates whether we've already measured this data so we
+  // don't do it every frame.
+  bool did_log_getFrameData_ = false;
+  bool did_log_requestPresent_ = false;
+
   device::mojom::blink::VRMagicWindowProviderPtr magic_window_provider_;
   device::mojom::blink::VRDisplayHostPtr display_;
 
diff --git a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
index dc759c93..9a459b1a 100644
--- a/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DOMWebSocket.cpp
@@ -677,6 +677,7 @@
   NETWORK_DVLOG(1) << "WebSocket " << this
                    << " DidReceiveTextMessage() Text message " << msg;
 
+  DCHECK_NE(state_, kConnecting);
   if (state_ != kOpen)
     return;
   RecordReceiveTypeHistogram(kWebSocketReceiveTypeString);
@@ -692,6 +693,10 @@
 
   DCHECK(!origin_string_.IsNull());
 
+  DCHECK_NE(state_, kConnecting);
+  if (state_ != kOpen)
+    return;
+
   switch (binary_type_) {
     case kBinaryTypeBlob: {
       size_t size = binary_data->size();
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
index d8a0646..5d96a5c 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
@@ -192,8 +192,7 @@
       identifier_(CreateUniqueIdentifier()),
       loading_context_(loading_context),
       sending_quota_(0),
-      received_data_size_for_flow_control_(
-          kReceivedDataSizeForFlowControlHighWaterMark * 2),  // initial quota
+      received_data_size_for_flow_control_(0),
       sent_size_of_top_message_(0),
       location_at_construction_(std::move(location)),
       handshake_throttle_(std::move(handshake_throttle)),
@@ -280,7 +279,6 @@
     throttle_passed_ = true;
   }
 
-  FlowControlIfNecessary();
   TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate",
                        TRACE_EVENT_SCOPE_THREAD, "data",
                        InspectorWebSocketCreateEvent::Data(
@@ -526,6 +524,12 @@
   received_data_size_for_flow_control_ = 0;
 }
 
+void DocumentWebSocketChannel::InitialFlowControl() {
+  DCHECK_EQ(received_data_size_for_flow_control_, 0u);
+  DCHECK(handle_);
+  handle_->FlowControl(kReceivedDataSizeForFlowControlHighWaterMark * 2);
+}
+
 void DocumentWebSocketChannel::AbortAsyncOperations() {
   if (blob_loader_) {
     blob_loader_->Cancel();
@@ -579,6 +583,8 @@
     return;
   }
 
+  InitialFlowControl();
+
   handshake_throttle_.reset();
 
   client_->DidConnect(selected_protocol, extensions);
@@ -760,6 +766,10 @@
   throttle_passed_ = true;
   handshake_throttle_ = nullptr;
   if (connect_info_) {
+    // No flow control quota is supplied to the browser until we are ready to
+    // receive messages. This fixes crbug.com/786776.
+    InitialFlowControl();
+
     client_->DidConnect(std::move(connect_info_->selected_protocol),
                         std::move(connect_info_->extensions));
     connect_info_.reset();
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h
index bff4cf9..2950871 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.h
@@ -144,6 +144,7 @@
                     uint64_t* consumed_buffered_amount);
   void ProcessSendQueue();
   void FlowControlIfNecessary();
+  void InitialFlowControl();
   void FailAsError(const String& reason) {
     Fail(reason, kErrorMessageLevel, location_at_construction_->Clone());
   }
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
index 90f95e9..cd5b64c 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannelTest.cpp
@@ -219,8 +219,8 @@
                 Connect(KURLEq("ws://localhost/"), _, _,
                         KURLEq("http://example.com/"), _, HandleClient(), _))
         .WillOnce(DoAll(SaveArg<1>(&protocols), SaveArg<2>(&origin)));
-    EXPECT_CALL(*Handle(), FlowControl(65536));
     EXPECT_CALL(checkpoint, Call(1));
+    EXPECT_CALL(*Handle(), FlowControl(65536));
     EXPECT_CALL(*ChannelClient(), DidConnect(String("a"), String("b")));
   }
 
@@ -827,7 +827,6 @@
   void NormalHandshakeExpectations() {
     EXPECT_CALL(*Handle(), DoInitialize(_));
     EXPECT_CALL(*Handle(), Connect(_, _, _, _, _, _, _));
-    EXPECT_CALL(*Handle(), FlowControl(_));
     EXPECT_CALL(*handshake_throttle_, ThrottleHandshake(_, _, _));
   }
 
@@ -837,7 +836,6 @@
 TEST_F(DocumentWebSocketChannelHandshakeThrottleTest, ThrottleArguments) {
   EXPECT_CALL(*Handle(), DoInitialize(_));
   EXPECT_CALL(*Handle(), Connect(_, _, _, _, _, _, _));
-  EXPECT_CALL(*Handle(), FlowControl(_));
   EXPECT_CALL(*handshake_throttle_,
               ThrottleHandshake(WebURL(url()), _, WebCallbacks()));
   EXPECT_CALL(*handshake_throttle_, Destructor());
@@ -852,6 +850,7 @@
     EXPECT_CALL(checkpoint, Call(1));
     EXPECT_CALL(*handshake_throttle_, Destructor());
     EXPECT_CALL(checkpoint, Call(2));
+    EXPECT_CALL(*Handle(), FlowControl(_));
     EXPECT_CALL(*ChannelClient(), DidConnect(String("a"), String("b")));
   }
   Channel()->Connect(url(), "");
@@ -869,6 +868,7 @@
     EXPECT_CALL(checkpoint, Call(1));
     EXPECT_CALL(checkpoint, Call(2));
     EXPECT_CALL(*handshake_throttle_, Destructor());
+    EXPECT_CALL(*Handle(), FlowControl(_));
     EXPECT_CALL(*ChannelClient(), DidConnect(String("a"), String("b")));
   }
   Channel()->Connect(url(), "");
diff --git a/third_party/WebKit/Source/platform/bindings/ScriptWrappable.cpp b/third_party/WebKit/Source/platform/bindings/ScriptWrappable.cpp
index 5e8968c2..5175ef04 100644
--- a/third_party/WebKit/Source/platform/bindings/ScriptWrappable.cpp
+++ b/third_party/WebKit/Source/platform/bindings/ScriptWrappable.cpp
@@ -41,7 +41,7 @@
 
 void ScriptWrappable::MarkWrapper(const ScriptWrappableVisitor* visitor) const {
   if (ContainsWrapper())
-    visitor->MarkWrapper(&main_world_wrapper_.Get().As<v8::Value>());
+    visitor->TraceWrappers(main_world_wrapper_);
 }
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/platform/bindings/ScriptWrappable.h b/third_party/WebKit/Source/platform/bindings/ScriptWrappable.h
index 18bc4651..8eb2c24 100644
--- a/third_party/WebKit/Source/platform/bindings/ScriptWrappable.h
+++ b/third_party/WebKit/Source/platform/bindings/ScriptWrappable.h
@@ -148,9 +148,12 @@
 
   bool ContainsWrapper() const { return !main_world_wrapper_.IsEmpty(); }
 
-  //  Mark wrapper of this ScriptWrappable as alive in V8. Only marks
-  //  wrapper in the main world. To mark wrappers in all worlds call
-  //  ScriptWrappableVisitor::markWrapper(ScriptWrappable*, v8::Isolate*)
+  // Mark wrapper of this ScriptWrappable as alive in V8. Only marks
+  // wrapper in the main world. To mark wrappers in all worlds call
+  // ScriptWrappableVisitor::MarkWrappersInAllWorlds.
+  // TODO(ulan): Move body of this function to TraceWrappers and
+  // remove this function once all ScriptWrappable objects dispatch to
+  // ScriptWrappable::TraceWrappers from their overriden TraceWrappers.
   void MarkWrapper(const ScriptWrappableVisitor*) const;
 
  protected:
diff --git a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp
index 64540e8..f732617 100644
--- a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp
+++ b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.cpp
@@ -52,10 +52,8 @@
   CHECK(!ThreadState::Current()->IsWrapperTracingForbidden());
   DCHECK(marking_deque_.IsEmpty());
 #if DCHECK_IS_ON()
-  ScriptWrappableVisitorVerifier verifier(isolate_);
-  for (auto& marking_data : verifier_deque_) {
-    marking_data.TraceWrappers(&verifier);
-  }
+  ScriptWrappableVisitorVerifier verifier(isolate_, &verifier_deque_);
+  verifier.Verify();
 #endif
 
   should_cleanup_ = true;
@@ -206,17 +204,14 @@
   return true;
 }
 
-bool ScriptWrappableVisitor::MarkWrapperHeader(HeapObjectHeader* header) const {
-  if (header->IsWrapperHeaderMarked())
-    return false;
-
+void ScriptWrappableVisitor::MarkWrapperHeader(HeapObjectHeader* header) const {
+  DCHECK(!header->IsWrapperHeaderMarked());
   // Verify that no compactable & movable objects are slated for
   // lazy unmarking.
   DCHECK(!HeapCompact::IsCompactableArena(
       PageFromObject(header)->Arena()->ArenaIndex()));
   header->MarkWrapperHeader();
   headers_to_unmark_.push_back(header);
-  return true;
 }
 
 void ScriptWrappableVisitor::MarkWrappersInAllWorlds(
@@ -234,24 +229,34 @@
 
   // Conservatively assume that the source object containing |dst_object| is
   // marked.
-  visitor->MarkWrapper(
-      &(const_cast<TraceWrapperV8Reference<v8::Value>&>(dst_object).Get()));
+  visitor->TraceWrappers(dst_object);
 }
 
-void ScriptWrappableVisitor::TraceWrappers(
+void ScriptWrappableVisitor::Visit(
     const TraceWrapperV8Reference<v8::Value>& traced_wrapper) const {
-  MarkWrapper(
-      &(const_cast<TraceWrapperV8Reference<v8::Value>&>(traced_wrapper).Get()));
-}
-
-void ScriptWrappableVisitor::MarkWrapper(
-    const v8::PersistentBase<v8::Value>* handle) const {
   // The write barrier may try to mark a wrapper because cleanup is still
   // delayed. Bail out in this case. We also allow unconditional marking which
   // requires us to bail out here when tracing is not in progress.
-  if (!tracing_in_progress_ || handle->IsEmpty())
+  if (!tracing_in_progress_ || traced_wrapper.Get().IsEmpty())
     return;
-  handle->RegisterExternalReference(isolate_);
+  traced_wrapper.Get().RegisterExternalReference(isolate_);
+}
+
+void ScriptWrappableVisitor::Visit(
+    const WrapperDescriptor& wrapper_descriptor) const {
+  HeapObjectHeader* header = wrapper_descriptor.heap_object_header_callback(
+      wrapper_descriptor.traceable);
+  if (header->IsWrapperHeaderMarked())
+    return;
+  MarkWrapperHeader(header);
+  DCHECK(tracing_in_progress_);
+  DCHECK(header->IsWrapperHeaderMarked());
+  marking_deque_.push_back(WrapperMarkingData(wrapper_descriptor));
+#if DCHECK_IS_ON()
+  if (!advancing_tracing_) {
+    verifier_deque_.push_back(WrapperMarkingData(wrapper_descriptor));
+  }
+#endif
 }
 
 void ScriptWrappableVisitor::DispatchTraceWrappers(
diff --git a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.h b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.h
index ddf61ce..58e0819 100644
--- a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.h
+++ b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitor.h
@@ -39,21 +39,33 @@
     traceable->TraceWrappers(visitor);                               \
   }
 
+// WrapperDescriptor contains enough information to visit a
+// ScriptWrappable without knowing its type statically.
+// It is passed to ScriptWrappableVisitor::Visit method.
+struct WrapperDescriptor {
+  STACK_ALLOCATED();
+  const void* traceable;
+  TraceWrappersCallback trace_wrappers_callback;
+  HeapObjectHeaderCallback heap_object_header_callback;
+  MissedWriteBarrierCallback missed_write_barrier_callback;
+};
+
+// TODO(ulan): rename it to MarkingDequeItem and make it a private
+// nested class of ScriptWrappableMarkingVisitor.
 class WrapperMarkingData {
  public:
-  WrapperMarkingData(TraceWrappersCallback trace_wrappers_callback,
-                     HeapObjectHeaderCallback heap_object_header_callback,
-                     const void* object)
-      : trace_wrappers_callback_(trace_wrappers_callback),
-        heap_object_header_callback_(heap_object_header_callback),
-        raw_object_pointer_(object) {
+  WrapperMarkingData(const WrapperDescriptor& wrapper_descriptor)
+      : trace_wrappers_callback_(wrapper_descriptor.trace_wrappers_callback),
+        heap_object_header_callback_(
+            wrapper_descriptor.heap_object_header_callback),
+        raw_object_pointer_(wrapper_descriptor.traceable) {
     DCHECK(trace_wrappers_callback_);
     DCHECK(heap_object_header_callback_);
     DCHECK(raw_object_pointer_);
   }
 
   // Traces wrappers if the underlying object has not yet been invalidated.
-  inline void TraceWrappers(ScriptWrappableVisitor* visitor) {
+  inline void TraceWrappers(ScriptWrappableVisitor* visitor) const {
     if (raw_object_pointer_) {
       trace_wrappers_callback_(visitor, raw_object_pointer_);
     }
@@ -112,9 +124,8 @@
   // alive in the current GC cycle.
   template <typename T>
   static void WriteBarrier(const T* dst_object) {
-    if (!dst_object) {
+    if (!dst_object)
       return;
-    }
 
     const ThreadState* thread_state =
         ThreadStateFor<ThreadingTrait<T>::kAffinity>::GetState();
@@ -127,25 +138,12 @@
     if (TraceTrait<T>::GetHeapObjectHeader(dst_object)->IsWrapperHeaderMarked())
       return;
 
-    // Otherwise, eagerly mark the wrapper header and put the object on the
-    // marking deque for further processing.
-    CurrentVisitor(thread_state->GetIsolate())
-        ->MarkAndPushToMarkingDeque(dst_object);
+    CurrentVisitor(thread_state->GetIsolate())->Visit(dst_object);
   }
 
   static void WriteBarrier(v8::Isolate*,
                            const TraceWrapperV8Reference<v8::Value>&);
 
-  // TODO(mlippautz): Remove once ScriptWrappable is converted to
-  // TraceWrapperV8Reference.
-  static void WriteBarrier(v8::Isolate* isolate,
-                           const v8::Persistent<v8::Object>& dst_object) {
-    ScriptWrappableVisitor* visitor = CurrentVisitor(isolate);
-    if (dst_object.IsEmpty() || !visitor->WrapperTracingInProgress())
-      return;
-    visitor->MarkWrapper(&dst_object.As<v8::Value>());
-  }
-
   ScriptWrappableVisitor(v8::Isolate* isolate) : isolate_(isolate){};
   ~ScriptWrappableVisitor() override;
 
@@ -154,9 +152,10 @@
   // If you cannot use TraceWrapperMember & the corresponding TraceWrappers()
   // for some reason (e.g., unions using raw pointers), see
   // |TraceWrappersWithManualWriteBarrier()| below.
+  // TODO(ulan): extract TraceWrappers* methods to a general visitor interface.
   template <typename T>
-  void TraceWrappers(const TraceWrapperMember<T>& t) const {
-    MarkAndTraceWrappers(t.Get());
+  void TraceWrappers(const TraceWrapperMember<T>& traceable) const {
+    Visit(traceable.Get());
   }
 
   // Enable partial tracing of objects. This is used when tracing interior
@@ -170,7 +169,7 @@
   // Only called from automatically generated bindings code.
   template <typename T>
   void TraceWrappersFromGeneratedCode(const T* traceable) const {
-    MarkAndTraceWrappers(traceable);
+    Visit(traceable);
   }
 
   // Require all users of manual write barriers to make this explicit in their
@@ -179,16 +178,13 @@
   // the field. Otherwise, the objects may be collected prematurely.
   template <typename T>
   void TraceWrappersWithManualWriteBarrier(const T* traceable) const {
-    MarkAndTraceWrappers(traceable);
+    Visit(traceable);
   }
 
   template <typename V8Type>
   void TraceWrappers(const TraceWrapperV8Reference<V8Type>& v8reference) const {
-    TraceWrappers(v8reference.template Cast<v8::Value>());
+    Visit(v8reference.template Cast<v8::Value>());
   }
-  virtual void TraceWrappers(const TraceWrapperV8Reference<v8::Value>&) const;
-  virtual void MarkWrapper(const v8::PersistentBase<v8::Value>*) const;
-  virtual bool MarkWrapperHeader(HeapObjectHeader*) const;
 
   virtual void DispatchTraceWrappers(const TraceWrapperBase*) const;
   template <typename T>
@@ -227,51 +223,34 @@
   size_t NumberOfWrappersToTrace() override;
 
  protected:
+  // The visitor interface. Derived visitors should override this
+  // function to visit V8 references and ScriptWrappables.
+  // TODO(ulan): extract Visit methods to a general visitor interface.
+  virtual void Visit(const TraceWrapperV8Reference<v8::Value>&) const;
+  virtual void Visit(const WrapperDescriptor&) const;
+
+  v8::Isolate* isolate() const { return isolate_; }
+
+ private:
   template <typename T>
   static NOINLINE void MissedWriteBarrier() {
     NOTREACHED();
   }
 
+  // Helper method to invoke the virtual Visit method with wrapper descriptor.
   template <typename T>
-  void MarkAndTraceWrappers(const T* traceable) const {
+  void Visit(const T* traceable) const {
     static_assert(sizeof(T), "T must be fully defined");
-
-    if (!traceable) {
+    if (!traceable)
       return;
-    }
-
-    if (TraceTrait<T>::GetHeapObjectHeader(traceable)
-            ->IsWrapperHeaderMarked()) {
-      return;
-    }
-
-    MarkAndPushToMarkingDeque(traceable);
+    WrapperDescriptor wrapper_descriptor = {
+        traceable, TraceTrait<T>::TraceMarkedWrapper,
+        TraceTrait<T>::GetHeapObjectHeader,
+        ScriptWrappableVisitor::MissedWriteBarrier<T>};
+    Visit(wrapper_descriptor);
   }
 
-  template <typename T>
-  ALWAYS_INLINE void MarkAndPushToMarkingDeque(const T* traceable) const {
-    TraceTrait<T>::MarkWrapperNoTracing(this, traceable);
-    PushToMarkingDeque(
-        TraceTrait<T>::TraceMarkedWrapper, TraceTrait<T>::GetHeapObjectHeader,
-        ScriptWrappableVisitor::MissedWriteBarrier<T>, traceable);
-  }
-
-  virtual void PushToMarkingDeque(
-      TraceWrappersCallback trace_wrappers_callback,
-      HeapObjectHeaderCallback heap_object_header_callback,
-      MissedWriteBarrierCallback missed_write_barrier_callback,
-      const void* object) const {
-    DCHECK(tracing_in_progress_);
-    DCHECK(heap_object_header_callback(object)->IsWrapperHeaderMarked());
-    marking_deque_.push_back(WrapperMarkingData(
-        trace_wrappers_callback, heap_object_header_callback, object));
-#if DCHECK_IS_ON()
-    if (!advancing_tracing_) {
-      verifier_deque_.push_back(WrapperMarkingData(
-          trace_wrappers_callback, heap_object_header_callback, object));
-    }
-#endif
-  }
+  void MarkWrapperHeader(HeapObjectHeader*) const;
 
   // Supplement-specific implementation of DispatchTraceWrappers.  The suffix of
   // "ForSupplement" is necessary not to make this member function a candidate
diff --git a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitorVerifier.h b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitorVerifier.h
index d849d02..3ae510e 100644
--- a/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitorVerifier.h
+++ b/third_party/WebKit/Source/platform/bindings/ScriptWrappableVisitorVerifier.h
@@ -11,26 +11,29 @@
 
 class ScriptWrappableVisitorVerifier final : public ScriptWrappableVisitor {
  public:
-  explicit ScriptWrappableVisitorVerifier(v8::Isolate* isolate)
-      : ScriptWrappableVisitor(isolate) {}
+  // The verifier deque should contain all objects encountered during marking.
+  // For each object in the deque the verifier checks that all children of
+  // the object are marked.
+  ScriptWrappableVisitorVerifier(
+      v8::Isolate* isolate,
+      const WTF::Deque<WrapperMarkingData>* verifier_deque)
+      : ScriptWrappableVisitor(isolate), verifier_deque_(verifier_deque) {}
 
-  void TraceWrappers(const TraceWrapperV8Reference<v8::Value>&) const final {}
-  void MarkWrapper(const v8::PersistentBase<v8::Value>*) const final {}
-  bool MarkWrapperHeader(HeapObjectHeader* header) const final {
-    if (!visited_headers_.Contains(header)) {
-      visited_headers_.insert(header);
-      return true;
-    }
-    return false;
-  }
   void MarkWrappersInAllWorlds(const ScriptWrappable*) const final {}
 
-  void PushToMarkingDeque(
-      TraceWrappersCallback trace_wrappers_callback,
-      HeapObjectHeaderCallback heap_object_header_callback,
-      MissedWriteBarrierCallback missed_write_barrier_callback,
-      const void* object) const final {
-    if (!heap_object_header_callback(object)->IsWrapperHeaderMarked()) {
+  void Verify() {
+    for (auto& marking_data : *verifier_deque_) {
+      // Check that all children of this object are marked.
+      marking_data.TraceWrappers(this);
+    }
+  }
+
+ protected:
+  void Visit(const TraceWrapperV8Reference<v8::Value>&) const final {}
+  void Visit(const WrapperDescriptor& wrapper_descriptor) const override {
+    HeapObjectHeader* header = wrapper_descriptor.heap_object_header_callback(
+        wrapper_descriptor.traceable);
+    if (!header->IsWrapperHeaderMarked()) {
       // If this branch is hit, it means that a white (not discovered by
       // traceWrappers) object was assigned as a member to a black object
       // (already processed by traceWrappers). Black object will not be
@@ -41,14 +44,13 @@
       // This means there is a write barrier missing somewhere. Check the
       // backtrace to see which types are causing this and review all the
       // places where white object is set to a black object.
-      missed_write_barrier_callback();
+      wrapper_descriptor.missed_write_barrier_callback();
       NOTREACHED();
     }
-    trace_wrappers_callback(this, object);
   }
 
  private:
-  mutable WTF::HashSet<HeapObjectHeader*> visited_headers_;
+  const WTF::Deque<WrapperMarkingData>* verifier_deque_;
 };
 }
 #endif
diff --git a/third_party/WebKit/Source/platform/exported/WebCORS.cpp b/third_party/WebKit/Source/platform/exported/WebCORS.cpp
index aea233c..33813fea 100644
--- a/third_party/WebKit/Source/platform/exported/WebCORS.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebCORS.cpp
@@ -52,12 +52,6 @@
 
 namespace {
 
-bool IsInterestingStatusCode(int status_code) {
-  // Predicate that gates what status codes should be included in console error
-  // messages for responses containing no access control headers.
-  return status_code >= 400;
-}
-
 // Fetch API Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch-0
 String CreateAccessControlRequestHeadersHeader(
     const WebHTTPHeaderMap& headers) {
@@ -185,7 +179,8 @@
   // TODO(tyoshino): This should be fixed to check not only the last one but
   // all redirect responses.
   if (!current_security_origin.CanRequest(last_url)) {
-    base::Optional<CORSError> redirect_error = CheckRedirectLocation(new_url);
+    base::Optional<CORSError> redirect_error =
+        CORS::CheckRedirectLocation(new_url);
     if (redirect_error)
       return redirect_error;
 
@@ -221,31 +216,6 @@
   return base::nullopt;
 }
 
-base::Optional<CORSError> CheckRedirectLocation(const WebURL& web_request_url) {
-  // Block non HTTP(S) schemes as specified in the step 4 in
-  // https://fetch.spec.whatwg.org/#http-redirect-fetch. Chromium also allows
-  // the data scheme.
-  //
-  // TODO(tyoshino): This check should be performed regardless of the CORS flag
-  // and request's mode.
-  KURL request_url = web_request_url;
-
-  if (!SchemeRegistry::ShouldTreatURLSchemeAsCORSEnabled(
-          request_url.Protocol())) {
-    return CORSError::kRedirectDisallowedScheme;
-  }
-
-  // Block URLs including credentials as specified in the step 9 in
-  // https://fetch.spec.whatwg.org/#http-redirect-fetch.
-  //
-  // TODO(tyoshino): This check should be performed also when request's
-  // origin is not same origin with the redirect destination's origin.
-  if (!(request_url.User().IsEmpty() && request_url.Pass().IsEmpty()))
-    return CORSError::kRedirectContainsCredentials;
-
-  return base::nullopt;
-}
-
 base::Optional<CORSError> CheckPreflight(
     const int preflight_response_status_code) {
   // CORS preflight with 3XX is considered network error in
@@ -303,160 +273,6 @@
   return preflight_request;
 }
 
-WebString GetErrorString(const CORSError error,
-                         const WebURL& request_url,
-                         const WebURL& redirect_url,
-                         const int response_status_code,
-                         const WebHTTPHeaderMap& response_header,
-                         const WebSecurityOrigin& origin,
-                         const WebURLRequest::RequestContext context) {
-  static const char kNoCorsInformation[] =
-      " Have the server send the header with a valid value, or, if an opaque "
-      "response serves your needs, set the request's mode to 'no-cors' to "
-      "fetch the resource with CORS disabled.";
-
-  String redirect_denied =
-      redirect_url.IsValid()
-          ? String::Format(
-                "Redirect from '%s' to '%s' has been blocked by CORS policy: ",
-                request_url.GetString().Utf8().data(),
-                redirect_url.GetString().Utf8().data())
-          : String();
-
-  switch (error) {
-    case CORSError::kDisallowedByMode:
-      return String::Format(
-          "Failed to load '%s': Cross origin requests are not allowed by "
-          "request mode.",
-          request_url.GetString().Utf8().data());
-    case CORSError::kInvalidResponse:
-      return String::Format(
-          "%sInvalid response. Origin '%s' is therefore not allowed access.",
-          redirect_denied.Utf8().data(), origin.ToString().Utf8().data());
-    case CORSError::kSubOriginMismatch:
-      return String::Format(
-          "%sThe 'Access-Control-Allow-Suborigin' header has a value '%s' that "
-          "is not equal to the supplied suborigin. Origin '%s' is therefore "
-          "not allowed access.",
-          redirect_denied.Utf8().data(),
-          response_header.Get(HTTPNames::Access_Control_Allow_Suborigin)
-              .Utf8()
-              .data(),
-          origin.ToString().Utf8().data());
-    case CORSError::kWildcardOriginNotAllowed:
-      return String::Format(
-          "%sThe value of the 'Access-Control-Allow-Origin' header in the "
-          "response must not be the wildcard '*' when the request's "
-          "credentials mode is 'include'. Origin '%s' is therefore not allowed "
-          "access.%s",
-          redirect_denied.Utf8().data(), origin.ToString().Utf8().data(),
-          context == WebURLRequest::kRequestContextXMLHttpRequest
-              ? " The credentials mode of requests initiated by the "
-                "XMLHttpRequest is controlled by the withCredentials attribute."
-              : "");
-    case CORSError::kMissingAllowOriginHeader:
-      return String::Format(
-          "%sNo 'Access-Control-Allow-Origin' header is present on the "
-          "requested resource. Origin '%s' is therefore not allowed access."
-          "%s%s",
-          redirect_denied.Utf8().data(), origin.ToString().Utf8().data(),
-          IsInterestingStatusCode(response_status_code)
-              ? String::Format(" The response had HTTP status code %d.",
-                               response_status_code)
-                    .Utf8()
-                    .data()
-              : "",
-          context == WebURLRequest::kRequestContextFetch
-              ? " If an opaque response serves your needs, set the request's "
-                "mode to 'no-cors' to fetch the resource with CORS disabled."
-              : "");
-    case CORSError::kMultipleAllowOriginValues:
-      return String::Format(
-          "%sThe 'Access-Control-Allow-Origin' header contains multiple values "
-          "'%s', but only one is allowed. Origin '%s' is therefore not allowed "
-          "access.%s",
-          redirect_denied.Utf8().data(),
-          response_header.Get(HTTPNames::Access_Control_Allow_Origin)
-              .Utf8()
-              .data(),
-          origin.ToString().Utf8().data(),
-          context == WebURLRequest::kRequestContextFetch ? kNoCorsInformation
-                                                         : "");
-    case CORSError::kInvalidAllowOriginValue:
-      return String::Format(
-          "%sThe 'Access-Control-Allow-Origin' header contains the invalid "
-          "value '%s'. Origin '%s' is therefore not allowed access.%s",
-          redirect_denied.Utf8().data(),
-          response_header.Get(HTTPNames::Access_Control_Allow_Origin)
-              .Utf8()
-              .data(),
-          origin.ToString().Utf8().data(),
-          context == WebURLRequest::kRequestContextFetch ? kNoCorsInformation
-                                                         : "");
-    case CORSError::kAllowOriginMismatch:
-      return String::Format(
-          "%sThe 'Access-Control-Allow-Origin' header has a value '%s' that is "
-          "not equal to the supplied origin. Origin '%s' is therefore not "
-          "allowed access.%s",
-          redirect_denied.Utf8().data(),
-          response_header.Get(HTTPNames::Access_Control_Allow_Origin)
-              .Utf8()
-              .data(),
-          origin.ToString().Utf8().data(),
-          context == WebURLRequest::kRequestContextFetch ? kNoCorsInformation
-                                                         : "");
-    case CORSError::kDisallowCredentialsNotSetToTrue:
-      return String::Format(
-          "%sThe value of the 'Access-Control-Allow-Credentials' header in "
-          "the response is '%s' which must be 'true' when the request's "
-          "credentials mode is 'include'. Origin '%s' is therefore not allowed "
-          "access.%s",
-          redirect_denied.Utf8().data(),
-          response_header.Get(HTTPNames::Access_Control_Allow_Credentials)
-              .Utf8()
-              .data(),
-          origin.ToString().Utf8().data(),
-          (context == WebURLRequest::kRequestContextXMLHttpRequest
-               ? " The credentials mode of requests initiated by the "
-                 "XMLHttpRequest is controlled by the withCredentials "
-                 "attribute."
-               : ""));
-    case CORSError::kPreflightInvalidStatus:
-      return String::Format(
-          "Response for preflight has invalid HTTP status code %d.",
-          response_status_code);
-    case CORSError::kPreflightMissingAllowExternal:
-      return WebString(
-          "No 'Access-Control-Allow-External' header was present in the "
-          "preflight response for this external request (This is an "
-          "experimental header which is defined in "
-          "'https://wicg.github.io/cors-rfc1918/').");
-    case CORSError::kPreflightInvalidAllowExternal:
-      return String::Format(
-          "The 'Access-Control-Allow-External' header in the preflight "
-          "response for this external request had a value of '%s',  not 'true' "
-          "(This is an experimental header which is defined in "
-          "'https://wicg.github.io/cors-rfc1918/').",
-          response_header.Get(HTTPNames::Access_Control_Allow_External)
-              .Utf8()
-              .data());
-    case CORSError::kRedirectDisallowedScheme:
-      return String::Format(
-          "%sRedirect location '%s' has a disallowed scheme for cross-origin "
-          "requests.",
-          redirect_denied.Utf8().data(),
-          redirect_url.GetString().Utf8().data());
-    case CORSError::kRedirectContainsCredentials:
-      return String::Format(
-          "%sRedirect location '%s' contains a username and password, which is "
-          "disallowed for cross-origin requests.",
-          redirect_denied.Utf8().data(),
-          redirect_url.GetString().Utf8().data());
-  }
-  NOTREACHED();
-  return WebString();
-}
-
 WebHTTPHeaderSet ExtractCorsExposedHeaderNamesList(
     network::mojom::FetchCredentialsMode credentials_mode,
     const WebURLResponse& response) {
diff --git a/third_party/WebKit/Source/platform/heap/TraceTraits.h b/third_party/WebKit/Source/platform/heap/TraceTraits.h
index f2464fe..5ae4d06 100644
--- a/third_party/WebKit/Source/platform/heap/TraceTraits.h
+++ b/third_party/WebKit/Source/platform/heap/TraceTraits.h
@@ -221,7 +221,6 @@
  public:
   static void Trace(Visitor*, void* self);
 
-  static void MarkWrapperNoTracing(const ScriptWrappableVisitor*, const void*);
   static void TraceMarkedWrapper(const ScriptWrappableVisitor*, const void*);
   static HeapObjectHeader* GetHeapObjectHeader(const void*);
 
@@ -249,14 +248,6 @@
 }
 
 template <typename T>
-void TraceTrait<T>::MarkWrapperNoTracing(const ScriptWrappableVisitor* visitor,
-                                         const void* t) {
-  const T* traceable = ToWrapperTracingType(t);
-  DCHECK(!GetHeapObjectHeader(traceable)->IsWrapperHeaderMarked());
-  visitor->MarkWrapperHeader(GetHeapObjectHeader(traceable));
-}
-
-template <typename T>
 void TraceTrait<T>::TraceMarkedWrapper(const ScriptWrappableVisitor* visitor,
                                        const void* t) {
   const T* traceable = ToWrapperTracingType(t);
diff --git a/third_party/WebKit/Source/platform/loader/cors/CORS.cpp b/third_party/WebKit/Source/platform/loader/cors/CORS.cpp
index eefedd4..b492b34 100644
--- a/third_party/WebKit/Source/platform/loader/cors/CORS.cpp
+++ b/third_party/WebKit/Source/platform/loader/cors/CORS.cpp
@@ -6,7 +6,9 @@
 
 #include "platform/network/HTTPHeaderMap.h"
 #include "platform/network/http_names.h"
+#include "platform/runtime_enabled_features.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/weborigin/SchemeRegistry.h"
 #include "platform/weborigin/SecurityOrigin.h"
 #include "platform/wtf/text/AtomicString.h"
 #include "services/network/public/cpp/cors/cors.h"
@@ -16,6 +18,12 @@
 
 namespace {
 
+bool IsInterestingStatusCode(int status_code) {
+  // Predicate that gates what status codes should be included in console error
+  // messages for responses containing no access control headers.
+  return status_code >= 400;
+}
+
 base::Optional<std::string> GetHeaderValue(const HTTPHeaderMap& header_map,
                                            const AtomicString& header_name) {
   if (header_map.Contains(header_name)) {
@@ -30,6 +38,160 @@
 
 namespace CORS {
 
+String GetErrorString(const network::mojom::CORSError error,
+                      const KURL& request_url,
+                      const KURL& redirect_url,
+                      const int response_status_code,
+                      const HTTPHeaderMap& response_header,
+                      const SecurityOrigin& origin,
+                      const WebURLRequest::RequestContext context) {
+  static const char kNoCorsInformation[] =
+      " Have the server send the header with a valid value, or, if an opaque "
+      "response serves your needs, set the request's mode to 'no-cors' to "
+      "fetch the resource with CORS disabled.";
+
+  String redirect_denied =
+      redirect_url.IsValid()
+          ? String::Format(
+                "Redirect from '%s' to '%s' has been blocked by CORS policy: ",
+                request_url.GetString().Utf8().data(),
+                redirect_url.GetString().Utf8().data())
+          : String();
+
+  switch (error) {
+    case network::mojom::CORSError::kDisallowedByMode:
+      return String::Format(
+          "Failed to load '%s': Cross origin requests are not allowed by "
+          "request mode.",
+          request_url.GetString().Utf8().data());
+    case network::mojom::CORSError::kInvalidResponse:
+      return String::Format(
+          "%sInvalid response. Origin '%s' is therefore not allowed access.",
+          redirect_denied.Utf8().data(), origin.ToString().Utf8().data());
+    case network::mojom::CORSError::kSubOriginMismatch:
+      return String::Format(
+          "%sThe 'Access-Control-Allow-Suborigin' header has a value '%s' that "
+          "is not equal to the supplied suborigin. Origin '%s' is therefore "
+          "not allowed access.",
+          redirect_denied.Utf8().data(),
+          response_header.Get(HTTPNames::Access_Control_Allow_Suborigin)
+              .Utf8()
+              .data(),
+          origin.ToString().Utf8().data());
+    case network::mojom::CORSError::kWildcardOriginNotAllowed:
+      return String::Format(
+          "%sThe value of the 'Access-Control-Allow-Origin' header in the "
+          "response must not be the wildcard '*' when the request's "
+          "credentials mode is 'include'. Origin '%s' is therefore not allowed "
+          "access.%s",
+          redirect_denied.Utf8().data(), origin.ToString().Utf8().data(),
+          context == WebURLRequest::kRequestContextXMLHttpRequest
+              ? " The credentials mode of requests initiated by the "
+                "XMLHttpRequest is controlled by the withCredentials attribute."
+              : "");
+    case network::mojom::CORSError::kMissingAllowOriginHeader:
+      return String::Format(
+          "%sNo 'Access-Control-Allow-Origin' header is present on the "
+          "requested resource. Origin '%s' is therefore not allowed access."
+          "%s%s",
+          redirect_denied.Utf8().data(), origin.ToString().Utf8().data(),
+          IsInterestingStatusCode(response_status_code)
+              ? String::Format(" The response had HTTP status code %d.",
+                               response_status_code)
+                    .Utf8()
+                    .data()
+              : "",
+          context == WebURLRequest::kRequestContextFetch
+              ? " If an opaque response serves your needs, set the request's "
+                "mode to 'no-cors' to fetch the resource with CORS disabled."
+              : "");
+    case network::mojom::CORSError::kMultipleAllowOriginValues:
+      return String::Format(
+          "%sThe 'Access-Control-Allow-Origin' header contains multiple values "
+          "'%s', but only one is allowed. Origin '%s' is therefore not allowed "
+          "access.%s",
+          redirect_denied.Utf8().data(),
+          response_header.Get(HTTPNames::Access_Control_Allow_Origin)
+              .Utf8()
+              .data(),
+          origin.ToString().Utf8().data(),
+          context == WebURLRequest::kRequestContextFetch ? kNoCorsInformation
+                                                         : "");
+    case network::mojom::CORSError::kInvalidAllowOriginValue:
+      return String::Format(
+          "%sThe 'Access-Control-Allow-Origin' header contains the invalid "
+          "value '%s'. Origin '%s' is therefore not allowed access.%s",
+          redirect_denied.Utf8().data(),
+          response_header.Get(HTTPNames::Access_Control_Allow_Origin)
+              .Utf8()
+              .data(),
+          origin.ToString().Utf8().data(),
+          context == WebURLRequest::kRequestContextFetch ? kNoCorsInformation
+                                                         : "");
+    case network::mojom::CORSError::kAllowOriginMismatch:
+      return String::Format(
+          "%sThe 'Access-Control-Allow-Origin' header has a value '%s' that is "
+          "not equal to the supplied origin. Origin '%s' is therefore not "
+          "allowed access.%s",
+          redirect_denied.Utf8().data(),
+          response_header.Get(HTTPNames::Access_Control_Allow_Origin)
+              .Utf8()
+              .data(),
+          origin.ToString().Utf8().data(),
+          context == WebURLRequest::kRequestContextFetch ? kNoCorsInformation
+                                                         : "");
+    case network::mojom::CORSError::kDisallowCredentialsNotSetToTrue:
+      return String::Format(
+          "%sThe value of the 'Access-Control-Allow-Credentials' header in "
+          "the response is '%s' which must be 'true' when the request's "
+          "credentials mode is 'include'. Origin '%s' is therefore not allowed "
+          "access.%s",
+          redirect_denied.Utf8().data(),
+          response_header.Get(HTTPNames::Access_Control_Allow_Credentials)
+              .Utf8()
+              .data(),
+          origin.ToString().Utf8().data(),
+          (context == WebURLRequest::kRequestContextXMLHttpRequest
+               ? " The credentials mode of requests initiated by the "
+                 "XMLHttpRequest is controlled by the withCredentials "
+                 "attribute."
+               : ""));
+    case network::mojom::CORSError::kPreflightInvalidStatus:
+      return String::Format(
+          "Response for preflight has invalid HTTP status code %d.",
+          response_status_code);
+    case network::mojom::CORSError::kPreflightMissingAllowExternal:
+      return WebString(
+          "No 'Access-Control-Allow-External' header was present in the "
+          "preflight response for this external request (This is an "
+          "experimental header which is defined in "
+          "'https://wicg.github.io/cors-rfc1918/').");
+    case network::mojom::CORSError::kPreflightInvalidAllowExternal:
+      return String::Format(
+          "The 'Access-Control-Allow-External' header in the preflight "
+          "response for this external request had a value of '%s',  not 'true' "
+          "(This is an experimental header which is defined in "
+          "'https://wicg.github.io/cors-rfc1918/').",
+          response_header.Get(HTTPNames::Access_Control_Allow_External)
+              .Utf8()
+              .data());
+    case network::mojom::CORSError::kRedirectDisallowedScheme:
+      return String::Format(
+          "%sRedirect location '%s' has a disallowed scheme for cross-origin "
+          "requests.",
+          redirect_denied.Utf8().data(),
+          redirect_url.GetString().Utf8().data());
+    case network::mojom::CORSError::kRedirectContainsCredentials:
+      return String::Format(
+          "%sRedirect location '%s' contains a username and password, which is "
+          "disallowed for cross-origin requests.",
+          redirect_denied.Utf8().data(),
+          redirect_url.GetString().Utf8().data());
+  }
+  NOTREACHED();
+  return WebString();
+}
+
 WTF::Optional<network::mojom::CORSError> CheckAccess(
     const KURL& response_url,
     const int response_status_code,
@@ -46,6 +208,20 @@
       credentials_mode, origin.ToUrlOrigin());
 }
 
+WTF::Optional<network::mojom::CORSError> CheckRedirectLocation(
+    const KURL& url) {
+  static const bool run_blink_side_scheme_check =
+      !RuntimeEnabledFeatures::OutOfBlinkCORSEnabled();
+  // TODO(toyoshim): Deprecate Blink side scheme check when we enable
+  // out-of-renderer CORS support. This will need to deprecate Blink APIs that
+  // are currently used by an embedder. See https://crbug.com/800669.
+  if (run_blink_side_scheme_check &&
+      !SchemeRegistry::ShouldTreatURLSchemeAsCORSEnabled(url.Protocol())) {
+    return network::mojom::CORSError::kRedirectDisallowedScheme;
+  }
+  return network::cors::CheckRedirectLocation(url, run_blink_side_scheme_check);
+}
+
 bool IsCORSEnabledRequestMode(network::mojom::FetchRequestMode request_mode) {
   return network::cors::IsCORSEnabledRequestMode(request_mode);
 }
diff --git a/third_party/WebKit/Source/platform/loader/cors/CORS.h b/third_party/WebKit/Source/platform/loader/cors/CORS.h
index eac21df80..176d1af 100644
--- a/third_party/WebKit/Source/platform/loader/cors/CORS.h
+++ b/third_party/WebKit/Source/platform/loader/cors/CORS.h
@@ -9,6 +9,8 @@
 
 #include "platform/PlatformExport.h"
 #include "platform/wtf/Optional.h"
+#include "platform/wtf/text/WTFString.h"
+#include "public/platform/WebURLRequest.h"
 #include "services/network/public/interfaces/cors.mojom-shared.h"
 #include "services/network/public/interfaces/fetch_api.mojom-shared.h"
 
@@ -18,9 +20,24 @@
 class KURL;
 class SecurityOrigin;
 
-// Thin wrapper functions to call ::network::cors functions from Blink core.
+// CORS related utility functions.
 namespace CORS {
 
+// Stringify CORSError mainly for inspector messages. Generated string should
+// not be exposed to JavaScript for security reasons.
+// For errors during the redirect check, valid KURL should be set to
+// |redirect_url|. Otherwise, it should be KURL(), the invalid instance.
+PLATFORM_EXPORT String GetErrorString(const network::mojom::CORSError,
+                                      const KURL& request_url,
+                                      const KURL& redirect_url,
+                                      const int response_status_code,
+                                      const HTTPHeaderMap&,
+                                      const SecurityOrigin&,
+                                      const WebURLRequest::RequestContext);
+
+// Thin wrapper functions below are for calling ::network::cors functions from
+// Blink core. Once Out-of-renderer CORS is enabled, following functions will
+// be removed.
 PLATFORM_EXPORT WTF::Optional<network::mojom::CORSError> CheckAccess(
     const KURL&,
     const int response_status_code,
@@ -28,6 +45,9 @@
     network::mojom::FetchCredentialsMode,
     const SecurityOrigin&);
 
+PLATFORM_EXPORT WTF::Optional<network::mojom::CORSError> CheckRedirectLocation(
+    const KURL&);
+
 PLATFORM_EXPORT bool IsCORSEnabledRequestMode(network::mojom::FetchRequestMode);
 
 }  // namespace CORS
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
index 7d35ea48b..93e485e1 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceLoader.cpp
@@ -296,10 +296,10 @@
 
         if (!unused_preload) {
           Context().AddErrorConsoleMessage(
-              WebCORS::GetErrorString(
+              CORS::GetErrorString(
                   *cors_error, redirect_response.Url(), new_url,
                   redirect_response.HttpStatusCode(),
-                  redirect_response.HttpHeaderFields(), source_web_origin,
+                  redirect_response.HttpHeaderFields(), *source_origin.get(),
                   resource_->LastResourceRequest().GetRequestContext()),
               FetchContext::kJSSource);
         }
@@ -469,11 +469,11 @@
   error_msg.Append("' from origin '");
   error_msg.Append(source_origin->ToString());
   error_msg.Append("' has been blocked by CORS policy: ");
-  error_msg.Append(WebCORS::GetErrorString(
-      *cors_error, initial_request.Url(), WebURL(),
+  error_msg.Append(CORS::GetErrorString(
+      *cors_error, initial_request.Url(), KURL(),
       response_for_access_control.HttpStatusCode(),
-      response_for_access_control.HttpHeaderFields(),
-      WebSecurityOrigin(source_origin), initial_request.GetRequestContext()));
+      response_for_access_control.HttpHeaderFields(), *source_origin,
+      initial_request.GetRequestContext()));
 
   return CORSStatus::kFailed;
 }
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceTimingInfo.h b/third_party/WebKit/Source/platform/loader/fetch/ResourceTimingInfo.h
index 72fcdfde..7ce5d5b5cb 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceTimingInfo.h
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceTimingInfo.h
@@ -65,7 +65,6 @@
   double InitialTime() const { return initial_time_; }
   bool IsMainResource() const { return is_main_resource_; }
 
-  void SetInitiatorType(const AtomicString& type) { type_ = type; }
   const AtomicString& InitiatorType() const { return type_; }
 
   void SetOriginalTimingAllowOrigin(
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
index cc0053f..27b3b8d 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.cc
@@ -10,6 +10,7 @@
 
 #include "base/bind.h"
 #include "base/bit_cast.h"
+#include "base/debug/crash_logging.h"
 #include "base/rand_util.h"
 #include "base/time/default_tick_clock.h"
 #include "base/time/tick_clock.h"
@@ -525,6 +526,10 @@
   base::ThreadTicks task_start_thread_time;
   if (should_record_thread_time)
     task_start_thread_time = base::ThreadTicks::Now();
+  base::debug::SetCrashKeyString(main_thread_only().file_name_crash_key,
+                                 pending_task.posted_from.file_name());
+  base::debug::SetCrashKeyString(main_thread_only().function_name_crash_key,
+                                 pending_task.posted_from.function_name());
 
   {
     TRACE_EVENT1("renderer.scheduler", "TaskQueueManager::RunTask", "queue",
@@ -856,5 +861,17 @@
   return memory_corruption_sentinel_ == kMemoryCorruptionSentinelValue;
 }
 
+void TaskQueueManager::EnableCrashKeys(
+    const char* file_name_crash_key_name,
+    const char* function_name_crash_key_name) {
+  DCHECK(!main_thread_only().file_name_crash_key);
+  DCHECK(!main_thread_only().function_name_crash_key);
+  main_thread_only().file_name_crash_key = base::debug::AllocateCrashKeyString(
+      file_name_crash_key_name, base::debug::CrashKeySize::Size64);
+  main_thread_only().function_name_crash_key =
+      base::debug::AllocateCrashKeyString(function_name_crash_key_name,
+                                          base::debug::CrashKeySize::Size64);
+}
+
 }  // namespace scheduler
 }  // namespace blink
diff --git a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h
index 012ea5f2d..e38efe6 100644
--- a/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h
+++ b/third_party/WebKit/Source/platform/scheduler/base/task_queue_manager.h
@@ -27,6 +27,10 @@
 #include "platform/scheduler/base/task_queue_selector.h"
 
 namespace base {
+namespace debug {
+struct CrashKeyString;
+}  // namespace debug
+
 namespace trace_event {
 class ConvertableToTraceFormat;
 }  // namespace trace_event
@@ -146,6 +150,9 @@
     return task_queue;
   }
 
+  void EnableCrashKeys(const char* file_name_crash_key,
+                       const char* function_name_crash_key);
+
   // Called once to set the Observer. This function is called on the main
   // thread. If |observer| is null, then no callbacks will occur.
   // Note: |observer| is expected to outlive the SchedulerHelper.
@@ -294,7 +301,25 @@
     int nesting_depth = 0;
   };
 
-  // TODO(alexclarke): Add a MainThreadOnly struct too.
+  // TODO(scheduler-dev): Review if we really need non-nestable tasks at all.
+  struct NonNestableTask {
+    internal::TaskQueueImpl::Task task;
+    internal::TaskQueueImpl* task_queue;
+    Sequence::WorkType work_type;
+  };
+  using NonNestableTaskDeque = WTF::Deque<NonNestableTask, 8>;
+
+  // TODO(alexclarke): Move more things into MainThreadOnly
+  struct MainThreadOnly {
+    MainThreadOnly() = default;
+
+    int nesting_depth = 0;
+    NonNestableTaskDeque non_nestable_task_queue;
+    // TODO(altimin): Switch to instruction pointer crash key when it's
+    // available.
+    base::debug::CrashKeyString* file_name_crash_key = nullptr;
+    base::debug::CrashKeyString* function_name_crash_key = nullptr;
+  };
 
   // TaskQueueSelector::Observer:
   void OnTaskQueueEnabled(internal::TaskQueueImpl* queue) override;
@@ -438,20 +463,6 @@
 
   int32_t memory_corruption_sentinel_;
 
-  // TODO(scheduler-dev): Review if we really need non-nestable tasks at all.
-  struct NonNestableTask {
-    internal::TaskQueueImpl::Task task;
-    internal::TaskQueueImpl* task_queue;
-    Sequence::WorkType work_type;
-  };
-  using NonNestableTaskDeque = WTF::Deque<NonNestableTask, 8>;
-
-  // TODO(alexclarke): Move more things into MainThreadOnly
-  struct MainThreadOnly {
-    int nesting_depth = 0;
-    NonNestableTaskDeque non_nestable_task_queue;
-  };
-
   MainThreadOnly main_thread_only_;
   MainThreadOnly& main_thread_only() {
     DCHECK_CALLED_ON_VALID_THREAD(main_thread_checker_);
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc
index dbc2e276..68e90fc 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/main_thread_scheduler_helper.cc
@@ -23,6 +23,8 @@
                            MainThreadTaskQueue::QueueType::kControl)
                            .SetShouldNotifyObservers(false))) {
   InitDefaultQueues(default_task_queue_, control_task_queue_);
+  task_queue_manager_->EnableCrashKeys("blink_scheduler_task_file_name",
+                                       "blink_scheduler_task_function_name");
 }
 
 MainThreadSchedulerHelper::~MainThreadSchedulerHelper() {
diff --git a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
index aa1b679..6bd96f8 100644
--- a/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
+++ b/third_party/WebKit/Source/platform/weborigin/SecurityOriginTest.cpp
@@ -615,4 +615,50 @@
   }
 }
 
+TEST_F(SecurityOriginTest, EffectiveDomain) {
+  constexpr struct {
+    const char* expected_effective_domain;
+    const char* origin;
+  } kTestCases[] = {
+      {NULL, ""},
+      {NULL, "null"},
+      {"", "file://"},
+      {"127.0.0.1", "https://127.0.0.1"},
+      {"[::1]", "https://[::1]"},
+      {"example.com", "file://example.com/foo"},
+      {"example.com", "http://example.com"},
+      {"example.com", "http://example.com:80"},
+      {"example.com", "https://example.com"},
+      {"suborigin.example.com", "https://suborigin.example.com"},
+  };
+
+  for (const auto& test : kTestCases) {
+    scoped_refptr<const SecurityOrigin> origin =
+        SecurityOrigin::CreateFromString(test.origin);
+    if (test.expected_effective_domain) {
+      EXPECT_EQ(test.expected_effective_domain, origin->Domain());
+    } else {
+      EXPECT_TRUE(origin->Domain().IsEmpty());
+    }
+  }
+}
+
+TEST_F(SecurityOriginTest, EffectiveDomainSetFromDom) {
+  constexpr struct {
+    const char* domain_set_from_dom;
+    const char* expected_effective_domain;
+    const char* origin;
+  } kDomainTestCases[] = {
+      {"example.com", "example.com", "http-so://suborigin.example.com"},
+      {"example.com", "example.com", "http://www.suborigin.example.com"},
+  };
+
+  for (const auto& test : kDomainTestCases) {
+    scoped_refptr<SecurityOrigin> origin =
+        SecurityOrigin::CreateFromString(test.origin);
+    origin->SetDomainFromDOM(test.domain_set_from_dom);
+    EXPECT_EQ(test.expected_effective_domain, origin->Domain());
+  }
+}
+
 }  // namespace blink
diff --git a/third_party/WebKit/common/message_port/message_port_channel.cc b/third_party/WebKit/common/message_port/message_port_channel.cc
index dca6a76..3141602 100644
--- a/third_party/WebKit/common/message_port/message_port_channel.cc
+++ b/third_party/WebKit/common/message_port/message_port_channel.cc
@@ -4,14 +4,6 @@
 
 #include "third_party/WebKit/common/message_port/message_port_channel.h"
 
-#include "base/bind.h"
-#include "base/containers/span.h"
-#include "base/logging.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "mojo/public/cpp/system/message_pipe.h"
-#include "third_party/WebKit/common/message_port/message_port.mojom.h"
-#include "third_party/WebKit/common/message_port/transferable_message_struct_traits.h"
-
 namespace blink {
 
 MessagePortChannel::~MessagePortChannel() = default;
@@ -35,7 +27,6 @@
 }
 
 mojo::ScopedMessagePipeHandle MessagePortChannel::ReleaseHandle() const {
-  state_->StopWatching();
   return state_->TakeHandle();
 }
 
@@ -57,178 +48,16 @@
   return ports;
 }
 
-void MessagePortChannel::PostMessage(const uint8_t* encoded_message,
-                                     size_t encoded_message_size,
-                                     std::vector<MessagePortChannel> ports) {
-  TransferableMessage msg;
-  msg.encoded_message = base::make_span(encoded_message, encoded_message_size);
-  msg.ports = std::move(ports);
-  PostMojoMessage(mojom::TransferableMessage::SerializeAsMessage(&msg));
-}
-
-void MessagePortChannel::PostMojoMessage(mojo::Message message) {
-  DCHECK(state_->handle().is_valid());
-
-  // NOTE: It is OK to ignore the return value of mojo::WriteMessageNew here.
-  // HTML MessagePorts have no way of reporting when the peer is gone.
-  mojo::WriteMessageNew(state_->handle().get(), message.TakeMojoMessage(),
-                        MOJO_WRITE_MESSAGE_FLAG_NONE);
-}
-
-bool MessagePortChannel::GetMessage(std::vector<uint8_t>* encoded_message,
-                                    std::vector<MessagePortChannel>* ports) {
-  mojo::Message message;
-  bool success = GetMojoMessage(&message);
-  if (!success)
-    return false;
-
-  TransferableMessage msg;
-  success = mojom::TransferableMessage::DeserializeFromMessage(
-      std::move(message), &msg);
-  if (!success)
-    return false;
-
-  *encoded_message = std::move(msg.owned_encoded_message);
-  *ports = std::move(msg.ports);
-
-  return true;
-}
-
-bool MessagePortChannel::GetMojoMessage(mojo::Message* message) {
-  DCHECK(state_->handle().is_valid());
-  mojo::ScopedMessageHandle message_handle;
-  MojoResult rv = mojo::ReadMessageNew(state_->handle().get(), &message_handle,
-                                       MOJO_READ_MESSAGE_FLAG_NONE);
-  if (rv != MOJO_RESULT_OK)
-    return false;
-
-  *message = std::move(message_handle);
-  return true;
-}
-
-void MessagePortChannel::SetCallback(
-    const base::Closure& callback,
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
-  state_->StopWatching();
-  state_->StartWatching(callback, task_runner);
-}
-
-void MessagePortChannel::ClearCallback() {
-  state_->StopWatching();
-}
-
 MessagePortChannel::State::State() = default;
 
 MessagePortChannel::State::State(mojo::ScopedMessagePipeHandle handle)
     : handle_(std::move(handle)) {}
 
-void MessagePortChannel::State::StartWatching(
-    const base::Closure& callback,
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
-  base::AutoLock lock(lock_);
-  DCHECK(!callback_);
-  DCHECK(handle_.is_valid());
-  DCHECK(task_runner);
-  callback_ = callback;
-  task_runner_ = task_runner;
-
-  DCHECK(!watcher_handle_.is_valid());
-  MojoResult rv = CreateWatcher(&State::CallOnHandleReady, &watcher_handle_);
-  DCHECK_EQ(MOJO_RESULT_OK, rv);
-
-  // Balanced in CallOnHandleReady when MOJO_RESULT_CANCELLED is received.
-  AddRef();
-
-  // NOTE: An HTML MessagePort does not receive an event to tell it when the
-  // peer has gone away, so we only watch for readability here.
-  rv = MojoWatch(watcher_handle_.get().value(), handle_.get().value(),
-                 MOJO_HANDLE_SIGNAL_READABLE, MOJO_WATCH_CONDITION_SATISFIED,
-                 reinterpret_cast<uintptr_t>(this));
-  DCHECK_EQ(MOJO_RESULT_OK, rv);
-
-  ArmWatcher();
-}
-
-void MessagePortChannel::State::StopWatching() {
-  mojo::ScopedWatcherHandle watcher_handle;
-
-  {
-    // NOTE: Resetting the watcher handle may synchronously invoke
-    // OnHandleReady(), so we don't hold |lock_| while doing that.
-    base::AutoLock lock(lock_);
-    watcher_handle = std::move(watcher_handle_);
-    callback_.Reset();
-    task_runner_ = nullptr;
-  }
-}
-
 mojo::ScopedMessagePipeHandle MessagePortChannel::State::TakeHandle() {
   base::AutoLock lock(lock_);
-  DCHECK(!watcher_handle_.is_valid());
   return std::move(handle_);
 }
 
 MessagePortChannel::State::~State() = default;
 
-void MessagePortChannel::State::ArmWatcher() {
-  lock_.AssertAcquired();
-
-  if (!watcher_handle_.is_valid())
-    return;
-
-  uint32_t num_ready_contexts = 1;
-  uintptr_t ready_context;
-  MojoResult ready_result;
-  MojoHandleSignalsState ready_state;
-  MojoResult rv =
-      MojoArmWatcher(watcher_handle_.get().value(), &num_ready_contexts,
-                     &ready_context, &ready_result, &ready_state);
-  if (rv == MOJO_RESULT_OK)
-    return;
-
-  // The watcher could not be armed because it would notify immediately.
-  DCHECK_EQ(MOJO_RESULT_FAILED_PRECONDITION, rv);
-  DCHECK_EQ(1u, num_ready_contexts);
-  DCHECK_EQ(reinterpret_cast<uintptr_t>(this), ready_context);
-
-  if (ready_result == MOJO_RESULT_OK) {
-    // The handle is already signaled, so we trigger a callback now.
-    task_runner_->PostTask(
-        FROM_HERE, base::BindOnce(&State::OnHandleReady, this, MOJO_RESULT_OK));
-    return;
-  }
-
-  if (ready_result == MOJO_RESULT_FAILED_PRECONDITION) {
-    DVLOG(1) << this << " MojoArmWatcher failed because of a broken pipe.";
-    return;
-  }
-
-  NOTREACHED();
-}
-
-void MessagePortChannel::State::OnHandleReady(MojoResult result) {
-  base::AutoLock lock(lock_);
-  if (result == MOJO_RESULT_OK && callback_) {
-    callback_.Run();
-    ArmWatcher();
-  } else {
-    // And now his watch is ended.
-  }
-}
-
-// static
-void MessagePortChannel::State::CallOnHandleReady(
-    uintptr_t context,
-    MojoResult result,
-    MojoHandleSignalsState signals_state,
-    MojoWatcherNotificationFlags flags) {
-  auto* state = reinterpret_cast<State*>(context);
-  if (result == MOJO_RESULT_CANCELLED) {
-    // Balanced in MessagePortChannel::State::StartWatching().
-    state->Release();
-  } else {
-    state->OnHandleReady(result);
-  }
-}
-
 }  // namespace blink
diff --git a/third_party/WebKit/common/message_port/message_port_channel.h b/third_party/WebKit/common/message_port/message_port_channel.h
index 531d3ce..7913125 100644
--- a/third_party/WebKit/common/message_port/message_port_channel.h
+++ b/third_party/WebKit/common/message_port/message_port_channel.h
@@ -7,42 +7,19 @@
 
 #include <vector>
 
-#include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/synchronization/lock.h"
-#include "mojo/public/cpp/bindings/message.h"
 #include "mojo/public/cpp/system/message_pipe.h"
-#include "mojo/public/cpp/system/watcher.h"
 #include "third_party/WebKit/common/common_export.h"
 
 namespace blink {
 
 // MessagePortChannel corresponds to a HTML MessagePort. It is a thin wrapper
-// around a Mojo MessagePipeHandle and provides methods for reading and writing
-// messages.
-//
-// A MessagePortChannel is only actively listening for incoming messages once
-// SetCallback has been called with a valid callback. If ClearCallback is
-// called (or if SetCallback is called with a null callback), then the
-// MessagePortChannel will stop listening for incoming messages. The callback
-// runs on an unspecified background thread.
-//
-// Upon destruction, if the MessagePortChannel is listening for incoming
-// messages, then the destructor will first synchronize with the background
-// thread, waiting for it to finish any in-process callback before closing the
-// underlying MessagePipeHandle. This synchronization ensures that any code
-// running in the callback can be sure to not worry about the MessagePortChannel
-// becoming invalid during callback execution.
-//
-// MessagePortChannel methods may be used from any thread; however, care must be
-// taken when using ReleaseHandle, ReleaseHandles or when destroying a
-// MessagePortChannel instance. The MessagePortChannel class does not
-// synchronize those methods with methods like PostMessage, GetMessage and
-// SetCallback that use the underlying MessagePipeHandle.
-//
-// TODO(darin): Make this class move-only once no longer used with Chrome IPC.
-//
+// around a Mojo MessagePipeHandle and used to provide methods for reading and
+// writing messages. Currently all reading and writing is handled separately
+// by other code, so MessagePortChannel is nothing other than a ref-counted
+// holder of a mojo MessagePipeHandle, and is in the process of being removed.
 class BLINK_COMMON_EXPORT MessagePortChannel {
  public:
   ~MessagePortChannel();
@@ -62,43 +39,12 @@
   static std::vector<MessagePortChannel> CreateFromHandles(
       std::vector<mojo::ScopedMessagePipeHandle> handles);
 
-  // Sends an encoded message (along with ports to transfer) to this port's
-  // peer.
-  void PostMessage(const uint8_t* encoded_message,
-                   size_t encoded_message_size,
-                   std::vector<MessagePortChannel> ports);
-
-  // Sends a serialized mojom::MessagePortMessage to this port's peer.
-  void PostMojoMessage(mojo::Message message);
-
-  // Get the next available encoded message if any. Returns true if a message
-  // was read.
-  bool GetMessage(std::vector<uint8_t>* encoded_message,
-                  std::vector<MessagePortChannel>* ports);
-
-  // Get the next available serialized message if any. Returns true if a message
-  // was read.
-  bool GetMojoMessage(mojo::Message* message);
-
-  // This callback will be invoked on a background thread when messages are
-  // available to be read via GetMessage. It must not synchronously call back
-  // into the MessagePortChannel instance.
-  void SetCallback(const base::Closure& callback,
-                   scoped_refptr<base::SingleThreadTaskRunner> task_runner);
-
-  // Clears any callback specified by a prior call to SetCallback.
-  void ClearCallback();
-
  private:
   class State : public base::RefCountedThreadSafe<State> {
    public:
     State();
     explicit State(mojo::ScopedMessagePipeHandle handle);
 
-    void StartWatching(const base::Closure& callback,
-                       scoped_refptr<base::SingleThreadTaskRunner> task_runner);
-    void StopWatching();
-
     mojo::ScopedMessagePipeHandle TakeHandle();
 
     const mojo::ScopedMessagePipeHandle& handle() const { return handle_; }
@@ -108,25 +54,10 @@
 
     ~State();
 
-    void ArmWatcher();
-    void OnHandleReady(MojoResult result);
-
-    static void CallOnHandleReady(uintptr_t context,
-                                  MojoResult result,
-                                  MojoHandleSignalsState signals_state,
-                                  MojoWatcherNotificationFlags flags);
-
     // Guards access to the fields below.
     base::Lock lock_;
 
-    mojo::ScopedWatcherHandle watcher_handle_;
     mojo::ScopedMessagePipeHandle handle_;
-
-    // Callback to invoke when the State is notified about a change to
-    // |handle_|'s signaling state.
-    base::Closure callback_;
-
-    scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
   };
   mutable scoped_refptr<State> state_;
 };
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn
index 4f219a9..7bc2dd3f 100644
--- a/third_party/WebKit/public/BUILD.gn
+++ b/third_party/WebKit/public/BUILD.gn
@@ -303,6 +303,7 @@
     "platform/WebRect.h",
     "platform/WebReferrerPolicy.h",
     "platform/WebRenderingStats.h",
+    "platform/WebResourceTimingInfo.h",
     "platform/WebRuntimeFeatures.h",
     "platform/WebScopedVirtualTimePauser.h",
     "platform/WebScreenInfo.h",
diff --git a/third_party/WebKit/public/platform/WebCORS.h b/third_party/WebKit/public/platform/WebCORS.h
index e6d5035..bcb3b1f 100644
--- a/third_party/WebKit/public/platform/WebCORS.h
+++ b/third_party/WebKit/public/platform/WebCORS.h
@@ -44,27 +44,14 @@
 
 namespace WebCORS {
 
-// Given a redirected-to URL, check if the location is allowed
-// according to CORS. That is:
-// - the URL has a CORS supported scheme and
-// - the URL does not contain the userinfo production.
-//
-// Use |GetErrorString()| to construct a user-friendly error message.
-BLINK_PLATFORM_EXPORT base::Optional<network::mojom::CORSError>
-CheckRedirectLocation(const WebURL&);
-
 // Perform the required CORS checks on the response to a preflight request.
 // Returns |kPreflightSuccess| if preflight response was successful.
-//
-// Use |GetErrorString()| to construct a user-friendly error message.
 BLINK_PLATFORM_EXPORT base::Optional<network::mojom::CORSError> CheckPreflight(
     const int preflight_response_status_code);
 
 // Error checking for the currently experimental
 // "Access-Control-Allow-External:" header. Shares error conditions with
 // standard preflight checking.
-//
-// Use |GetErrorString()| to construct a user-friendly error message.
 BLINK_PLATFORM_EXPORT base::Optional<network::mojom::CORSError>
 CheckExternalPreflight(const WebHTTPHeaderMap&);
 
@@ -83,19 +70,6 @@
     network::mojom::FetchCredentialsMode,
     ResourceLoaderOptions&);
 
-// Stringify CORSError mainly for inspector messages. Generated string should
-// not be exposed to JavaScript for security reasons.
-// For errors during the redirect check, valid WebURL should be set to
-// |redirect_url|. Otherwise, it should be WebURL(), the invalid instance.
-BLINK_PLATFORM_EXPORT WebString
-GetErrorString(const network::mojom::CORSError,
-               const WebURL& request_url,
-               const WebURL& redirect_url,
-               const int response_status_code,
-               const WebHTTPHeaderMap&,
-               const WebSecurityOrigin&,
-               const WebURLRequest::RequestContext);
-
 BLINK_PLATFORM_EXPORT WebHTTPHeaderSet
 ExtractCorsExposedHeaderNamesList(network::mojom::FetchCredentialsMode,
                                   const WebURLResponse&);
diff --git a/third_party/WebKit/public/platform/WebResourceTimingInfo.h b/third_party/WebKit/public/platform/WebResourceTimingInfo.h
new file mode 100644
index 0000000..2a9b2c4a
--- /dev/null
+++ b/third_party/WebKit/public/platform/WebResourceTimingInfo.h
@@ -0,0 +1,79 @@
+// Copyright 2017 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 WebResourceTimingInfo_h
+#define WebResourceTimingInfo_h
+
+#include <stdint.h>
+
+#include "WebCommon.h"
+#include "public/platform/WebString.h"
+#include "public/platform/WebURLLoadTiming.h"
+#include "public/platform/WebVector.h"
+
+namespace blink {
+
+// The browser-side equivalent to this struct is content::ServerTimingInfo.
+// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
+// duplicated in //content and //third_party/WebKit.
+struct WebServerTimingInfo {
+  WebServerTimingInfo(const WebString& name,
+                      double duration,
+                      const WebString& description)
+      : name(name), duration(duration), description(description) {}
+
+  WebString name;
+  double duration;
+  WebString description;
+};
+
+// This struct holds the information from PerformanceResourceTiming that needs
+// to be passed between processes. This is currently used to send timing
+// information about cross-process iframes for window.performance. The
+// browser-side equivalent to this struct is content::ResourceTimingInfo.
+// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
+// duplicated in //content and //third_party/WebKit.
+struct WebResourceTimingInfo {
+  // The name to associate with the performance entry. For iframes, this is
+  // typically the initial URL of the iframe resource.
+  WebString name;
+  double start_time;
+
+  WebString alpn_negotiated_protocol;
+  WebString connection_info;
+
+  WebURLLoadTiming timing;
+  double last_redirect_end_time;
+  double finish_time;
+
+  uint64_t transfer_size;
+  uint64_t encoded_body_size;
+  uint64_t decoded_body_size;
+
+  bool did_reuse_connection;
+
+  // TODO(dcheng): The way this code works is fairly confusing: it might seem
+  // unusual to store policy members like |allow_timing_details| inline, rather
+  // than just clearing the fields. The reason for this complexity is because
+  // PerformanceNavigationTiming inherits and shares many of the same fields
+  // exposed by PerformanceResourceTiming, but the underlying behavior is a
+  // little different.
+  bool allow_timing_details;
+  bool allow_redirect_details;
+
+  // Normally, the timestamps are relative to the time origin. In most cases,
+  // these timestamps should be positive value, so 0 is used to mark invalid
+  // negative values.
+  //
+  // However, ServiceWorker navigation preloads may be negative, since these
+  // requests may be started before the service worker started. In those cases,
+  // this flag should be set to true.
+  bool allow_negative_values;
+
+  WebVector<WebServerTimingInfo> server_timing;
+};
+
+}  // namespace blink
+
+#endif
diff --git a/third_party/WebKit/public/platform/WebURLLoadTiming.h b/third_party/WebKit/public/platform/WebURLLoadTiming.h
index ecc5e5a..c31d262 100644
--- a/third_party/WebKit/public/platform/WebURLLoadTiming.h
+++ b/third_party/WebKit/public/platform/WebURLLoadTiming.h
@@ -42,6 +42,9 @@
 
 class ResourceLoadTiming;
 
+// The browser-side equivalent to this struct is content::ResourceLoadTiming.
+// TODO(dcheng): Migrate this struct over to Mojo so it doesn't need to be
+// duplicated in //content and //third_party/WebKit.
 class WebURLLoadTiming {
  public:
   ~WebURLLoadTiming() { Reset(); }
diff --git a/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom b/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom
index f58f6d5..2ad4be8 100644
--- a/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom
+++ b/third_party/WebKit/public/platform/modules/credentialmanager/credential_manager.mojom
@@ -25,6 +25,9 @@
   PASSWORD_STORE_UNAVAILABLE,
   NOT_ALLOWED,
   NOT_SUPPORTED,
+  INVALID_DOMAIN,
+  TIMED_OUT,
+  NOT_IMPLEMENTED,
   UNKNOWN
 };
 
diff --git a/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom b/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom
index f2cd5be1..901da9b2 100644
--- a/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom
+++ b/third_party/WebKit/public/platform/modules/webauth/authenticator.mojom
@@ -17,6 +17,9 @@
   PENDING_REQUEST,
   NOT_ALLOWED_ERROR,
   NOT_SUPPORTED_ERROR,
+  INVALID_DOMAIN,
+  TIMED_OUT,
+  NOT_IMPLEMENTED,
   UNKNOWN_ERROR,
 };
 
@@ -42,7 +45,7 @@
   array<uint8> attestation_object;
 };
 
-struct GetAssertionResponse {
+struct GetAssertionAuthenticatorResponse {
   CommonCredentialInfo info;
 
   // A blob of data returned by the authenticator after generating an assertion.
@@ -60,7 +63,7 @@
 // Information about the relying party. These fields take arbitrary input.
 struct PublicKeyCredentialRpEntity {
   // An ASCII serialization of an origin.
-  string? id;
+  string id;
 
   // Friendly name associated with the relying party intended for display.
   // e.g. "Acme Corporation".
@@ -94,6 +97,24 @@
   int32 algorithm_identifier;
 };
 
+// Parameters passed into calls to GetAssertion.
+struct PublicKeyCredentialRequestOptions {
+  // An indefinite-length blob passed from the the relying party server,
+  // to be sent to an authenticator for signing.
+  array<uint8> challenge;
+
+  // Time to wait for an authenticator to complete an operation.
+  // Adjusted to fall within a client-defined range.
+  mojo.common.mojom.TimeDelta adjusted_timeout;
+
+  // An ASCII serialization of the origin claimed by the relying party.
+  string? relying_party_id;
+
+  // A list of credentials the relying party knows about and would
+  // accept as the signing credential.
+  array<PublicKeyCredentialDescriptor> allow_credentials;
+};
+
 // Parameters passed into calls to MakeCredential.
 struct MakePublicKeyCredentialOptions {
   // Information about the relying party and user entities, respectively.
@@ -102,13 +123,21 @@
   PublicKeyCredentialRpEntity relying_party;
   PublicKeyCredentialUserEntity user;
 
-  // A blob passed from the the relying party server.
+  // An indefinite-length blob passed from the the relying party server,
+  // to be sent to an authenticator to make a credential.
   array<uint8> challenge;
 
+  // Parameters defining the type of created credential that the relying
+  // party would accept.
   array<PublicKeyCredentialParameters> public_key_parameters;
 
+  // Time to wait for an authenticator to complete an operation.
+  // Adjusted to fall within a client-defined range.
   mojo.common.mojom.TimeDelta adjusted_timeout;
 
+  // A list of credentials the relying party knows about. If an
+  // authenticator has one of these credentials, it should not
+  // create a new one.
   array<PublicKeyCredentialDescriptor> exclude_credentials;
 
   // TODO(kpaulhamus): add AuthenticatorSelectionCriteria
@@ -141,7 +170,13 @@
 interface Authenticator {
   // Gets the credential info for a new public key credential created by an
   // authenticator for the given |MakePublicKeyCredentialOptions|
-  // [MakeCredentialAuthenticatorResponse] will only be set if status == SUCCESS.
+  // [MakeCredentialAuthenticatorResponse] will be set if and only if status == SUCCESS.
   MakeCredential(MakePublicKeyCredentialOptions options)
       => (AuthenticatorStatus status, MakeCredentialAuthenticatorResponse? credential);
+
+  // Uses an existing credential to produce an assertion for the given
+  // |PublicKeyCredentialRequestOptions|.
+  // |GetAssertionResponse| will be set if and only if status == SUCCESS.
+  GetAssertion(PublicKeyCredentialRequestOptions options)
+      => (AuthenticatorStatus status, GetAssertionAuthenticatorResponse? credential);
 };
diff --git a/third_party/WebKit/public/web/WebEmbeddedWorker.h b/third_party/WebKit/public/web/WebEmbeddedWorker.h
index fbda208..324b4c3 100644
--- a/third_party/WebKit/public/web/WebEmbeddedWorker.h
+++ b/third_party/WebKit/public/web/WebEmbeddedWorker.h
@@ -71,7 +71,7 @@
 
   // Inspector related methods.
   virtual void AddMessageToConsole(const WebConsoleMessage&) = 0;
-  virtual void GetDevToolsAgent(
+  virtual void BindDevToolsAgent(
       mojo::ScopedInterfaceEndpointHandle devtools_agent_request) = 0;
 };
 
diff --git a/third_party/WebKit/public/web/WebFrameClient.h b/third_party/WebKit/public/web/WebFrameClient.h
index e21482c9..90ea6194 100644
--- a/third_party/WebKit/public/web/WebFrameClient.h
+++ b/third_party/WebKit/public/web/WebFrameClient.h
@@ -118,6 +118,7 @@
 struct WebPluginParams;
 struct WebPopupMenuInfo;
 struct WebRect;
+struct WebResourceTimingInfo;
 struct WebScrollIntoViewParams;
 struct WebURLError;
 
@@ -486,6 +487,10 @@
   // The frame's theme color has changed.
   virtual void DidChangeThemeColor() {}
 
+  // Called to report resource timing information for this frame to the parent.
+  // Only used when the parent frame is remote.
+  virtual void ForwardResourceTimingToParent(const WebResourceTimingInfo&) {}
+
   // Called to dispatch a load event for this frame in the FrameOwner of an
   // out-of-process parent frame.
   virtual void DispatchLoad() {}
diff --git a/third_party/WebKit/public/web/WebRemoteFrame.h b/third_party/WebKit/public/web/WebRemoteFrame.h
index eddc862..0cdd934 100644
--- a/third_party/WebKit/public/web/WebRemoteFrame.h
+++ b/third_party/WebKit/public/web/WebRemoteFrame.h
@@ -22,6 +22,7 @@
 class WebString;
 class WebView;
 struct WebRect;
+struct WebResourceTimingInfo;
 struct WebScrollIntoViewParams;
 
 class WebRemoteFrame : public WebFrame {
@@ -90,7 +91,10 @@
   virtual void SetReplicatedInsecureNavigationsSet(
       const std::vector<unsigned>&) = 0;
 
-  virtual void DispatchLoadEventOnFrameOwner() = 0;
+  // Reports resource timing info for a navigation in this frame.
+  virtual void ForwardResourceTimingToParent(const WebResourceTimingInfo&) = 0;
+
+  virtual void DispatchLoadEventForFrameOwner() = 0;
 
   virtual void DidStartLoading() = 0;
   virtual void DidStopLoading() = 0;
diff --git a/third_party/WebKit/public/web/WebSharedWorker.h b/third_party/WebKit/public/web/WebSharedWorker.h
index 17f4755..34f5b05 100644
--- a/third_party/WebKit/public/web/WebSharedWorker.h
+++ b/third_party/WebKit/public/web/WebSharedWorker.h
@@ -70,7 +70,7 @@
   virtual void TerminateWorkerContext() = 0;
 
   virtual void PauseWorkerContextOnStart() = 0;
-  virtual void GetDevToolsAgent(
+  virtual void BindDevToolsAgent(
       mojo::ScopedInterfaceEndpointHandle devtools_agent_request) = 0;
 };
 
diff --git a/third_party/android_support_test_runner/BUILD.gn b/third_party/android_support_test_runner/BUILD.gn
index 2c5795b..34fdc78 100644
--- a/third_party/android_support_test_runner/BUILD.gn
+++ b/third_party/android_support_test_runner/BUILD.gn
@@ -9,7 +9,7 @@
   jar_path = "lib/runner-release-no-dep.jar"
   deps = [
     ":exposed_instrumentation_api_publish_java",
-    "//third_party/guava:guava_java",
+    "//third_party/guava:guava_android_java",
     "//third_party/junit",
   ]
 }
diff --git a/third_party/auto/README.chromium b/third_party/auto/README.chromium
index 008a3ea..6617f2c9 100644
--- a/third_party/auto/README.chromium
+++ b/third_party/auto/README.chromium
@@ -1,8 +1,8 @@
 Name: Auto
 Short Name: auto
 URL: https://github.com/google/auto
-Version: 71802f2ae74dae2744abd999f8434e13055c4ee3
-Date: November 1, 2017
+Version: 8a81a858ae7b78a1aef71ac3905fade0bbd64e82
+Date: January 15, 2018
 License: Apache 2.0
 License File: NOT_SHIPPED
 Security Critical: no
diff --git a/third_party/espresso/BUILD.gn b/third_party/espresso/BUILD.gn
index 9446300..3986e49 100644
--- a/third_party/espresso/BUILD.gn
+++ b/third_party/espresso/BUILD.gn
@@ -20,7 +20,7 @@
   jar_path = "lib/espresso-contrib-release-no-dep.jar"
   deps = [
     ":espresso_core_java",
-    "//third_party/guava:guava_java",
+    "//third_party/guava:guava_android_java",
     "//third_party/hamcrest:hamcrest_core_java",
   ]
 }
@@ -30,7 +30,7 @@
   jar_path = "lib/espresso-core-release-no-dep.jar"
   deps = [
     "//third_party/android_tools:android_support_annotations_java",
-    "//third_party/guava:guava_java",
+    "//third_party/guava:guava_android_java",
     "//third_party/hamcrest:hamcrest_core_java",
     "//third_party/javax_inject:javax_inject_java",
   ]
@@ -46,7 +46,7 @@
   jar_path = "lib/espresso-intents-release-no-dep.jar"
   deps = [
     "//third_party/android_support_test_runner:runner_java",
-    "//third_party/guava:guava_java",
+    "//third_party/guava:guava_android_java",
     "//third_party/hamcrest:hamcrest_core_java",
   ]
 }
@@ -56,7 +56,7 @@
   jar_path = "lib/espresso-web-release-no-dep.jar"
   deps = [
     ":espresso_core_java",
-    "//third_party/guava:guava_java",
+    "//third_party/guava:guava_android_java",
     "//third_party/hamcrest:hamcrest_core_java",
   ]
 }
diff --git a/third_party/guava/BUILD.gn b/third_party/guava/BUILD.gn
index c19aa86..01cb6b0 100644
--- a/third_party/guava/BUILD.gn
+++ b/third_party/guava/BUILD.gn
@@ -4,14 +4,27 @@
 
 import("//build/config/android/rules.gni")
 
-java_prebuilt("guava_java") {
-  # Since our build tooling depends on this target, we need it to not be
-  # "testonly = true", but production code must not depend on this as it
-  # results in size regressions. Thus, do not use this outside of tests and
-  # build tooling.
+# Upstream guava introduced versions with -android suffix starting with version
+# 22 to remove incompatible code with android. Thus we keep two jars, one for
+# the full guava and one that supports android. Please keep the versions in
+# sync with one another.
+
+java_prebuilt("guava_android_java") {
+  testonly = true
   supports_android = true
-  jar_path = "lib/guava.jar"
+  jar_path = "lib/guava-android.jar"
 
   # Avoids dependency cycle.
   no_build_hooks = true
 }
+
+java_prebuilt("guava_java") {
+  # Since our build tooling depends on this target, we need it to not be
+  # "testonly = true", but production code must not depend on this as it results
+  # in size regressions. Thus we specify exact packages through visibility.
+  visibility = [
+    "//third_party/auto:*",
+    "//third_party/robolectric:*",
+  ]
+  jar_path = "lib/guava.jar"
+}
diff --git a/third_party/guava/OWNERS b/third_party/guava/OWNERS
index 2cfd26c3..502ba10 100644
--- a/third_party/guava/OWNERS
+++ b/third_party/guava/OWNERS
@@ -1,3 +1,3 @@
 jbudorick@chromium.org
-mikecase@chromium.org
+wnwen@chromium.org
 yolandyan@chromium.org
diff --git a/third_party/guava/README.chromium b/third_party/guava/README.chromium
index cd9e24c1..12ec68e3 100644
--- a/third_party/guava/README.chromium
+++ b/third_party/guava/README.chromium
@@ -1,7 +1,7 @@
 Name: Google Core Libraries for Java
 Short Name: guava
 URL: https://github.com/google/guava
-Version: 20.0
+Version: 23.0
 License: Apache 2.0
 License File: NOT_SHIPPED
 Security Critical: no
diff --git a/third_party/guava/cipd.yaml b/third_party/guava/cipd.yaml
index 5ec6b9af..ea5b8693c 100644
--- a/third_party/guava/cipd.yaml
+++ b/third_party/guava/cipd.yaml
@@ -4,7 +4,21 @@
 
 # To create CIPD package run the following command.
 # cipd create --pkg-def cipd.yaml -tag version:$(cat version.txt)
+
+# See ./BUILD.gn for why we have a -android.jar version.
+# Example for updating guava in the current dir:
+#   Run:
+#     cipd auth-login
+#     rm lib/guava.jar lib/guava-android.jar
+#     wget https://repo1.maven.org/maven2/com/google/guava/guava/23.0-android/guava-23.0-android.jar -O lib/guava-android.jar
+#     wget https://repo1.maven.org/maven2/com/google/guava/guava/23.0/guava-23.0.jar -O lib/guava.jar
+#     cipd create --pkg-def cipd.yaml -tag version:23.0-cr0
+#   Manually update:
+#     README.chromium (version number)
+#     src/build/cipd/android/android.ensure (guava version tag)
+
 package: chromium/third_party/guava
-description: guava Java library
+description: guava java library
 data:
   - file: lib/guava.jar
+  - file: lib/guava-android.jar
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index 1b44988..3827be7 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -743,8 +743,9 @@
   """Creates and returns the argument parser."""
   parser = argparse.ArgumentParser()
   parser.add_argument(
-      '--lightweight-instrumentation', action='store_true', default=False,
-      help='Use the lightweight instrumentation path')
+      '--regular-instrumentation', action='store_false',
+      dest='lightweight_instrumentation',
+      help='Use the regular instrumentation path')
   parser.add_argument(
       '--buildbot', action='store_true',
       help='If true, the script expects to be run on a buildbot')
diff --git a/tools/gn/bootstrap/bootstrap.py b/tools/gn/bootstrap/bootstrap.py
index 6e7d145..3d29e50 100755
--- a/tools/gn/bootstrap/bootstrap.py
+++ b/tools/gn/bootstrap/bootstrap.py
@@ -225,10 +225,9 @@
     write_compiled_message(root_gen_dir,
         'base/trace_event/etw_manifest/chrome_events_win.man')
 
-  if is_android:
-    write_buildflag_header_manually(
-        root_gen_dir, 'base/android/library_loader.h',
-        {'USE_LLD': 'false'})
+  write_buildflag_header_manually(
+      root_gen_dir, 'base/android/library_loader.h',
+      {'USE_LLD': 'false'})
 
   write_gn_ninja(os.path.join(tempdir, 'build.ninja'),
                  root_gen_dir, options)
@@ -468,13 +467,12 @@
       'base/json/json_string_value_serializer.cc',
       'base/json/json_writer.cc',
       'base/json/string_escape.cc',
-      'base/lazy_instance.cc',
+      'base/lazy_instance_helpers.cc',
       'base/location.cc',
       'base/logging.cc',
       'base/md5.cc',
       'base/memory/ref_counted.cc',
       'base/memory/ref_counted_memory.cc',
-      'base/memory/singleton.cc',
       'base/memory/shared_memory_handle.cc',
       'base/memory/shared_memory_tracker.cc',
       'base/memory/weak_ptr.cc',
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index ee158c2..dc4dd5e 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -2898,6 +2898,8 @@
   <int value="192" label="RDH_NULL_CLIENT"/>
   <int value="193" label="RVH_WEB_UI_BINDINGS_MISMATCH"/>
   <int value="194" label="WCI_NEW_WIDGET_PROCESS_MISMATCH"/>
+  <int value="195" label="AUTH_INVALID_EFFECTIVE_DOMAIN"/>
+  <int value="196" label="AUTH_INVALID_RELYING_PARTY"/>
 </enum>
 
 <enum name="BadMessageReasonExtensions">
@@ -3256,6 +3258,14 @@
   <int value="20" label="Help center"/>
 </enum>
 
+<enum name="BookmarkManagerMenuSource">
+  <int value="0" label="None"/>
+  <int value="1" label="Item"/>
+  <int value="2" label="Tree"/>
+  <int value="3" label="Toolbar"/>
+  <int value="4" label="List"/>
+</enum>
+
 <enum name="BookmarksEntryPoint">
   <int value="0" label="Accelerator(Ctrl+D)"/>
   <int value="1" label="Gesture"/>
@@ -25421,7 +25431,6 @@
   <int value="-1490298774" label="enable-captive-portal-bypass-proxy-option"/>
   <int value="-1488744539" label="QuickUnlockFingerprint:enabled"/>
   <int value="-1487243228" label="NewUsbBackend:disabled"/>
-  <int value="-1486198877" label="VrIconInDaydreamHome:disabled"/>
   <int value="-1482730792" label="stop-in-background:enabled"/>
   <int value="-1482685863" label="enable-request-tablet-site"/>
   <int value="-1480926949" label="MaterialDesignBookmarks:enabled"/>
@@ -26358,7 +26367,6 @@
   <int value="1005684777" label="PictureInPicture:disabled"/>
   <int value="1007444341" label="enable-prefixed-encrypted-media"/>
   <int value="1015895665" label="drop-sync-credential:enabled"/>
-  <int value="1017364362" label="VrIconInDaydreamHome:enabled"/>
   <int value="1018998019" label="memlog"/>
   <int value="1019623058" label="ash-enable-shelf-model-synchronization"/>
   <int value="1019857902"
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index de5a348..3645f4f 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -8404,6 +8404,15 @@
   </summary>
 </histogram>
 
+<histogram name="BookmarkManager.CommandMenuOpened"
+    enum="BookmarkManagerMenuSource">
+  <owner>calamity@chromium.org</owner>
+  <summary>
+    Logs where the menu was opened from when a user action opens the command
+    menu in the bookmark manager.
+  </summary>
+</histogram>
+
 <histogram name="BookmarkManager.NumDragged" units="bookmarks">
   <owner>calamity@chromium.org</owner>
   <summary>
@@ -77360,6 +77369,25 @@
   </summary>
 </histogram>
 
+<histogram name="Search.ContextualSearch.Ranker.Recorded" enum="Boolean">
+  <owner>donnd@chromium.org</owner>
+  <owner>twellington@chromium.org</owner>
+  <summary>
+    Logs that features were recorded to Ranker and whether it was an outcome or
+    not. Recorded when the UX is shown or hidden. Implemented for Android.
+  </summary>
+</histogram>
+
+<histogram name="Search.ContextualSearch.Ranker.RecordedNative" enum="Boolean">
+  <owner>donnd@chromium.org</owner>
+  <owner>twellington@chromium.org</owner>
+  <summary>
+    Logs that features were recorded to Ranker from native code and whether it
+    was an outcome or not. Recorded when the UX is shown or hidden. Implemented
+    for Android.
+  </summary>
+</histogram>
+
 <histogram name="Search.ContextualSearch.Ranker.Suppressed" enum="Boolean">
   <owner>donnd@chromium.org</owner>
   <owner>twellington@chromium.org</owner>
@@ -78609,6 +78637,20 @@
 </histogram>
 
 <histogram
+    name="Security.CertificateTransparency.MainFrameNavigationCompliance"
+    enum="CTComplianceStatus">
+  <owner>estark@chromium.org</owner>
+  <summary>
+    The compliance of each main frame navigation's connection with the
+    Certificate Transparency policy. Recorded whenever a main-frame,
+    non-same-page navigation is committed. Connections can be compliant, or they
+    can be non-compliant for one of several reasons (not enough Signed
+    Certificate Timestamps [SCTs], not diverse enough SCTs, or the build was old
+    so CT compliance wasn't checked).
+  </summary>
+</histogram>
+
+<histogram
     name="Security.HTTPBad.NavigationStartedAfterUserWarnedAboutSensitiveInput"
     units="ms">
   <owner>estark@chromium.org</owner>
@@ -82918,7 +82960,8 @@
   <owner>alexmos@chromium.org</owner>
   <summary>
     True if the --isolate-origins mode was enabled from the command line,
-    about:flags, or enterprise policy.  Recorded on browser startup.
+    about:flags, or enterprise policy.  Recorded on browser startup and then
+    once every 24 hours.
   </summary>
 </histogram>
 
@@ -82926,7 +82969,8 @@
   <owner>alexmos@chromium.org</owner>
   <summary>
     True if the --site-per-process mode was enabled from the command line,
-    about:flags, or enterprise policy.  Recorded on browser startup.
+    about:flags, or enterprise policy.  Recorded on browser startup and then
+    once every 24 hours.
   </summary>
 </histogram>
 
@@ -84802,7 +84846,8 @@
     Android: The time from the earliest entry point in the browser process to
     the first contentful paint of the first loaded page. It's not recorded when
     the first loaded page is non http(s) page like a chrome error page, a new
-    tab page, a blank page.
+    tab page, a blank page. It's also not recorded if the application wasn't in
+    the foreground since the start till the end of event.
   </summary>
 </histogram>
 
@@ -84815,6 +84860,8 @@
     the moment the first navigation is committed, i.e. when renderer gets the
     first byte of the document. It's not recorded when the first loaded page is
     non http(s) page like a chrome error page, a new tab page, a blank page.
+    It's also not recorded if the application wasn't in the foreground since the
+    start till the end of event.
   </summary>
 </histogram>
 
@@ -111630,13 +111677,28 @@
 </histogram_suffixes>
 
 <histogram_suffixes name="TaskSchedulerMayBlock" separator=".">
+  <obsolete>
+    Deprecated 1/2018. Merged with TaskSchedulerTaskPriority into
+    TaskSchedulerTaskType to reduce suffixing.
+  </obsolete>
   <suffix name="MayBlock"
       label="Applies to tasks posted with MayBlock() or
              WithBaseSyncPrimitives()."/>
-  <affected-histogram name="TaskScheduler.TaskLatency.BackgroundTaskPriority"/>
-  <affected-histogram
-      name="TaskScheduler.TaskLatency.UserBlockingTaskPriority"/>
-  <affected-histogram name="TaskScheduler.TaskLatency.UserVisibleTaskPriority"/>
+  <affected-histogram name="TaskScheduler.TaskLatency.BackgroundTaskPriority">
+    <obsolete>
+      Deprecated 4/2017. Units changed from milliseconds to microseconds.
+    </obsolete>
+  </affected-histogram>
+  <affected-histogram name="TaskScheduler.TaskLatency.UserBlockingTaskPriority">
+    <obsolete>
+      Deprecated 4/2017. Units changed from milliseconds to microseconds.
+    </obsolete>
+  </affected-histogram>
+  <affected-histogram name="TaskScheduler.TaskLatency.UserVisibleTaskPriority">
+    <obsolete>
+      Deprecated 4/2017. Units changed from milliseconds to microseconds.
+    </obsolete>
+  </affected-histogram>
   <affected-histogram
       name="TaskScheduler.TaskLatencyMicroseconds.BackgroundTaskPriority"/>
   <affected-histogram
@@ -111645,14 +111707,34 @@
       name="TaskScheduler.TaskLatencyMicroseconds.UserVisibleTaskPriority"/>
 </histogram_suffixes>
 
+<histogram_suffixes name="TaskSchedulerName" separator=".">
+  <suffix base="true" name="Renderer"
+      label="TaskSchedulers for renderer processes."/>
+  <suffix base="true" name="ContentChild"
+      label="TaskSchedulers for various instantiations of
+             content::ChildProcess."/>
+  <affected-histogram name="TaskScheduler.DetachDuration"/>
+  <affected-histogram name="TaskScheduler.NumTasksBeforeDetach"/>
+  <affected-histogram name="TaskScheduler.NumTasksBetweenWaits"/>
+  <affected-histogram name="TaskScheduler.TaskLatencyMicroseconds"/>
+</histogram_suffixes>
+
 <histogram_suffixes name="TaskSchedulerTaskPriority" separator=".">
+  <obsolete>
+    Deprecated 1/2018. Merged with TaskSchedulerMayBlock into
+    TaskSchedulerTaskType to reduce suffixing.
+  </obsolete>
   <suffix name="BackgroundTaskPriority"
       label="Applies to tasks posted with a BACKGROUND priority."/>
   <suffix name="UserVisibleTaskPriority"
       label="Applies to tasks posted with a USER_VISIBLE priority."/>
   <suffix name="UserBlockingTaskPriority"
       label="Applies to tasks posted with a USER_BLOCKING priority."/>
-  <affected-histogram name="TaskScheduler.TaskLatency"/>
+  <affected-histogram name="TaskScheduler.TaskLatency">
+    <obsolete>
+      Deprecated 4/2017. Units changed from milliseconds to microseconds.
+    </obsolete>
+  </affected-histogram>
   <affected-histogram name="TaskScheduler.TaskLatency.BackgroundFileIOPool">
     <obsolete>
       Deprecated 12/2016. Pool name removed from task latency histogram name.
@@ -111676,6 +111758,31 @@
   <affected-histogram name="TaskScheduler.TaskLatencyMicroseconds"/>
 </histogram_suffixes>
 
+<histogram_suffixes name="TaskSchedulerTaskType" separator=".">
+  <suffix name="BackgroundTaskPriority"
+      label="Applies to tasks posted with a BACKGROUND priority and neither
+             of MayBlock() nor WithBaseSyncPrimitives()."/>
+  <suffix name="UserVisibleTaskPriority"
+      label="Applies to tasks posted with a USER_VISIBLE priority and neither
+             of MayBlock() nor WithBaseSyncPrimitives()."/>
+  <suffix name="UserBlockingTaskPriority"
+      label="Applies to tasks posted with a USER_BLOCKING priority and
+             neither of MayBlock() nor WithBaseSyncPrimitives()."/>
+  <suffix name="BackgroundTaskPriority_MayBlock"
+      label="Applies to tasks posted with a BACKGROUND priority and
+             MayBlock() or WithBaseSyncPrimitives()."/>
+  <suffix name="UserVisibleTaskPriority_MayBlock"
+      label="Applies to tasks posted with a USER_VISIBLE priority and
+             MayBlock() or WithBaseSyncPrimitives()."/>
+  <suffix name="UserBlockingTaskPriority_MayBlock"
+      label="Applies to tasks posted with a USER_BLOCKING priority and
+             MayBlock() or WithBaseSyncPrimitives()."/>
+  <affected-histogram name="TaskScheduler.TaskLatencyMicroseconds"/>
+  <affected-histogram
+      name="TaskScheduler.TaskLatencyMicroseconds.ContentChild"/>
+  <affected-histogram name="TaskScheduler.TaskLatencyMicroseconds.Renderer"/>
+</histogram_suffixes>
+
 <histogram_suffixes name="TaskSchedulerWorkerPool" separator=".">
   <suffix name="BackgroundBlockingPool"
       label="Applies to the BackgroundBlocking worker pool."/>
@@ -111696,16 +111803,38 @@
   </suffix>
   <suffix name="ForegroundPool" label="Applies to the Foreground worker pool."/>
   <suffix name="RendererBackgroundBlockingPool"
-      label="Applies to the RendererBackgroundBlocking worker pool."/>
+      label="Applies to the RendererBackgroundBlocking worker pool.">
+    <obsolete>
+      Deprecated 01/2018. In favor of TaskSchedulerName suffix.
+    </obsolete>
+  </suffix>
   <suffix name="RendererBackgroundPool"
-      label="Applies to the RendererBackground worker pool."/>
+      label="Applies to the RendererBackground worker pool.">
+    <obsolete>
+      Deprecated 01/2018. In favor of TaskSchedulerName suffix.
+    </obsolete>
+  </suffix>
   <suffix name="RendererForegroundBlockingPool"
-      label="Applies to the RendererForegroundBlocking worker pool."/>
+      label="Applies to the RendererForegroundBlocking worker pool.">
+    <obsolete>
+      Deprecated 01/2018. In favor of TaskSchedulerName suffix.
+    </obsolete>
+  </suffix>
   <suffix name="RendererForegroundPool"
-      label="Applies to the RendererForeground worker pool."/>
+      label="Applies to the RendererForeground worker pool.">
+    <obsolete>
+      Deprecated 01/2018. In favor of TaskSchedulerName suffix.
+    </obsolete>
+  </suffix>
   <affected-histogram name="TaskScheduler.DetachDuration"/>
+  <affected-histogram name="TaskScheduler.DetachDuration.ContentChild"/>
+  <affected-histogram name="TaskScheduler.DetachDuration.Renderer"/>
   <affected-histogram name="TaskScheduler.NumTasksBeforeDetach"/>
+  <affected-histogram name="TaskScheduler.NumTasksBeforeDetach.ContentChild"/>
+  <affected-histogram name="TaskScheduler.NumTasksBeforeDetach.Renderer"/>
   <affected-histogram name="TaskScheduler.NumTasksBetweenWaits"/>
+  <affected-histogram name="TaskScheduler.NumTasksBetweenWaits.ContentChild"/>
+  <affected-histogram name="TaskScheduler.NumTasksBetweenWaits.Renderer"/>
   <affected-histogram name="TaskScheduler.TaskLatency">
     <obsolete>
       Deprecated 12/2016. Pool name removed from task latency histogram name.
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml
index 6041347..30493da 100644
--- a/tools/metrics/ukm/ukm.xml
+++ b/tools/metrics/ukm/ukm.xml
@@ -423,6 +423,16 @@
       word, rather than in the middle 50% of the word.
     </summary>
   </metric>
+  <metric name="OutcomeRankerDidPredict">
+    <summary>
+      Emits a 1 or 0 to indicate whether Ranker was able to make a prediction.
+    </summary>
+  </metric>
+  <metric name="OutcomeRankerPrediction">
+    <summary>
+      Emits a 1 or 0 to indicate what Ranker's prediction was for this record.
+    </summary>
+  </metric>
   <metric name="OutcomeWasCardsDataShown">
     <summary>
       Emits a 1 or 0 to indicate whether any Contextual Cards data was shown in
@@ -479,7 +489,7 @@
   </metric>
   <metric name="TapDurationMs">
     <summary>
-      The duration of the tap gesture expressed in milliseconds.
+      The duration of the tap gesture expressed as an integer in milliseconds.
     </summary>
   </metric>
   <metric name="WasScreenBottom">
@@ -2500,4 +2510,35 @@
   </metric>
 </event>
 
+<event name="XR.WebXR" singular="True">
+  <owner>billorr@chromium.org</owner>
+  <metric name="DidRequestAvailableDevices">
+    <summary>
+      Boolean value that indicates that the API to enumerate devices was called.
+    </summary>
+  </metric>
+  <metric name="DidRequestPose">
+    <summary>
+      Boolean value that indicates that poses were requested.
+    </summary>
+  </metric>
+  <metric name="DidRequestPresentation">
+    <summary>
+      Boolean value that indicates that presentation was requested.
+    </summary>
+  </metric>
+  <metric name="ReturnedDevice">
+    <summary>
+      Boolean value that indicates that a device was returned by the API to
+      enumerate devices.
+    </summary>
+  </metric>
+  <metric name="ReturnedPresentationCapableDevice">
+    <summary>
+      Boolean value that indicates that a device was returned by the API to
+      enumerate devices, and that the device supports presentation.
+    </summary>
+  </metric>
+</event>
+
 </ukm-configuration>
diff --git a/tools/perf/core/perf_data_generator.py b/tools/perf/core/perf_data_generator.py
index 74e0c06..a83875d 100755
--- a/tools/perf/core/perf_data_generator.py
+++ b/tools/perf/core/perf_data_generator.py
@@ -372,7 +372,8 @@
           ],
        'perf_tests': [
          ('load_library_perf_tests', 'build145-m1'),
-         ('performance_browser_tests', 'build145-m1'),
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build145-m1'),
          ('media_perftests', 'build146-m1')]
       }
     ])
@@ -408,8 +409,9 @@
            'build140-m1', 'build141-m1', 'build142-m1'
           ],
        'perf_tests': [
-         ('load_library_perf_tests', 'build140-m1'),
-         ('performance_browser_tests', 'build140-m1')]
+         ('load_library_perf_tests', 'build140-m1')]
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build140-m1')]
       }
     ])
   waterfall = add_tester(
@@ -428,7 +430,8 @@
          # crbug.com/785291
          # ('angle_perftests', 'build103-m1'),
          ('load_library_perf_tests', 'build103-m1'),
-         ('performance_browser_tests', 'build103-m1'),
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build103-m1'),
          ('media_perftests', 'build104-m1')]
       }
     ])
@@ -446,8 +449,9 @@
           ],
        'perf_tests': [
          ('angle_perftests', 'build166-m1'),
-         ('load_library_perf_tests', 'build166-m1'),
-         ('performance_browser_tests', 'build166-m1')]
+         ('load_library_perf_tests', 'build166-m1')]
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build166-m1')]
       }
     ])
   waterfall = add_tester(
@@ -524,7 +528,8 @@
            'build30-b4' # replacing build8-b1. crbug.com/724998
           ],
        'perf_tests': [
-         ('performance_browser_tests', 'build30-b4')
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build30-b4')
        ]
       }
     ])
@@ -541,7 +546,8 @@
            'build130-b1', 'build131-b1', 'build132-b1'
           ],
        'perf_tests': [
-         ('performance_browser_tests', 'build132-b1')
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build132-b1')
        ]
       }
     ])
@@ -558,7 +564,8 @@
            'build125-b1', 'build126-b1', 'build127-b1'
           ],
        'perf_tests': [
-         ('performance_browser_tests', 'build126-b1')
+         # crbug.com/803455
+         # ('performance_browser_tests', 'build126-b1')
        ]
       }
     ])
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config
index fdef3640..41497d3 100644
--- a/tools/perf/expectations.config
+++ b/tools/perf/expectations.config
@@ -212,6 +212,7 @@
 crbug.com/798536 [ Android ] system_health.common_mobile/background:news:nytimes [ Skip ]
 crbug.com/798536 [ Android ] system_health.common_mobile/load:games:spychase [ Skip ]
 crbug.com/736147 [ Cherry_Mobile_Android_One ] system_health.common_mobile/browse:social:tumblr_infinite_scroll [ Skip ]
+crbug.com/803461 [ Nexus_5 ] system_health.common_mobile/browse:chrome:newtab [ Skip ]
 
 # Benchmark: system_health.memory_desktop
 crbug.com/728576 [ Mac ] system_health.memory_desktop/browse:news:cnn [ Skip ]
@@ -243,6 +244,7 @@
 crbug.com/738854 [ Nexus_5X ] system_health.memory_mobile/load:tools:drive [ Skip ]
 crbug.com/738854 [ Android_Webview ] system_health.memory_mobile/load:tools:drive [ Skip ]
 crbug.com/797261 [ Android_Webview ] system_health.memory_mobile/load:games:spychase [ Skip ]
+crbug.com/803462 [ Nexus_5 ] system_health.memory_mobile/browse:chrome:newtab [ Skip ]
 
 # Benchmark: tab_switching.typical_25
 crbug.com/747026 [ Mac ] tab_switching.typical_25/multitab:misc:typical24 [ Skip ]
@@ -304,6 +306,7 @@
 crbug.com/767970 [ Mobile ] v8.browsing_mobile/browse:shopping:flipkart [ Skip ]
 crbug.com/708300 [ Mobile ] v8.browsing_mobile/browse:shopping:flipkart [ Skip ]
 [ Android_Webview ] v8.browsing_mobile/browse:chrome:newtab [ Skip ]
+crbug.com/803465 [ Nexus_5 ] v8.browsing_mobile/browse:chrome:newtab [ Skip ]
 crbug.com/799080 [ Nexus_7 ] v8.browsing_mobile-future/browse:news:cnn [ Skip ]
 
 # Benchmark: v8.browsing_mobile-future
@@ -324,6 +327,7 @@
 crbug.com/799080 [ Nexus_7 ] v8.browsing_mobile-future/browse:news:cnn [ Skip ]
 crbug.com/799080 [ Nexus_7 ] v8.browsing_mobile-future/browse:shopping:avito [ Skip ]
 crbug.com/799080 [ Nexus_7 ] v8.browsing_mobile-future/browse:social:pinterest_infinite_scroll [ Skip ]
+crbug.com/803465 [ Nexus_5 ] v8.browsing_mobile-future/browse:chrome:newtab [ Skip ]
 
 # Benchmark: v8.detached_context_age_in_gc
 crbug.com/770982 [ Win ] v8.detached_context_age_in_gc/Docs_(1_open_document_tab) [ Skip ]
diff --git a/ui/base/ime/dummy_text_input_client.cc b/ui/base/ime/dummy_text_input_client.cc
index 574407b9..5ddd43c 100644
--- a/ui/base/ime/dummy_text_input_client.cc
+++ b/ui/base/ime/dummy_text_input_client.cc
@@ -11,10 +11,16 @@
 namespace ui {
 
 DummyTextInputClient::DummyTextInputClient()
-    : text_input_type_(TEXT_INPUT_TYPE_NONE), insert_char_count_(0) {}
+    : DummyTextInputClient(TEXT_INPUT_TYPE_NONE) {}
 
 DummyTextInputClient::DummyTextInputClient(TextInputType text_input_type)
-    : text_input_type_(text_input_type), insert_char_count_(0) {}
+    : DummyTextInputClient(text_input_type, TEXT_INPUT_MODE_DEFAULT) {}
+
+DummyTextInputClient::DummyTextInputClient(TextInputType text_input_type,
+                                           TextInputMode text_input_mode)
+    : text_input_type_(text_input_type),
+      text_input_mode_(text_input_mode),
+      insert_char_count_(0) {}
 
 DummyTextInputClient::~DummyTextInputClient() {
 }
@@ -45,7 +51,7 @@
 }
 
 TextInputMode DummyTextInputClient::GetTextInputMode() const {
-  return TEXT_INPUT_MODE_DEFAULT;
+  return text_input_mode_;
 }
 
 base::i18n::TextDirection DummyTextInputClient::GetTextDirection() const {
diff --git a/ui/base/ime/dummy_text_input_client.h b/ui/base/ime/dummy_text_input_client.h
index d0f1ecb4..1badca4 100644
--- a/ui/base/ime/dummy_text_input_client.h
+++ b/ui/base/ime/dummy_text_input_client.h
@@ -18,6 +18,8 @@
  public:
   DummyTextInputClient();
   explicit DummyTextInputClient(TextInputType text_input_type);
+  DummyTextInputClient(TextInputType text_input_type,
+                       TextInputMode text_input_mode);
   ~DummyTextInputClient() override;
 
   // Overriden from TextInputClient.
@@ -61,6 +63,7 @@
   }
 
   TextInputType text_input_type_;
+  TextInputMode text_input_mode_;
 
   DISALLOW_COPY_AND_ASSIGN(DummyTextInputClient);
 
diff --git a/ui/display/manager/chromeos/display_change_observer.cc b/ui/display/manager/chromeos/display_change_observer.cc
index 0424688..40a9c7b 100644
--- a/ui/display/manager/chromeos/display_change_observer.cc
+++ b/ui/display/manager/chromeos/display_change_observer.cc
@@ -40,7 +40,7 @@
 
 const DeviceScaleFactorDPIThreshold kThresholdTableForInternal[] = {
     {220.0f, 2.0f},
-    {200.0f, 1.6f},
+    {180.0f, 1.6f},
     {150.0f, 1.25f},
     {0.0f, 1.0f},
 };
diff --git a/ui/display/manager/chromeos/display_change_observer_unittest.cc b/ui/display/manager/chromeos/display_change_observer_unittest.cc
index 1a8a4b1a..e714181e 100644
--- a/ui/display/manager/chromeos/display_change_observer_unittest.cc
+++ b/ui/display/manager/chromeos/display_change_observer_unittest.cc
@@ -336,7 +336,7 @@
   EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(14.0f, gfx::Rect(1920, 1080)));
 
   // 11.6" 1920x1080
-  EXPECT_EQ(1.25f, ComputeDeviceScaleFactor(11.6f, gfx::Rect(1920, 1080)));
+  EXPECT_EQ(1.6f, ComputeDeviceScaleFactor(11.6f, gfx::Rect(1920, 1080)));
 
   // 12.02" 2160x1440
   EXPECT_EQ(1.6f, ComputeDeviceScaleFactor(12.02f, gfx::Rect(2160, 1440)));
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
index bff4d77..6e476ff 100644
--- a/ui/gl/BUILD.gn
+++ b/ui/gl/BUILD.gn
@@ -118,6 +118,8 @@
     "gl_surface_osmesa.h",
     "gl_surface_overlay.cc",
     "gl_surface_overlay.h",
+    "gl_surface_presentation_helper.cc",
+    "gl_surface_presentation_helper.h",
     "gl_surface_stub.cc",
     "gl_surface_stub.h",
     "gl_switches.cc",
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index 748f6bf..ba10ace 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -26,8 +26,8 @@
 #include "ui/gfx/x/x11_connection.h"
 #include "ui/gfx/x/x11_types.h"
 #include "ui/gl/gl_bindings.h"
-#include "ui/gl/gl_context.h"
 #include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_surface_presentation_helper.h"
 #include "ui/gl/gl_visual_picker_glx.h"
 #include "ui/gl/sync_control_vsync_provider.h"
 
@@ -566,9 +566,7 @@
       window_(0),
       glx_window_(0),
       config_(nullptr),
-      visual_id_(CopyFromParent),
-      waiting_for_vsync_parameters_(false),
-      weak_ptr_factory_(this) {}
+      visual_id_(CopyFromParent) {}
 
 bool NativeViewGLSurfaceGLX::Initialize(GLSurfaceFormat format) {
   XWindowAttributes attributes;
@@ -612,8 +610,12 @@
 
   if (g_glx_oml_sync_control_supported) {
     vsync_provider_.reset(new OMLSyncControlVSyncProvider(glx_window_));
+    presentation_helper_ = std::make_unique<GLSurfacePresentationHelper>(
+        vsync_provider_.get(), true);
   } else if (g_glx_sgi_video_sync_supported) {
     vsync_provider_.reset(new SGIVideoSyncVSyncProvider(parent_window_));
+    presentation_helper_ = std::make_unique<GLSurfacePresentationHelper>(
+        vsync_provider_.get(), false);
   } else {
     // Assume a refresh rate of 59.9 Hz, which will cause us to skip
     // 1 frame every 10 seconds on a 60Hz monitor, but will prevent us
@@ -625,24 +627,16 @@
         base::TimeDelta::FromSeconds(1) / 59.9;
     vsync_provider_.reset(
         new gfx::FixedVSyncProvider(kDefaultTimebase, kDefaultInterval));
-    vsync_timebase_ = kDefaultTimebase;
-    vsync_interval_ = kDefaultInterval;
+    presentation_helper_ = std::make_unique<GLSurfacePresentationHelper>(
+        kDefaultTimebase, kDefaultInterval);
   }
 
   return true;
 }
 
 void NativeViewGLSurfaceGLX::Destroy() {
-  // Discard pending frames and run presentation callback with empty
-  // PresentationFeedback.
-  bool has_context = gl_context_ && gl_context_->IsCurrent(this);
-  for (auto& frame : pending_frames_) {
-    frame.timer->Destroy(has_context);
-    frame.callback.Run(gfx::PresentationFeedback());
-  }
-  pending_frames_.clear();
-
-  vsync_provider_.reset();
+  presentation_helper_ = nullptr;
+  vsync_provider_ = nullptr;
   if (glx_window_) {
     glXDestroyWindow(g_display, glx_window_);
     glx_window_ = 0;
@@ -674,9 +668,9 @@
     const PresentationCallback& callback) {
   TRACE_EVENT2("gpu", "NativeViewGLSurfaceGLX:RealSwapBuffers", "width",
                GetSize().width(), "height", GetSize().height());
-  PreSwapBuffers(callback);
+  presentation_helper_->PreSwapBuffers(callback);
   glXSwapBuffers(g_display, GetDrawableHandle());
-  PostSwapBuffers();
+  presentation_helper_->PostSwapBuffers();
   return gfx::SwapResult::SWAP_ACK;
 }
 
@@ -717,32 +711,14 @@
     int height,
     const PresentationCallback& callback) {
   DCHECK(g_driver_glx.ext.b_GLX_MESA_copy_sub_buffer);
-  PreSwapBuffers(callback);
+  presentation_helper_->PreSwapBuffers(callback);
   glXCopySubBufferMESA(g_display, GetDrawableHandle(), x, y, width, height);
-  PostSwapBuffers();
+  presentation_helper_->PostSwapBuffers();
   return gfx::SwapResult::SWAP_ACK;
 }
 
 bool NativeViewGLSurfaceGLX::OnMakeCurrent(GLContext* context) {
-  if (context == gl_context_)
-    return GLSurfaceGLX::OnMakeCurrent(context);
-
-  // If context is changed, we assume SwapBuffers issued for previous context
-  // will be discarded.
-  if (gpu_timing_client_) {
-    gpu_timing_client_ = nullptr;
-    for (auto& frame : pending_frames_) {
-      frame.timer->Destroy(false /* has_context */);
-      frame.callback.Run(gfx::PresentationFeedback());
-    }
-    pending_frames_.clear();
-  }
-
-  gl_context_ = context;
-  gpu_timing_client_ = context->CreateGPUTimingClient();
-  if (!gpu_timing_client_->IsAvailable())
-    gpu_timing_client_ = nullptr;
-
+  presentation_helper_->OnMakeCurrent(context, this);
   return GLSurfaceGLX::OnMakeCurrent(context);
 }
 
@@ -771,188 +747,6 @@
   return glx_window_;
 }
 
-void NativeViewGLSurfaceGLX::PreSwapBuffers(
-    const PresentationCallback& callback) {
-  std::unique_ptr<GPUTimer> timer;
-  if (gpu_timing_client_) {
-    timer = gpu_timing_client_->CreateGPUTimer(false /* prefer_elapsed_time */);
-    timer->QueryTimeStamp();
-  }
-  pending_frames_.push_back(Frame(std::move(timer), callback));
-}
-
-void NativeViewGLSurfaceGLX::PostSwapBuffers() {
-  if (!waiting_for_vsync_parameters_)
-    CheckPendingFrames();
-}
-
-void NativeViewGLSurfaceGLX::CheckPendingFrames() {
-  DCHECK(gl_context_ || pending_frames_.empty());
-  // VSync parameters are fixed.
-  bool fixed_vsync =
-      !(g_glx_oml_sync_control_supported || g_glx_sgi_video_sync_supported);
-  // VSyncProvier::GetVSyncParameters returns VSync parameters via callback
-  // immediatelly.
-  bool get_vsync_parameters_return_immediately =
-      vsync_provider_->SupportGetVSyncParametersIfAvailable();
-  // The VSync timestamp is from the driver.
-  bool hw_clock = g_glx_oml_sync_control_supported;
-
-  if (get_vsync_parameters_return_immediately && !fixed_vsync) {
-    if (!vsync_provider_->GetVSyncParametersIfAvailable(&vsync_timebase_,
-                                                        &vsync_interval_)) {
-      vsync_timebase_ = base::TimeTicks();
-      vsync_interval_ = base::TimeDelta();
-      LOG(ERROR) << "GetVSyncParametersIfAvailable() failed!";
-    }
-  }
-
-  if (pending_frames_.empty())
-    return;
-
-  // If the |gl_context_| is not current anymore, we assume SwapBuffers issued
-  // for previous context will be discarded.
-  if (gl_context_ && !gl_context_->IsCurrent(this)) {
-    gpu_timing_client_ = nullptr;
-    for (auto& frame : pending_frames_) {
-      frame.timer->Destroy(false /* has_context */);
-      frame.callback.Run(gfx::PresentationFeedback());
-    }
-    pending_frames_.clear();
-    return;
-  }
-
-  bool disjoint_occurred =
-      gpu_timing_client_ && gpu_timing_client_->CheckAndResetTimerErrors();
-  if (disjoint_occurred || !gpu_timing_client_) {
-    // If GPUTimer is not avaliable or disjoint occurred, we just run
-    // presentation callback with current system time.
-    for (auto& frame : pending_frames_) {
-      frame.callback.Run(gfx::PresentationFeedback(
-          base::TimeTicks::Now(), vsync_interval_, 0 /* flags */));
-    }
-    pending_frames_.clear();
-    return;
-  }
-
-  bool need_update_vsync = false;
-  while (!pending_frames_.empty()) {
-    auto& frame = pending_frames_.front();
-    if (!frame.timer->IsAvailable())
-      break;
-
-    int64_t start = 0;
-    int64_t end = 0;
-    frame.timer->GetStartEndTimestamps(&start, &end);
-    auto timestamp =
-        base::TimeTicks() + base::TimeDelta::FromMicroseconds(start);
-
-    // Helper lambda for running the presentation callback and releasing the
-    // frame.
-    auto frame_presentation_callback =
-        [this, &frame](const gfx::PresentationFeedback& feedback) {
-          frame.timer->Destroy(true /* has_context */);
-          frame.callback.Run(feedback);
-          pending_frames_.pop_front();
-        };
-
-    if (vsync_interval_.is_zero() || fixed_vsync) {
-      // If VSync parameters are fixed or not avaliable, we just run
-      // presentation callbacks with timestamp from GPUTimers.
-      frame_presentation_callback(
-          gfx::PresentationFeedback(timestamp, vsync_interval_, 0 /* flags */));
-    } else if (timestamp < vsync_timebase_) {
-      // We got a VSync whose timestamp is after GPU finished renderering this
-      // back buffer.
-      uint32_t flags = gfx::PresentationFeedback::kVSync |
-                       gfx::PresentationFeedback::kHWCompletion;
-      auto delta = vsync_timebase_ - timestamp;
-      if (delta < vsync_interval_) {
-        // The |vsync_timebase_| is the closest VSync's timestamp after the GPU
-        // finished renderering.
-        timestamp = vsync_timebase_;
-        if (hw_clock)
-          flags |= gfx::PresentationFeedback::kHWClock;
-      } else {
-        // The |vsync_timebase_| isn't the closest VSync's timestamp after the
-        // GPU finished renderering. We have to compute the closest VSync's
-        // timestmp.
-        timestamp =
-            timestamp.SnappedToNextTick(vsync_timebase_, vsync_interval_);
-      }
-      frame_presentation_callback(
-          gfx::PresentationFeedback(timestamp, vsync_interval_, flags));
-    } else {
-      // The |vsync_timebase_| is earlier than |timestamp| of the current
-      // pending frame. We need update vsync parameters.
-      need_update_vsync = true;
-      // We compute the next VSync's timestamp and use it to run
-      // callback.
-      auto delta = timestamp - vsync_timebase_;
-      auto offset = delta % vsync_interval_;
-      timestamp += vsync_interval_ - offset;
-      uint32_t flags = gfx::PresentationFeedback::kVSync;
-      frame_presentation_callback(
-          gfx::PresentationFeedback(timestamp, vsync_interval_, flags));
-    }
-  }
-
-  if (waiting_for_vsync_parameters_ || !need_update_vsync ||
-      pending_frames_.empty())
-    return;
-
-  waiting_for_vsync_parameters_ = true;
-  if (!get_vsync_parameters_return_immediately) {
-    // In this case, the |vsync_provider_| will call the callback when the next
-    // VSync is received.
-    vsync_provider_->GetVSyncParameters(
-        base::BindRepeating(&NativeViewGLSurfaceGLX::UpdateVSyncCallback,
-                            weak_ptr_factory_.GetWeakPtr()));
-    return;
-  }
-
-  // If the |vsync_provider_| can not notify us for the next VSync
-  // asynchronically, we have to compute the next VSync time and post a delayed
-  // task so we can check the VSync later.
-  base::TimeDelta interval = vsync_interval_.is_zero()
-                                 ? base::TimeDelta::FromSeconds(1) / 60
-                                 : vsync_interval_;
-  auto now = base::TimeTicks::Now();
-  auto next_vsync = now.SnappedToNextTick(vsync_timebase_, interval);
-  base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
-      FROM_HERE,
-      base::BindOnce(&NativeViewGLSurfaceGLX::CheckPendingFramesCallback,
-                     weak_ptr_factory_.GetWeakPtr()),
-      next_vsync - now);
-}  // namespace gl
-
-void NativeViewGLSurfaceGLX::CheckPendingFramesCallback() {
-  DCHECK(waiting_for_vsync_parameters_);
-  waiting_for_vsync_parameters_ = false;
-  CheckPendingFrames();
-}
-
-void NativeViewGLSurfaceGLX::UpdateVSyncCallback(
-    const base::TimeTicks timebase,
-    const base::TimeDelta interval) {
-  DCHECK(waiting_for_vsync_parameters_);
-  waiting_for_vsync_parameters_ = false;
-  vsync_timebase_ = timebase;
-  vsync_interval_ = interval;
-  CheckPendingFrames();
-}
-
-NativeViewGLSurfaceGLX::Frame::Frame(Frame&& other) = default;
-
-NativeViewGLSurfaceGLX::Frame::Frame(std::unique_ptr<GPUTimer>&& timer,
-                                     const PresentationCallback& callback)
-    : timer(std::move(timer)), callback(callback) {}
-
-NativeViewGLSurfaceGLX::Frame::~Frame() = default;
-
-NativeViewGLSurfaceGLX::Frame& NativeViewGLSurfaceGLX::Frame::operator=(
-    Frame&& other) = default;
-
 UnmappedNativeViewGLSurfaceGLX::UnmappedNativeViewGLSurfaceGLX(
     const gfx::Size& size)
     : size_(size), config_(nullptr), window_(0), glx_window_(0) {
diff --git a/ui/gl/gl_surface_glx.h b/ui/gl/gl_surface_glx.h
index 45ef15a..ac8a0cb5 100644
--- a/ui/gl/gl_surface_glx.h
+++ b/ui/gl/gl_surface_glx.h
@@ -11,19 +11,21 @@
 #include <string>
 
 #include "base/compiler_specific.h"
-#include "base/containers/circular_deque.h"
 #include "base/macros.h"
-#include "base/memory/weak_ptr.h"
 #include "ui/gfx/geometry/size.h"
 #include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/vsync_provider.h"
 #include "ui/gfx/x/x11_types.h"
 #include "ui/gl/gl_export.h"
 #include "ui/gl/gl_surface.h"
-#include "ui/gl/gpu_timing.h"
+
+namespace gfx {
+class VSyncProvider;
+}
 
 namespace gl {
 
+class GLSurfacePresentationHelper;
+
 // Base class for GLX surfaces.
 class GL_EXPORT GLSurfaceGLX : public GLSurface {
  public:
@@ -113,18 +115,6 @@
   // The handle for the drawable to make current or swap.
   GLXDrawable GetDrawableHandle() const;
 
-  void PreSwapBuffers(const PresentationCallback& callback);
-  void PostSwapBuffers();
-
-  // Check |pending_frames_| and run presentation callbacks.
-  void CheckPendingFrames();
-
-  // Callback used by PostDelayedTask for running CheckPendingFrames().
-  void CheckPendingFramesCallback();
-
-  void UpdateVSyncCallback(const base::TimeTicks timebase,
-                           const base::TimeDelta interval);
-
   // Window passed in at creation. Always valid.
   gfx::AcceleratedWidget parent_window_;
 
@@ -140,25 +130,7 @@
 
   std::unique_ptr<gfx::VSyncProvider> vsync_provider_;
 
-  scoped_refptr<GLContext> gl_context_;
-  scoped_refptr<GPUTimingClient> gpu_timing_client_;
-  struct Frame {
-    Frame(Frame&& other);
-    Frame(std::unique_ptr<GPUTimer>&& timer,
-          const PresentationCallback& callback);
-    ~Frame();
-    Frame& operator=(Frame&& other);
-    std::unique_ptr<GPUTimer> timer;
-    PresentationCallback callback;
-  };
-  base::circular_deque<Frame> pending_frames_;
-
-  base::TimeTicks vsync_timebase_;
-  base::TimeDelta vsync_interval_;
-
-  bool waiting_for_vsync_parameters_;
-
-  base::WeakPtrFactory<NativeViewGLSurfaceGLX> weak_ptr_factory_;
+  std::unique_ptr<GLSurfacePresentationHelper> presentation_helper_;
 
   DISALLOW_COPY_AND_ASSIGN(NativeViewGLSurfaceGLX);
 };
diff --git a/ui/gl/gl_surface_presentation_helper.cc b/ui/gl/gl_surface_presentation_helper.cc
new file mode 100644
index 0000000..41acab4
--- /dev/null
+++ b/ui/gl/gl_surface_presentation_helper.cc
@@ -0,0 +1,245 @@
+// 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 "ui/gl/gl_surface_presentation_helper.h"
+
+#include "base/threading/thread_task_runner_handle.h"
+#include "ui/gfx/vsync_provider.h"
+#include "ui/gl/gl_context.h"
+#include "ui/gl/gpu_timing.h"
+
+namespace gl {
+
+GLSurfacePresentationHelper::Frame::Frame(Frame&& other) = default;
+
+GLSurfacePresentationHelper::Frame::Frame(
+    std::unique_ptr<GPUTimer>&& timer,
+    const GLSurface::PresentationCallback& callback)
+    : timer(std::move(timer)), callback(callback) {}
+
+GLSurfacePresentationHelper::Frame::~Frame() = default;
+
+GLSurfacePresentationHelper::Frame& GLSurfacePresentationHelper::Frame::
+operator=(Frame&& other) = default;
+
+GLSurfacePresentationHelper::GLSurfacePresentationHelper(
+    gfx::VSyncProvider* vsync_provider,
+    bool hw_clock)
+    : vsync_provider_(vsync_provider),
+      hw_clock_(hw_clock),
+      weak_ptr_factory_(this) {
+  DCHECK(vsync_provider_);
+}
+
+GLSurfacePresentationHelper::GLSurfacePresentationHelper(
+    base::TimeTicks timebase,
+    base::TimeDelta interval)
+    : vsync_provider_(nullptr),
+      hw_clock_(false),
+      vsync_timebase_(timebase),
+      vsync_interval_(interval),
+      weak_ptr_factory_(this) {}
+
+GLSurfacePresentationHelper::~GLSurfacePresentationHelper() {
+  // Discard pending frames and run presentation callback with empty
+  // PresentationFeedback.
+  bool has_context = gl_context_ && gl_context_->IsCurrent(surface_);
+  for (auto& frame : pending_frames_) {
+    frame.timer->Destroy(has_context);
+    frame.callback.Run(gfx::PresentationFeedback());
+  }
+  pending_frames_.clear();
+}
+
+void GLSurfacePresentationHelper::OnMakeCurrent(GLContext* context,
+                                                GLSurface* surface) {
+  DCHECK(context);
+  DCHECK(surface);
+  DCHECK(surface == surface_ || !surface_);
+  if (context == gl_context_)
+    return;
+
+  surface_ = surface;
+  // If context is changed, we assume SwapBuffers issued for previous context
+  // will be discarded.
+  if (gpu_timing_client_) {
+    gpu_timing_client_ = nullptr;
+    for (auto& frame : pending_frames_) {
+      frame.timer->Destroy(false /* has_context */);
+      frame.callback.Run(gfx::PresentationFeedback());
+    }
+    pending_frames_.clear();
+  }
+
+  gl_context_ = context;
+  gpu_timing_client_ = context->CreateGPUTimingClient();
+  if (!gpu_timing_client_->IsAvailable())
+    gpu_timing_client_ = nullptr;
+}
+
+void GLSurfacePresentationHelper::PreSwapBuffers(
+    const GLSurface::PresentationCallback& callback) {
+  std::unique_ptr<GPUTimer> timer;
+  if (gpu_timing_client_) {
+    timer = gpu_timing_client_->CreateGPUTimer(false /* prefer_elapsed_time */);
+    timer->QueryTimeStamp();
+  }
+  pending_frames_.push_back(Frame(std::move(timer), callback));
+}
+
+void GLSurfacePresentationHelper::PostSwapBuffers() {
+  if (!waiting_for_vsync_parameters_)
+    CheckPendingFrames();
+}
+
+void GLSurfacePresentationHelper::CheckPendingFrames() {
+  DCHECK(gl_context_ || pending_frames_.empty());
+  if (vsync_provider_ &&
+      vsync_provider_->SupportGetVSyncParametersIfAvailable()) {
+    if (!vsync_provider_->GetVSyncParametersIfAvailable(&vsync_timebase_,
+                                                        &vsync_interval_)) {
+      vsync_timebase_ = base::TimeTicks();
+      vsync_interval_ = base::TimeDelta();
+      LOG(ERROR) << "GetVSyncParametersIfAvailable() failed!";
+    }
+  }
+
+  if (pending_frames_.empty())
+    return;
+
+  // If the |gl_context_| is not current anymore, we assume SwapBuffers issued
+  // for previous context will be discarded.
+  if (gl_context_ && !gl_context_->IsCurrent(surface_)) {
+    gpu_timing_client_ = nullptr;
+    for (auto& frame : pending_frames_) {
+      frame.timer->Destroy(false /* has_context */);
+      frame.callback.Run(gfx::PresentationFeedback());
+    }
+    pending_frames_.clear();
+    return;
+  }
+
+  bool disjoint_occurred =
+      gpu_timing_client_ && gpu_timing_client_->CheckAndResetTimerErrors();
+  if (disjoint_occurred || !gpu_timing_client_) {
+    // If GPUTimer is not avaliable or disjoint occurred, we just run
+    // presentation callback with current system time.
+    for (auto& frame : pending_frames_) {
+      frame.callback.Run(gfx::PresentationFeedback(
+          base::TimeTicks::Now(), vsync_interval_, 0 /* flags */));
+    }
+    pending_frames_.clear();
+    return;
+  }
+
+  bool need_update_vsync = false;
+  while (!pending_frames_.empty()) {
+    auto& frame = pending_frames_.front();
+    if (!frame.timer->IsAvailable())
+      break;
+
+    int64_t start = 0;
+    int64_t end = 0;
+    frame.timer->GetStartEndTimestamps(&start, &end);
+    auto timestamp =
+        base::TimeTicks() + base::TimeDelta::FromMicroseconds(start);
+
+    // Helper lambda for running the presentation callback and releasing the
+    // frame.
+    auto frame_presentation_callback =
+        [this, &frame](const gfx::PresentationFeedback& feedback) {
+          frame.timer->Destroy(true /* has_context */);
+          frame.callback.Run(feedback);
+          pending_frames_.pop_front();
+        };
+
+    const bool fixed_vsync = !vsync_provider_;
+    if (vsync_interval_.is_zero() || fixed_vsync) {
+      // If VSync parameters are fixed or not avaliable, we just run
+      // presentation callbacks with timestamp from GPUTimers.
+      frame_presentation_callback(
+          gfx::PresentationFeedback(timestamp, vsync_interval_, 0 /* flags */));
+    } else if (timestamp < vsync_timebase_) {
+      // We got a VSync whose timestamp is after GPU finished renderering this
+      // back buffer.
+      uint32_t flags = gfx::PresentationFeedback::kVSync |
+                       gfx::PresentationFeedback::kHWCompletion;
+      auto delta = vsync_timebase_ - timestamp;
+      if (delta < vsync_interval_) {
+        // The |vsync_timebase_| is the closest VSync's timestamp after the GPU
+        // finished renderering.
+        timestamp = vsync_timebase_;
+        if (hw_clock_)
+          flags |= gfx::PresentationFeedback::kHWClock;
+      } else {
+        // The |vsync_timebase_| isn't the closest VSync's timestamp after the
+        // GPU finished renderering. We have to compute the closest VSync's
+        // timestmp.
+        timestamp =
+            timestamp.SnappedToNextTick(vsync_timebase_, vsync_interval_);
+      }
+      frame_presentation_callback(
+          gfx::PresentationFeedback(timestamp, vsync_interval_, flags));
+    } else {
+      // The |vsync_timebase_| is earlier than |timestamp| of the current
+      // pending frame. We need update vsync parameters.
+      need_update_vsync = true;
+      // We compute the next VSync's timestamp and use it to run
+      // callback.
+      auto delta = timestamp - vsync_timebase_;
+      auto offset = delta % vsync_interval_;
+      timestamp += vsync_interval_ - offset;
+      uint32_t flags = gfx::PresentationFeedback::kVSync;
+      frame_presentation_callback(
+          gfx::PresentationFeedback(timestamp, vsync_interval_, flags));
+    }
+  }
+
+  if (waiting_for_vsync_parameters_ || !need_update_vsync ||
+      pending_frames_.empty())
+    return;
+
+  waiting_for_vsync_parameters_ = true;
+  if (vsync_provider_ &&
+      !vsync_provider_->SupportGetVSyncParametersIfAvailable()) {
+    // In this case, the |vsync_provider_| will call the callback when the next
+    // VSync is received.
+    vsync_provider_->GetVSyncParameters(
+        base::BindRepeating(&GLSurfacePresentationHelper::UpdateVSyncCallback,
+                            weak_ptr_factory_.GetWeakPtr()));
+    return;
+  }
+
+  // If the |vsync_provider_| can not notify us for the next VSync
+  // asynchronically, we have to compute the next VSync time and post a delayed
+  // task so we can check the VSync later.
+  base::TimeDelta interval = vsync_interval_.is_zero()
+                                 ? base::TimeDelta::FromSeconds(1) / 60
+                                 : vsync_interval_;
+  auto now = base::TimeTicks::Now();
+  auto next_vsync = now.SnappedToNextTick(vsync_timebase_, interval);
+  base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+      FROM_HERE,
+      base::BindOnce(&GLSurfacePresentationHelper::CheckPendingFramesCallback,
+                     weak_ptr_factory_.GetWeakPtr()),
+      next_vsync - now);
+}
+
+void GLSurfacePresentationHelper::CheckPendingFramesCallback() {
+  DCHECK(waiting_for_vsync_parameters_);
+  waiting_for_vsync_parameters_ = false;
+  CheckPendingFrames();
+}
+
+void GLSurfacePresentationHelper::UpdateVSyncCallback(
+    const base::TimeTicks timebase,
+    const base::TimeDelta interval) {
+  DCHECK(waiting_for_vsync_parameters_);
+  waiting_for_vsync_parameters_ = false;
+  vsync_timebase_ = timebase;
+  vsync_interval_ = interval;
+  CheckPendingFrames();
+}
+
+}  // namespace gl
diff --git a/ui/gl/gl_surface_presentation_helper.h b/ui/gl/gl_surface_presentation_helper.h
new file mode 100644
index 0000000..b00f6e94
--- /dev/null
+++ b/ui/gl/gl_surface_presentation_helper.h
@@ -0,0 +1,77 @@
+// 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 UI_GL_GL_SURFACE_PRESENTATION_HELPER_H_
+#define UI_GL_GL_SURFACE_PRESENTATION_HELPER_H_
+
+#include "base/containers/circular_deque.h"
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/time/time.h"
+#include "ui/gl/gl_export.h"
+#include "ui/gl/gl_surface.h"
+
+namespace gfx {
+class VSyncProvider;
+}
+
+namespace gl {
+
+class GLContext;
+class GPUTimingClient;
+class GPUTimer;
+
+// Helper class for managering and invoke presentation callbacks for GLSurface
+// implementations.
+class GL_EXPORT GLSurfacePresentationHelper {
+ public:
+  GLSurfacePresentationHelper(gfx::VSyncProvider* vsync_provider,
+                              bool hw_clock);
+  // For using fixed VSync provider.
+  GLSurfacePresentationHelper(const base::TimeTicks timebase,
+                              const base::TimeDelta interval);
+  ~GLSurfacePresentationHelper();
+
+  void OnMakeCurrent(GLContext* context, GLSurface* surface);
+  void PreSwapBuffers(const GLSurface::PresentationCallback& callback);
+  void PostSwapBuffers();
+
+ private:
+  struct Frame {
+    Frame(Frame&& other);
+    Frame(std::unique_ptr<GPUTimer>&& timer,
+          const GLSurface::PresentationCallback& callback);
+    ~Frame();
+    Frame& operator=(Frame&& other);
+    std::unique_ptr<GPUTimer> timer;
+    GLSurface::PresentationCallback callback;
+  };
+
+  // Check |pending_frames_| and run presentation callbacks.
+  void CheckPendingFrames();
+
+  // Callback used by PostDelayedTask for running CheckPendingFrames().
+  void CheckPendingFramesCallback();
+
+  void UpdateVSyncCallback(const base::TimeTicks timebase,
+                           const base::TimeDelta interval);
+
+  gfx::VSyncProvider* const vsync_provider_;
+  const bool hw_clock_;
+  scoped_refptr<GLContext> gl_context_;
+  GLSurface* surface_ = nullptr;
+  scoped_refptr<GPUTimingClient> gpu_timing_client_;
+  base::circular_deque<Frame> pending_frames_;
+  base::TimeTicks vsync_timebase_;
+  base::TimeDelta vsync_interval_;
+  bool waiting_for_vsync_parameters_ = false;
+
+  base::WeakPtrFactory<GLSurfacePresentationHelper> weak_ptr_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(GLSurfacePresentationHelper);
+};
+
+}  // namespace gl
+
+#endif  // UI_GL_GL_SURFACE_PRESENTATION_HELPER_H_
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 3a90e91..76a576b 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -475,7 +475,8 @@
   TRACE_EVENT0("vk", "OnTextInputStateChanged");
 
   bool focused =
-      client && (client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE);
+      client && (client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE &&
+                 client->GetTextInputMode() != ui::TEXT_INPUT_MODE_NONE);
   bool should_hide = !focused && container_behavior_->TextBlurHidesKeyboard();
 
   if (should_hide) {
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index 9426979..fad8f1e 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -274,7 +274,8 @@
   void SetFocus(ui::TextInputClient* client) {
     ui::InputMethod* input_method = ui()->GetInputMethod();
     input_method->SetFocusedTextInputClient(client);
-    if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE) {
+    if (client && client->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE &&
+        client->GetTextInputMode() != ui::TEXT_INPUT_MODE_NONE) {
       input_method->ShowImeIfNeeded();
       if (controller_->ui()->GetContentsWindow()->bounds().height() == 0) {
         // Set initial bounds for test keyboard window.
@@ -726,4 +727,35 @@
   EXPECT_EQ(1, is_available_number_of_calls());
 }
 
+TEST_F(KeyboardControllerTest, TextInputMode) {
+  ScopedAccessibilityKeyboardEnabler scoped_keyboard_enabler;
+  ui::DummyTextInputClient input_client(ui::TEXT_INPUT_TYPE_TEXT,
+                                        ui::TEXT_INPUT_MODE_TEXT);
+  ui::DummyTextInputClient no_input_client(ui::TEXT_INPUT_TYPE_TEXT,
+                                           ui::TEXT_INPUT_MODE_NONE);
+
+  base::RunLoop run_loop;
+  aura::Window* keyboard_container(controller()->GetContainerWindow());
+  std::unique_ptr<KeyboardContainerObserver> keyboard_container_observer(
+      new KeyboardContainerObserver(keyboard_container, &run_loop));
+  root_window()->AddChild(keyboard_container);
+
+  SetFocus(&input_client);
+
+  EXPECT_TRUE(keyboard_container->IsVisible());
+
+  SetFocus(&no_input_client);
+  // Keyboard should not immediately hide itself. It is delayed to avoid layout
+  // flicker when the focus of input field quickly change.
+  EXPECT_TRUE(keyboard_container->IsVisible());
+  EXPECT_TRUE(WillHideKeyboard());
+  // Wait for hide keyboard to finish.
+
+  RunLoop(&run_loop);
+  EXPECT_FALSE(keyboard_container->IsVisible());
+
+  SetFocus(&input_client);
+  EXPECT_TRUE(keyboard_container->IsVisible());
+}
+
 }  // namespace keyboard