diff --git a/DEPS b/DEPS
index 6308819..ba0567d 100644
--- a/DEPS
+++ b/DEPS
@@ -228,7 +228,7 @@
     Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067',
 
   'src/third_party/webrtc':
-    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '9ce24c7963d329a9222f2e093f9b4ab2ea77d469', # commit position 15894
+    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + 'af5a0a05e5bfc8bf22c0be334f4e8c0a9f600875', # commit position 15911
 
   'src/third_party/openmax_dl':
     Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' +  Var('openmax_dl_revision'),
diff --git a/chrome/VERSION b/chrome/VERSION
index b6707bd..13ff98b 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
 MAJOR=57
 MINOR=0
-BUILD=2973
+BUILD=2974
 PATCH=0
diff --git a/chrome/android/java/res/drawable/ic_info_outline_black.xml b/chrome/android/java/res/drawable/ic_info_outline_black.xml
deleted file mode 100644
index 6e1c2187..0000000
--- a/chrome/android/java/res/drawable/ic_info_outline_black.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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. -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:targetApi="21"
-    android:width="32dp"
-    android:height="20dp"
-    android:viewportWidth="128"
-    android:viewportHeight="80">
-
-    <path
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M 0 0 L 128 0 L 128 80 L 0 80 Z" />
-    <path
-        android:fillColor="#000000"
-        android:fillAlpha="0.54"
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M60,60 L68,60 L68,36 L60,36 L60,60 Z M64,0 C41.92,0 24,17.92 24,40 C24,62.08
-41.92,80 64,80 C86.08,80 104,62.08 104,40 C104,17.92 86.08,0 64,0 Z M64,72
-C46.36,72 32,57.64 32,40 C32,22.36 46.36,8 64,8 C81.64,8 96,22.36 96,40
-C96,57.64 81.64,72 64,72 Z M60,28 L68,28 L68,20 L60,20 L60,28 Z" />
-</vector>
diff --git a/chrome/android/java/res/drawable/ic_info_outline_grey.xml b/chrome/android/java/res/drawable/ic_info_outline_grey.xml
new file mode 100644
index 0000000..9f4d2eb2
--- /dev/null
+++ b/chrome/android/java/res/drawable/ic_info_outline_grey.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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. -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:targetApi="21"
+    android:width="16dp"
+    android:height="16dp"
+    android:viewportWidth="16"
+    android:viewportHeight="16">
+
+    <path
+        android:pathData="M -1 -1 H 17 V 17 H -1 V -1 Z" />
+    <path
+        android:fillType="evenOdd"
+        android:pathData="M0,0l16,0l0,16l-16,0l0,-16z" />
+    <path
+        android:fillColor="@color/light_normal_color"
+        android:fillType="evenOdd"
+        android:pathData="M8,1c-3.864,0 -7,3.136 -7,7c0,3.864 3.136,7 7,7c3.864,0 7,-3.136 7,-7c0,-3.864
+-3.136,-7 -7,-7l0,0zm-5.5,7c0,-3.031875 2.468125,-5.5 5.5,-5.5c3.031875,0
+5.5,2.468125 5.5,5.5c0,3.031875 -2.468125,5.5 -5.5,5.5c-3.031875,0
+-5.5,-2.468125 -5.5,-5.5zm6.5,4l0,-5l-2,0l0,5l2,0zm-2,-6l2,0l0,-2l-2,0l0,2l0,0z" />
+</vector>
\ No newline at end of file
diff --git a/chrome/android/java/res/drawable/ic_warning_black.xml b/chrome/android/java/res/drawable/ic_warning_black.xml
deleted file mode 100644
index 13b848c..0000000
--- a/chrome/android/java/res/drawable/ic_warning_black.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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. -->
-
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:targetApi="21"
-    android:width="32dp"
-    android:height="20dp"
-    android:viewportWidth="128"
-    android:viewportHeight="80">
-
-    <path
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M 0 0 L 128 0 L 128 80 L 0 80 Z" />
-    <path
-        android:fillColor="#000000"
-        android:fillAlpha="0.54"
-        android:fillType="evenOdd"
-        android:strokeWidth="1"
-        android:pathData="M20,76 L108,76 L64,0 L20,76 Z M68,64 L60,64 L60,56 L68,56 L68,64 Z M68,48 L60,48
-L60,32 L68,32 L68,48 Z" />
-</vector>
diff --git a/chrome/android/java/res/drawable/ic_warning_red.xml b/chrome/android/java/res/drawable/ic_warning_red.xml
new file mode 100644
index 0000000..55ba231
--- /dev/null
+++ b/chrome/android/java/res/drawable/ic_warning_red.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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. -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    tools:targetApi="21"
+    android:width="16dp"
+    android:height="16dp"
+    android:viewportWidth="16"
+    android:viewportHeight="16">
+
+    <path
+        android:pathData="M -1 -1 H 17 V 17 H -1 V -1 Z" />
+    <path
+        android:fillAlpha="0"
+        android:fillType="evenOdd"
+        android:strokeAlpha="0"
+        android:strokeWidth="1"
+        android:pathData="M 0 0 H 16 V 16 H 0 V 0 Z" />
+    <path
+        android:fillColor="@color/google_red_700"
+        android:fillType="evenOdd"
+        android:pathData="M0.5,14l15,0l-7.5,-13l-7.5,13l0,0zm8.5,-2l-2,0l0,-2l2,0l0,2l0,0zm0,-3l-2,0l0,-3l2,0l0,3l0,0z" />
+</vector>
\ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java
index 6b8b0750..0edbf902 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaImageManager.java
@@ -10,6 +10,7 @@
 import android.graphics.Rect;
 import android.text.TextUtils;
 
+import org.chromium.base.VisibleForTesting;
 import org.chromium.content_public.browser.ImageDownloadCallback;
 import org.chromium.content_public.browser.WebContents;
 
@@ -54,7 +55,8 @@
     private static final double TYPE_SCORE_XICON = 0.4;
     private static final double TYPE_SCORE_GIF = 0.3;
 
-    private static final int MAX_BITMAP_SIZE_FOR_DOWNLOAD = 2048;
+    @VisibleForTesting
+    static final int MAX_BITMAP_SIZE_FOR_DOWNLOAD = 2048;
 
     private static final Object LOCK = new Object();
 
@@ -117,7 +119,7 @@
 
     /**
      * Select the best image from |images| and start download.
-     * @param images The list of images to choose from.
+     * @param images The list of images to choose from. Null is equivalent to empty list.
      * @param callback The callback when image download completes.
      */
     public void downloadImage(List<MediaImage> images, MediaImageCallback callback) {
@@ -144,14 +146,6 @@
     }
 
     /**
-     * Clear previous requests.
-     */
-    public void clearRequests() {
-        mRequestId = -1;
-        mCallback = null;
-    }
-
-    /**
      * ImageDownloadCallback implementation. This method is called when an download image request is
      * completed. The class will only keep the latest request. If some call to this method is
      * corresponding to a previous request, it will be ignored.
@@ -160,7 +154,11 @@
     public void onFinishDownloadImage(int id, int httpStatusCode, String imageUrl,
             List<Bitmap> bitmaps, List<Rect> originalImageSizes) {
         if (id != mRequestId) return;
-        if (httpStatusCode < 200 || httpStatusCode >= 300) return;
+        if (httpStatusCode < 200 || httpStatusCode >= 300) {
+            mCallback.onImageDownloaded(null);
+            clearRequests();
+            return;
+        }
 
         Iterator<Bitmap> iterBitmap = bitmaps.iterator();
         Iterator<Rect> iterSize = originalImageSizes.iterator();
@@ -182,9 +180,11 @@
 
     /**
      * Select the best image from the |images|.
-     * @param images The list of images to select from.
+     * @param images The list of images to select from. Null is equivalent to empty list.
      */
     private MediaImage selectImage(List<MediaImage> images) {
+        if (images == null) return null;
+
         MediaImage selectedImage = null;
         double bestScore = 0;
         for (MediaImage image : images) {
@@ -197,6 +197,11 @@
         return selectedImage;
     }
 
+    private void clearRequests() {
+        mRequestId = -1;
+        mCallback = null;
+    }
+
     private double getImageScore(MediaImage image) {
         if (image == null) return 0;
         if (image.getSizes().isEmpty()) return DEFAULT_IMAGE_SIZE_SCORE;
@@ -216,7 +221,6 @@
 
     private double getImageDominantSizeScore(int width, int height) {
         int dominantSize = Math.max(width, height);
-
         // When the size is "any".
         if (dominantSize == 0) return 0.8;
         // Ignore images that are too small.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
index 9a07e75..4ee63e6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/ui/MediaSessionTabHelper.java
@@ -219,10 +219,9 @@
             @Override
             public void mediaSessionMetadataChanged(MediaMetadata metadata) {
                 mPageMetadata = metadata;
-                if (mPageMetadata != null) {
-                    mMediaImageManager.downloadImage(mPageMetadata.getArtwork(),
-                            MediaSessionTabHelper.this);
-                }
+                mMediaImageManager.downloadImage(
+                        (mPageMetadata != null) ? mPageMetadata.getArtwork() : null,
+                        MediaSessionTabHelper.this);
                 updateNotificationMetadata();
             }
 
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
index f91a05b..aeebea4 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -1507,6 +1507,7 @@
   "junit/src/org/chromium/chrome/browser/media/router/cast/JSONTestUtils.java",
   "junit/src/org/chromium/chrome/browser/media/router/cast/MediaSourceTest.java",
   "junit/src/org/chromium/chrome/browser/media/router/cast/TestUtils.java",
+  "junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java",
   "junit/src/org/chromium/chrome/browser/media/ui/MediaNotificationButtonComputationTest.java",
   "junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java",
   "junit/src/org/chromium/chrome/browser/ntp/NativePageFactoryTest.java",
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java
new file mode 100644
index 0000000..c82cca31
--- /dev/null
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/ui/MediaImageManagerTest.java
@@ -0,0 +1,208 @@
+// 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.
+
+package org.chromium.chrome.browser.media.ui;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNotNull;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import static org.chromium.content_public.common.MediaMetadata.MediaImage;
+
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowLog;
+
+import org.chromium.content_public.browser.WebContents;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+
+import java.util.ArrayList;
+
+/**
+ * Robolectric tests for MediaImageManager.
+ */
+@RunWith(LocalRobolectricTestRunner.class)
+@Config(manifest = Config.NONE)
+public class MediaImageManagerTest {
+    private static final int TINY_IMAGE_SIZE_PX = 50;
+    private static final int MIN_IMAGE_SIZE_PX = 100;
+    private static final int IDEAL_IMAGE_SIZE_PX = 200;
+    private static final int REQUEST_ID_1 = 1;
+    private static final int REQUEST_ID_2 = 2;
+    private static final String IMAGE_URL = "http://example.com/foo.png";
+
+    @Mock
+    private WebContents mWebContents;
+    @Mock
+    private MediaImageCallback mCallback;
+
+    private MediaImageManager mMediaImageManager;
+
+    // Prepared data for feeding.
+    private ArrayList<MediaImage> mImages;
+    private ArrayList<Bitmap> mBitmaps;
+    private ArrayList<Rect> mOriginalImageSizes;
+
+    @Before
+    public void setUp() {
+        ShadowLog.stream = System.out;
+        MockitoAnnotations.initMocks(this);
+        doReturn(REQUEST_ID_1)
+                .when(mWebContents)
+                .downloadImage(anyString(), anyBoolean(), anyInt(), anyBoolean(),
+                        any(MediaImageManager.class));
+        mMediaImageManager = new MediaImageManager(MIN_IMAGE_SIZE_PX, IDEAL_IMAGE_SIZE_PX);
+        mMediaImageManager.setWebContents(mWebContents);
+
+        mImages = new ArrayList<MediaImage>();
+        mImages.add(new MediaImage(IMAGE_URL, "", new ArrayList<Rect>()));
+
+        mBitmaps = new ArrayList<Bitmap>();
+        mBitmaps.add(Bitmap.createBitmap(
+                IDEAL_IMAGE_SIZE_PX, IDEAL_IMAGE_SIZE_PX, Bitmap.Config.ARGB_8888));
+
+        mOriginalImageSizes = new ArrayList<Rect>();
+        mOriginalImageSizes.add(new Rect(0, 0, IDEAL_IMAGE_SIZE_PX, IDEAL_IMAGE_SIZE_PX));
+    }
+
+    @Test
+    public void testDownloadImage() {
+        mMediaImageManager.downloadImage(mImages, mCallback);
+        verify(mWebContents)
+                .downloadImage(eq(IMAGE_URL), eq(false),
+                        eq(MediaImageManager.MAX_BITMAP_SIZE_FOR_DOWNLOAD), eq(false),
+                        eq(mMediaImageManager));
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_1, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        verify(mCallback).onImageDownloaded(isNotNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNull(Bitmap.class));
+    }
+
+    @Test
+    public void testDownloadImageTwice() {
+        // First download.
+        mMediaImageManager.downloadImage(mImages, mCallback);
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_1, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        // Second download.
+        doReturn(REQUEST_ID_2)
+                .when(mWebContents)
+                .downloadImage(anyString(), anyBoolean(), anyInt(), anyBoolean(),
+                        any(MediaImageManager.class));
+        mMediaImageManager.downloadImage(mImages, mCallback);
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_2, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        verify(mWebContents, times(2))
+                .downloadImage(eq(IMAGE_URL), eq(false),
+                        eq(MediaImageManager.MAX_BITMAP_SIZE_FOR_DOWNLOAD), eq(false),
+                        eq(mMediaImageManager));
+        verify(mCallback, times(2)).onImageDownloaded(isNotNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNull(Bitmap.class));
+    }
+
+    @Test
+    public void testDuplicateResponce() {
+        mMediaImageManager.downloadImage(mImages, mCallback);
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_1, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_1, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        verify(mCallback, times(1)).onImageDownloaded(isNotNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNull(Bitmap.class));
+    }
+
+    @Test
+    public void testWrongResponceId() {
+        mMediaImageManager.downloadImage(mImages, mCallback);
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_2, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        verify(mCallback, times(0)).onImageDownloaded(isNotNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNull(Bitmap.class));
+    }
+
+    @Test
+    public void testTinyImagesRemovedBeforeDownloading() {
+        mImages.clear();
+        ArrayList<Rect> sizes = new ArrayList<Rect>();
+        sizes.add(new Rect(0, 0, TINY_IMAGE_SIZE_PX, TINY_IMAGE_SIZE_PX));
+        mImages.add(new MediaImage(IMAGE_URL, "", sizes));
+        mMediaImageManager.downloadImage(mImages, mCallback);
+
+        verify(mWebContents, times(0))
+                .downloadImage(anyString(), anyBoolean(), anyInt(), anyBoolean(),
+                        any(MediaImageManager.class));
+        verify(mCallback).onImageDownloaded(isNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNotNull(Bitmap.class));
+    }
+
+    @Test
+    public void testTinyImagesRemovedAfterDownloading() {
+        mMediaImageManager.downloadImage(mImages, mCallback);
+
+        // Reset the data for feeding.
+        mBitmaps.clear();
+        mBitmaps.add(Bitmap.createBitmap(
+                TINY_IMAGE_SIZE_PX, TINY_IMAGE_SIZE_PX, Bitmap.Config.ARGB_8888));
+        mOriginalImageSizes.clear();
+        mOriginalImageSizes.add(new Rect(0, 0, TINY_IMAGE_SIZE_PX, TINY_IMAGE_SIZE_PX));
+
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_1, 200, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        verify(mCallback).onImageDownloaded(isNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNotNull(Bitmap.class));
+    }
+
+    @Test
+    public void testDownloadImageFails() {
+        mMediaImageManager.downloadImage(mImages, mCallback);
+        mMediaImageManager.onFinishDownloadImage(
+                REQUEST_ID_1, 404, IMAGE_URL, mBitmaps, mOriginalImageSizes);
+
+        verify(mCallback).onImageDownloaded(isNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNotNull(Bitmap.class));
+    }
+
+    @Test
+    public void testEmptyImageList() {
+        mImages.clear();
+        mMediaImageManager.downloadImage(mImages, mCallback);
+
+        verify(mWebContents, times(0))
+                .downloadImage(anyString(), anyBoolean(), anyInt(), anyBoolean(),
+                        any(MediaImageManager.class));
+        verify(mCallback).onImageDownloaded(isNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNotNull(Bitmap.class));
+    }
+
+    @Test
+    public void testNullImageList() {
+        mMediaImageManager.downloadImage(null, mCallback);
+
+        verify(mWebContents, times(0))
+                .downloadImage(anyString(), anyBoolean(), anyInt(), anyBoolean(),
+                        any(MediaImageManager.class));
+        verify(mCallback).onImageDownloaded(isNull(Bitmap.class));
+        verify(mCallback, times(0)).onImageDownloaded(isNotNull(Bitmap.class));
+    }
+}
\ No newline at end of file
diff --git a/chrome/browser/android/ntp/ntp_snippets_bridge.cc b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
index 939435e..ee8c1fe8 100644
--- a/chrome/browser/android/ntp/ntp_snippets_bridge.cc
+++ b/chrome/browser/android/ntp/ntp_snippets_bridge.cc
@@ -399,7 +399,15 @@
 void NTPSnippetsBridge::OnNTPInitialized(
     JNIEnv* env,
     const base::android::JavaParamRef<jobject>& obj) {
-  content_suggestions_service_->remote_suggestions_scheduler()->OnNTPOpened();
+  ntp_snippets::RemoteSuggestionsScheduler* scheduler =
+      GetRemoteSuggestionsScheduler();
+  // Can be null if the feature has been disabled but the scheduler has not been
+  // unregistered yet. The next start should unregister it.
+  if (!scheduler) {
+    return;
+  }
+
+  scheduler->OnNTPOpened();
 }
 
 NTPSnippetsBridge::~NTPSnippetsBridge() {}
diff --git a/chrome/browser/android/payments/service_worker_payment_app_bridge.cc b/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
index 9ab20a3..9ea58f1 100644
--- a/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
+++ b/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
@@ -10,7 +10,7 @@
 #include "components/payments/payment_app.mojom.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/browser/payment_app_context.h"
+#include "content/public/browser/payment_app_provider.h"
 #include "content/public/browser/storage_partition.h"
 #include "content/public/browser/web_contents.h"
 #include "jni/ServiceWorkerPaymentAppBridge_jni.h"
@@ -26,7 +26,7 @@
 
 void OnGotAllManifests(const JavaRef<jobject>& jweb_contents,
                        const JavaRef<jobject>& jcallback,
-                       content::PaymentAppContext::Manifests manifests) {
+                       content::PaymentAppProvider::Manifests manifests) {
   JNIEnv* env = AttachCurrentThread();
 
   for (const auto& entry : manifests) {
@@ -67,17 +67,11 @@
   content::WebContents* web_contents =
       content::WebContents::FromJavaWebContents(jweb_contents);
 
-  content::BrowserContext* browser_context = web_contents->GetBrowserContext();
-
-  content::StoragePartition* storage_partition =
-      content::BrowserContext::GetDefaultStoragePartition(browser_context);
-
-  content::PaymentAppContext* payment_app_context =
-      storage_partition->GetPaymentAppContext();
-
-  payment_app_context->GetAllManifests(base::Bind(
-      &OnGotAllManifests, ScopedJavaGlobalRef<jobject>(env, jweb_contents),
-      ScopedJavaGlobalRef<jobject>(env, jcallback)));
+  content::PaymentAppProvider::GetInstance()->GetAllManifests(
+      web_contents->GetBrowserContext(),
+      base::Bind(&OnGotAllManifests,
+                 ScopedJavaGlobalRef<jobject>(env, jweb_contents),
+                 ScopedJavaGlobalRef<jobject>(env, jcallback)));
 }
 
 static void InvokePaymentApp(JNIEnv* env,
diff --git a/chrome/browser/android/resource_id.h b/chrome/browser/android/resource_id.h
index 6602c0c..63b2900 100644
--- a/chrome/browser/android/resource_id.h
+++ b/chrome/browser/android/resource_id.h
@@ -74,9 +74,8 @@
 LINK_RESOURCE_ID(IDR_AUTOFILL_CC_MIR, R.drawable.mir_card)
 LINK_RESOURCE_ID(IDR_AUTOFILL_CC_VISA, R.drawable.visa_card)
 LINK_RESOURCE_ID(IDR_AUTOFILL_CC_SCAN_NEW, R.drawable.ic_photo_camera_black)
-LINK_RESOURCE_ID(IDR_AUTOFILL_HTTP_WARNING, R.drawable.ic_info_outline_black)
-LINK_RESOURCE_ID(IDR_AUTOFILL_HTTPS_INVALID_WARNING,
-                 R.drawable.ic_warning_black)
+LINK_RESOURCE_ID(IDR_AUTOFILL_HTTP_WARNING, R.drawable.ic_info_outline_grey)
+LINK_RESOURCE_ID(IDR_AUTOFILL_HTTPS_INVALID_WARNING, R.drawable.ic_warning_red)
 
 // We display settings icon for keyboard accessory using Android's
 // |VectorDrawableCompat|. We do not display settings icon for autofill popup.
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 03d3f3b9..5f88f21d 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -240,9 +240,6 @@
       override {
     return nullptr;
   }
-  content::PaymentAppContext* GetPaymentAppContext() override {
-    return nullptr;
-  }
   content::HostZoomMap* GetHostZoomMap() override { return nullptr; }
   content::HostZoomLevelContext* GetHostZoomLevelContext() override {
     return nullptr;
diff --git a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
index 7bb3137..ea214af 100644
--- a/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
+++ b/chrome/browser/ntp_snippets/content_suggestions_service_factory.cc
@@ -193,7 +193,7 @@
   auto scheduling_provider =
       base::MakeUnique<SchedulingRemoteSuggestionsProvider>(
           service, std::move(provider), scheduler, service->user_classifier(),
-          pref_service);
+          pref_service, base::MakeUnique<base::DefaultClock>());
   service->set_remote_suggestions_provider(scheduling_provider.get());
   service->set_remote_suggestions_scheduler(scheduling_provider.get());
   service->RegisterProvider(std::move(scheduling_provider));
diff --git a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
index 917edd8..5b79e0e8 100644
--- a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
@@ -31,6 +31,7 @@
 #include "components/subresource_filter/core/browser/subresource_filter_features_test_support.h"
 #include "components/subresource_filter/core/common/activation_state.h"
 #include "components/subresource_filter/core/common/scoped_timers.h"
+#include "components/subresource_filter/core/common/test_ruleset_utils.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
@@ -174,6 +175,8 @@
 
 using subresource_filter::testing::ScopedSubresourceFilterFeatureToggle;
 using subresource_filter::testing::TestRulesetPublisher;
+using subresource_filter::testing::TestRulesetCreator;
+using subresource_filter::testing::TestRulesetPair;
 
 // SubresourceFilterDisabledBrowserTest ---------------------------------------
 
@@ -228,6 +231,8 @@
     PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
     embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
     host_resolver()->AddSimulatedFailure("host-with-dns-lookup-failure");
+    host_resolver()->AddRule("*", "127.0.0.1");
+    content::SetupCrossSiteRedirector(embedded_test_server());
     ASSERT_TRUE(embedded_test_server()->Start());
   }
 
@@ -297,8 +302,18 @@
   }
 
   void SetRulesetToDisallowURLsWithPathSuffix(const std::string& suffix) {
+    TestRulesetPair test_ruleset_pair;
+    ruleset_creator_.CreateRulesetToDisallowURLsWithPathSuffix(
+        suffix, &test_ruleset_pair);
     ASSERT_NO_FATAL_FAILURE(
-        test_ruleset_publisher_.SetRulesetToDisallowURLsWithPathSuffix(suffix));
+        test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed));
+  }
+
+  void SetRulesetWithRules(const std::vector<proto::UrlRule>& rules) {
+    TestRulesetPair test_ruleset_pair;
+    ruleset_creator_.CreateRulesetWithRules(rules, &test_ruleset_pair);
+    ASSERT_NO_FATAL_FAILURE(
+        test_ruleset_publisher_.SetRuleset(test_ruleset_pair.unindexed));
   }
 
  private:
@@ -308,6 +323,7 @@
   std::unique_ptr<ScopedSubresourceFilterFeatureToggle> scoped_feature_toggle_;
   TestRulesetPublisher test_ruleset_publisher_;
   bool measure_performance_;
+  TestRulesetCreator ruleset_creator_;
 
   DISALLOW_COPY_AND_ASSIGN(SubresourceFilterBrowserTestImpl);
 };
@@ -556,6 +572,30 @@
   tester.ExpectBucketCount(kSubresourceFilterPromptHistogram, true, 2);
 }
 
+IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
+                       CrossSiteSubFrameActivationWithoutWhitelist) {
+  GURL a_url(embedded_test_server()->GetURL(
+      "a.com", "/subresource_filter/frame_cross_site_set.html"));
+  ConfigureAsPhishingURL(a_url);
+  ASSERT_NO_FATAL_FAILURE(
+      SetRulesetToDisallowURLsWithPathSuffix("included_script.js"));
+  ui_test_utils::NavigateToURL(browser(), a_url);
+  ExpectParsedScriptElementLoadedStatusInFrames({"b", "c", "d"},
+                                                {false, false, false});
+}
+
+IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
+                       CrossSiteSubFrameActivationWithWhitelist) {
+  GURL a_url(embedded_test_server()->GetURL(
+      "a.com", "/subresource_filter/frame_cross_site_set.html"));
+  ConfigureAsPhishingURL(a_url);
+  ASSERT_NO_FATAL_FAILURE(
+      SetRulesetWithRules({testing::CreateSuffixRule("included_script.js"),
+                           testing::CreateWhitelistRuleForDocument("c.com")}));
+  ui_test_utils::NavigateToURL(browser(), a_url);
+  ExpectParsedScriptElementLoadedStatusInFrames({"b", "d"}, {false, true});
+}
+
 // Tests checking how histograms are recorded. ---------------------------------
 
 namespace {
diff --git a/chrome/browser/subresource_filter/test_ruleset_publisher.cc b/chrome/browser/subresource_filter/test_ruleset_publisher.cc
index 9ee1e9c..ea9c817 100644
--- a/chrome/browser/subresource_filter/test_ruleset_publisher.cc
+++ b/chrome/browser/subresource_filter/test_ruleset_publisher.cc
@@ -4,7 +4,9 @@
 
 #include "chrome/browser/subresource_filter/test_ruleset_publisher.h"
 
+#include "base/hash.h"
 #include "base/run_loop.h"
+#include "base/strings/string_number_conversions.h"
 #include "chrome/browser/browser_process.h"
 #include "components/subresource_filter/content/browser/content_ruleset_service_delegate.h"
 #include "components/subresource_filter/core/browser/ruleset_service.h"
@@ -42,17 +44,13 @@
 TestRulesetPublisher::TestRulesetPublisher() = default;
 TestRulesetPublisher::~TestRulesetPublisher() = default;
 
-void TestRulesetPublisher::SetRulesetToDisallowURLsWithPathSuffix(
-    const std::string& suffix) {
-  const std::string& test_ruleset_content_version(suffix);
-  TestRulesetPair test_ruleset_pair;
-  ASSERT_NO_FATAL_FAILURE(
-      ruleset_creator_.CreateRulesetToDisallowURLsWithPathSuffix(
-          suffix, &test_ruleset_pair))
-      << suffix;
+void TestRulesetPublisher::SetRuleset(const TestRuleset& unindexed_ruleset) {
+  const std::string& test_ruleset_content_version(base::SizeTToString(
+      base::Hash(std::string(unindexed_ruleset.contents.begin(),
+                             unindexed_ruleset.contents.end()))));
   subresource_filter::UnindexedRulesetInfo unindexed_ruleset_info;
   unindexed_ruleset_info.content_version = test_ruleset_content_version;
-  unindexed_ruleset_info.ruleset_path = test_ruleset_pair.unindexed.path;
+  unindexed_ruleset_info.ruleset_path = unindexed_ruleset.path;
   RulesetDistributionListener listener;
   g_browser_process->subresource_filter_ruleset_service()
       ->IndexAndStoreAndPublishRulesetIfNeeded(unindexed_ruleset_info);
diff --git a/chrome/browser/subresource_filter/test_ruleset_publisher.h b/chrome/browser/subresource_filter/test_ruleset_publisher.h
index 34d25498..e704ff1 100644
--- a/chrome/browser/subresource_filter/test_ruleset_publisher.h
+++ b/chrome/browser/subresource_filter/test_ruleset_publisher.h
@@ -5,8 +5,6 @@
 #ifndef CHROME_BROWSER_SUBRESOURCE_FILTER_TEST_RULESET_PUBLISHER_H_
 #define CHROME_BROWSER_SUBRESOURCE_FILTER_TEST_RULESET_PUBLISHER_H_
 
-#include <string>
-
 #include "base/macros.h"
 #include "components/subresource_filter/core/common/test_ruleset_creator.h"
 
@@ -20,15 +18,11 @@
   TestRulesetPublisher();
   ~TestRulesetPublisher();
 
-  // Creates a testing ruleset to filter subresource loads whose URLs end with
-  // the given |suffix|. Then gets this ruleset indexed and published to all
-  // renderers via the RulesetService. Spins a nested message loop until done.
-  // For simplicity, the |suffix| is also used as the content version of the
-  // ruleset, so it must be a valid path component.
-  void SetRulesetToDisallowURLsWithPathSuffix(const std::string& suffix);
+  // Indexes the |unindexed_ruleset| and publishes it to all renderers
+  // via the RulesetService. Spins a nested message loop until done.
+  void SetRuleset(const TestRuleset& unindexed_ruleset);
 
  private:
-  TestRulesetCreator ruleset_creator_;
 
   DISALLOW_COPY_AND_ASSIGN(TestRulesetPublisher);
 };
diff --git a/chrome/test/data/subresource_filter/frame_cross_site_set.html b/chrome/test/data/subresource_filter/frame_cross_site_set.html
new file mode 100644
index 0000000..8b534202
--- /dev/null
+++ b/chrome/test/data/subresource_filter/frame_cross_site_set.html
@@ -0,0 +1,6 @@
+<html>
+  <body>
+    <iframe name="b" src="/cross-site/b.com/subresource_filter/frame_with_included_script.html"></iframe>
+    <iframe name="c" src="/cross-site/c.com/subresource_filter/frame_d.html"></iframe>
+  </body>
+</html>
diff --git a/chrome/test/data/subresource_filter/frame_d.html b/chrome/test/data/subresource_filter/frame_d.html
new file mode 100644
index 0000000..e4cd45a
--- /dev/null
+++ b/chrome/test/data/subresource_filter/frame_d.html
@@ -0,0 +1,5 @@
+<html>
+  <body>
+    <iframe name="d" src="/cross-site/d.com/subresource_filter/frame_with_included_script.html"></iframe>
+  </body>
+</html>
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker.cc b/components/ntp_snippets/category_rankers/click_based_category_ranker.cc
index fa6a28c..66c00b90 100644
--- a/components/ntp_snippets/category_rankers/click_based_category_ranker.cc
+++ b/components/ntp_snippets/category_rankers/click_based_category_ranker.cc
@@ -109,6 +109,12 @@
 }
 
 void ClickBasedCategoryRanker::ClearHistory(base::Time begin, base::Time end) {
+  // Ignore all partial removals and react only to "entire" history removal.
+  bool is_entire_history = (begin == base::Time() && end == base::Time::Max());
+  if (!is_entire_history) {
+    return;
+  }
+
   StoreLastDecayTimeToPrefs(base::Time::FromInternalValue(0));
 
   // The categories added through |AppendCategoryIfNecessary| cannot be
diff --git a/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc b/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
index a37e30c..1956fea 100644
--- a/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
+++ b/components/ntp_snippets/category_rankers/click_based_category_ranker_unittest.cc
@@ -471,4 +471,27 @@
   CompareCategories(first, second);
 }
 
+TEST_F(ClickBasedCategoryRankerTest, ShouldIgnorePartialClearHistory) {
+  Category first = AddUnusedRemoteCategory();
+  Category second = AddUnusedRemoteCategory();
+
+  ASSERT_TRUE(CompareCategories(first, second));
+
+  // Change the order.
+  while (CompareCategories(first, second)) {
+    NotifyOnSuggestionOpened(
+        /*times=*/ClickBasedCategoryRanker::GetPassingMargin(), second);
+  }
+
+  ASSERT_FALSE(CompareCategories(first, second));
+
+  // The user partially clears history.
+  base::Time begin = base::Time::Now() - base::TimeDelta::FromHours(1),
+             end = base::Time::Max();
+  ranker()->ClearHistory(begin, end);
+
+  // The order should not be cleared.
+  EXPECT_FALSE(CompareCategories(first, second));
+}
+
 }  // namespace ntp_snippets
diff --git a/components/ntp_snippets/content_suggestions_service_unittest.cc b/components/ntp_snippets/content_suggestions_service_unittest.cc
index e7914ea..3fc5246 100644
--- a/components/ntp_snippets/content_suggestions_service_unittest.cc
+++ b/components/ntp_snippets/content_suggestions_service_unittest.cc
@@ -583,7 +583,7 @@
   service()->RemoveObserver(&observer);
 }
 
-TEST_F(ContentSuggestionsServiceTest, ShouldForwardClearHistory) {
+TEST_F(ContentSuggestionsServiceTest, ShouldForwardClearHistoryToProviders) {
   Category category = Category::FromKnownCategory(KnownCategories::DOWNLOADS);
   MockProvider* provider = RegisterProvider(category);
   base::Time begin = base::Time::FromTimeT(123),
@@ -593,6 +593,22 @@
   service()->ClearHistory(begin, end, filter);
 }
 
+TEST_F(ContentSuggestionsServiceTest,
+       ShouldForwardClearHistoryToCategoryRanker) {
+  auto mock_ranker = base::MakeUnique<MockCategoryRanker>();
+  MockCategoryRanker* raw_mock_ranker = mock_ranker.get();
+  SetCategoryRanker(std::move(mock_ranker));
+
+  // The service is recreated to pick up the new ranker.
+  ResetService();
+
+  base::Time begin = base::Time::FromTimeT(123),
+             end = base::Time::FromTimeT(456);
+  EXPECT_CALL(*raw_mock_ranker, ClearHistory(begin, end));
+  base::Callback<bool(const GURL& url)> filter;
+  service()->ClearHistory(begin, end, filter);
+}
+
 TEST_F(ContentSuggestionsServiceTest, ShouldForwardFetch) {
   Category category = Category::FromKnownCategory(KnownCategories::ARTICLES);
   std::set<std::string> known_suggestions;
diff --git a/components/ntp_snippets/pref_names.cc b/components/ntp_snippets/pref_names.cc
index 116cf21..b6e96c51 100644
--- a/components/ntp_snippets/pref_names.cc
+++ b/components/ntp_snippets/pref_names.cc
@@ -11,10 +11,16 @@
 
 const char kRemoteSuggestionCategories[] = "ntp_snippets.remote_categories";
 
-const char kSnippetBackgroundFetchingIntervalWifi[] =
+const char kSnippetLastFetchAttempt[] =
+    "ntp_snippets.last_fetch_attempt";
+
+const char kSnippetSoftFetchingIntervalOnUsageEvent[] =
+    "ntp_snippets.soft_fetching_interval_on_usage_event";
+
+const char kSnippetPersistentFetchingIntervalWifi[] =
     "ntp_snippets.fetching_interval_wifi";
 
-const char kSnippetBackgroundFetchingIntervalFallback[] =
+const char kSnippetPersistentFetchingIntervalFallback[] =
     "ntp_snippets.fetching_interval_fallback";
 
 const char kSnippetFetcherRequestCount[] =
diff --git a/components/ntp_snippets/pref_names.h b/components/ntp_snippets/pref_names.h
index a95dfb02..60c05e8 100644
--- a/components/ntp_snippets/pref_names.h
+++ b/components/ntp_snippets/pref_names.h
@@ -16,12 +16,19 @@
 // and title) are stored.
 extern const char kRemoteSuggestionCategories[];
 
+// The pref name for the last time when a background fetch was attempted.
+extern const char kSnippetLastFetchAttempt[];
+// The pref name for the currently applied minimal interval between two
+// successive soft background fetches that react to user activity (such as
+// opening an NTP).
+extern const char kSnippetSoftFetchingIntervalOnUsageEvent[];
+
 // The pref name for the currently-scheduled background fetching interval when
 // there is WiFi connectivity.
-extern const char kSnippetBackgroundFetchingIntervalWifi[];
+extern const char kSnippetPersistentFetchingIntervalWifi[];
 // The pref name for the currently-scheduled background fetching interval when
 // there is no WiFi connectivity.
-extern const char kSnippetBackgroundFetchingIntervalFallback[];
+extern const char kSnippetPersistentFetchingIntervalFallback[];
 
 // The pref name for today's count of NTPSnippetsFetcher requests, so far.
 extern const char kSnippetFetcherRequestCount[];
diff --git a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc
index 7387410d..315126e 100644
--- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc
+++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.cc
@@ -4,10 +4,12 @@
 
 #include "components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h"
 
+#include <random>
 #include <string>
 #include <utility>
 
 #include "base/memory/ptr_util.h"
+#include "base/time/clock.h"
 #include "components/ntp_snippets/features.h"
 #include "components/ntp_snippets/pref_names.h"
 #include "components/ntp_snippets/remote/persistent_scheduler.h"
@@ -21,28 +23,57 @@
 
 namespace {
 
+enum class FetchingInterval {
+  PERSISTENT_FALLBACK,
+  PERSISTENT_WIFI,
+  SOFT_ON_USAGE_EVENT,
+  COUNT
+};
+
 // Default values for fetching intervals, fallback and wifi.
-const double kDefaultFetchingIntervalRareNtpUser[] = {48.0, 24.0};
-const double kDefaultFetchingIntervalActiveNtpUser[] = {24.0, 6.0};
-const double kDefaultFetchingIntervalActiveSuggestionsConsumer[] = {24.0, 6.0};
+const double kDefaultFetchingIntervalRareNtpUser[] = {48.0, 24.0, 12.0};
+const double kDefaultFetchingIntervalActiveNtpUser[] = {24.0, 6.0, 2.0};
+const double kDefaultFetchingIntervalActiveSuggestionsConsumer[] = {24.0, 6.0,
+                                                                    2.0};
 
 // Variation parameters than can the default fetching intervals.
 const char* kFetchingIntervalParamNameRareNtpUser[] = {
     "fetching_interval_hours-fallback-rare_ntp_user",
-    "fetching_interval_hours-wifi-rare_ntp_user"};
+    "fetching_interval_hours-wifi-rare_ntp_user",
+    "soft_fetching_interval_hours-active-rare_ntp_user"};
 const char* kFetchingIntervalParamNameActiveNtpUser[] = {
     "fetching_interval_hours-fallback-active_ntp_user",
-    "fetching_interval_hours-wifi-active_ntp_user"};
+    "fetching_interval_hours-wifi-active_ntp_user",
+    "soft_fetching_interval_hours-active-active_ntp_user"};
 const char* kFetchingIntervalParamNameActiveSuggestionsConsumer[] = {
     "fetching_interval_hours-fallback-active_suggestions_consumer",
-    "fetching_interval_hours-wifi-active_suggestions_consumer"};
+    "fetching_interval_hours-wifi-active_suggestions_consumer",
+    "soft_fetching_interval_hours-active-active_suggestions_consumer"};
 
-base::TimeDelta GetDesiredUpdateInterval(
-    bool is_wifi,
+static_assert(
+    static_cast<unsigned int>(FetchingInterval::COUNT) ==
+            arraysize(kDefaultFetchingIntervalRareNtpUser) &&
+        static_cast<unsigned int>(FetchingInterval::COUNT) ==
+            arraysize(kDefaultFetchingIntervalActiveNtpUser) &&
+        static_cast<unsigned int>(FetchingInterval::COUNT) ==
+            arraysize(kDefaultFetchingIntervalActiveSuggestionsConsumer) &&
+        static_cast<unsigned int>(FetchingInterval::COUNT) ==
+            arraysize(kFetchingIntervalParamNameRareNtpUser) &&
+        static_cast<unsigned int>(FetchingInterval::COUNT) ==
+            arraysize(kFetchingIntervalParamNameActiveNtpUser) &&
+        static_cast<unsigned int>(FetchingInterval::COUNT) ==
+            arraysize(kFetchingIntervalParamNameActiveSuggestionsConsumer),
+    "Fill in all the info for fetching intervals.");
+
+base::TimeDelta GetDesiredFetchingInterval(
+    FetchingInterval interval,
     UserClassifier::UserClass user_class) {
   double default_value_hours = 0.0;
 
-  const int index = is_wifi ? 1 : 0;
+  DCHECK(interval != FetchingInterval::COUNT);
+  const unsigned int index = static_cast<unsigned int>(interval);
+  DCHECK(index < arraysize(kDefaultFetchingIntervalRareNtpUser));
+
   const char* param_name = nullptr;
   switch (user_class) {
     case UserClassifier::UserClass::RARE_NTP_USER:
@@ -69,44 +100,51 @@
 
 }  // namespace
 
-struct SchedulingRemoteSuggestionsProvider::FetchingSchedule {
-  base::TimeDelta interval_wifi;
-  base::TimeDelta interval_fallback;
+// static
+SchedulingRemoteSuggestionsProvider::FetchingSchedule
+SchedulingRemoteSuggestionsProvider::FetchingSchedule::Empty() {
+  return FetchingSchedule{base::TimeDelta(), base::TimeDelta(),
+                          base::TimeDelta()};
+}
 
-  static FetchingSchedule Empty() {
-    return FetchingSchedule{base::TimeDelta(),
-                            base::TimeDelta()};
-  }
+bool SchedulingRemoteSuggestionsProvider::FetchingSchedule::operator==(
+    const FetchingSchedule& other) const {
+  return interval_persistent_wifi == other.interval_persistent_wifi &&
+         interval_persistent_fallback == other.interval_persistent_fallback &&
+         interval_soft_on_usage_event == other.interval_soft_on_usage_event;
+}
 
-  bool operator==(const FetchingSchedule& other) const {
-    return interval_wifi == other.interval_wifi &&
-           interval_fallback == other.interval_fallback;
-  }
+bool SchedulingRemoteSuggestionsProvider::FetchingSchedule::operator!=(
+    const FetchingSchedule& other) const {
+  return !operator==(other);
+}
 
-  bool operator!=(const FetchingSchedule& other) const {
-    return !operator==(other);
-  }
-
-  bool is_empty() const {
-    return interval_wifi.is_zero() && interval_fallback.is_zero();
-  }
-};
+bool SchedulingRemoteSuggestionsProvider::FetchingSchedule::is_empty() const {
+  return interval_persistent_wifi.is_zero() &&
+         interval_persistent_fallback.is_zero() &&
+         interval_soft_on_usage_event.is_zero();
+}
 
 SchedulingRemoteSuggestionsProvider::SchedulingRemoteSuggestionsProvider(
     Observer* observer,
     std::unique_ptr<RemoteSuggestionsProvider> provider,
     PersistentScheduler* persistent_scheduler,
     const UserClassifier* user_classifier,
-    PrefService* pref_service)
+    PrefService* pref_service,
+    std::unique_ptr<base::Clock> clock)
     : RemoteSuggestionsProvider(observer),
       RemoteSuggestionsScheduler(),
       provider_(std::move(provider)),
       persistent_scheduler_(persistent_scheduler),
+      background_fetch_in_progress_(false),
       user_classifier_(user_classifier),
-      pref_service_(pref_service) {
+      pref_service_(pref_service),
+      clock_(std::move(clock)) {
   DCHECK(user_classifier);
   DCHECK(pref_service);
 
+  LoadLastFetchingSchedule();
+
   provider_->SetProviderStatusCallback(
       base::MakeUnique<RemoteSuggestionsProvider::ProviderStatusCallback>(
           base::BindRepeating(
@@ -120,9 +158,12 @@
 // static
 void SchedulingRemoteSuggestionsProvider::RegisterProfilePrefs(
     PrefRegistrySimple* registry) {
-  registry->RegisterInt64Pref(prefs::kSnippetBackgroundFetchingIntervalWifi, 0);
-  registry->RegisterInt64Pref(prefs::kSnippetBackgroundFetchingIntervalFallback,
+  registry->RegisterInt64Pref(prefs::kSnippetPersistentFetchingIntervalWifi, 0);
+  registry->RegisterInt64Pref(prefs::kSnippetPersistentFetchingIntervalFallback,
                               0);
+  registry->RegisterInt64Pref(prefs::kSnippetSoftFetchingIntervalOnUsageEvent,
+                              0);
+  registry->RegisterInt64Pref(prefs::kSnippetLastFetchAttempt, 0);
 }
 
 void SchedulingRemoteSuggestionsProvider::RescheduleFetching() {
@@ -132,10 +173,11 @@
 }
 
 void SchedulingRemoteSuggestionsProvider::OnPersistentSchedulerWakeUp() {
-  provider_->RefetchInTheBackground(
-      base::MakeUnique<RemoteSuggestionsProvider::FetchStatusCallback>(
-          base::Bind(&SchedulingRemoteSuggestionsProvider::OnFetchCompleted,
-                     base::Unretained(this))));
+  if (BackgroundFetchesDisabled()) {
+    return;
+  }
+
+  RefetchInTheBackground(/*callback=*/nullptr);
 }
 
 void SchedulingRemoteSuggestionsProvider::OnBrowserStartup() {
@@ -143,17 +185,35 @@
 }
 
 void SchedulingRemoteSuggestionsProvider::OnNTPOpened() {
-  // TODO(jkrcal): Implement.
+  if (BackgroundFetchesDisabled() || !ShouldRefetchInTheBackgroundNow()) {
+    return;
+  }
+
+  RefetchInTheBackground(/*callback=*/nullptr);
 }
 
 void SchedulingRemoteSuggestionsProvider::SetProviderStatusCallback(
-      std::unique_ptr<ProviderStatusCallback> callback) {
+    std::unique_ptr<ProviderStatusCallback> callback) {
   provider_->SetProviderStatusCallback(std::move(callback));
 }
 
 void SchedulingRemoteSuggestionsProvider::RefetchInTheBackground(
     std::unique_ptr<FetchStatusCallback> callback) {
-  provider_->RefetchInTheBackground(std::move(callback));
+  if (background_fetch_in_progress_) {
+    if (callback) {
+      callback->Run(
+          Status(StatusCode::TEMPORARY_ERROR, "Background fetch in progress"));
+    }
+    return;
+  }
+
+  background_fetch_in_progress_ = true;
+  RemoteSuggestionsProvider::FetchStatusCallback wrapper_callback = base::Bind(
+      &SchedulingRemoteSuggestionsProvider::RefetchInTheBackgroundFinished,
+      base::Unretained(this), base::Passed(&callback));
+  provider_->RefetchInTheBackground(
+      base::MakeUnique<RemoteSuggestionsProvider::FetchStatusCallback>(
+          std::move(wrapper_callback)));
 }
 
 const NTPSnippetsFetcher* SchedulingRemoteSuggestionsProvider::
@@ -237,43 +297,39 @@
 }
 
 void SchedulingRemoteSuggestionsProvider::StartScheduling() {
-  // The scheduler only exists on Android so far, it's null on other platforms.
-  if (!persistent_scheduler_) {
+  FetchingSchedule new_schedule = GetDesiredFetchingSchedule();
+
+  if (schedule_ == new_schedule) {
+    // Do not schedule if nothing has changed;
     return;
   }
 
-  FetchingSchedule last_schedule = GetLastFetchingSchedule();
-  FetchingSchedule schedule = GetDesiredFetchingSchedule();
-
-  // Reset the schedule only if the parameters have changed.
-  if (last_schedule != schedule) {
-    ApplyFetchingSchedule(schedule);
-  }
+  schedule_ = new_schedule;
+  StoreFetchingSchedule();
+  ApplyPersistentFetchingSchedule();
 }
 
 void SchedulingRemoteSuggestionsProvider::StopScheduling() {
-  // The scheduler only exists on Android so far, it's null on other platforms.
-  if (!persistent_scheduler_) {
+  if (schedule_.is_empty()) {
+    // Do not unschedule if already switched off.
     return;
   }
 
-  // Do not unschedule if already switched off
-  FetchingSchedule last_schedule = GetLastFetchingSchedule();
-  if (last_schedule.is_empty()) {
-    return;
-  }
-
-  persistent_scheduler_->Unschedule();
-
-  StoreLastFetchingSchedule(FetchingSchedule::Empty());
+  schedule_ = FetchingSchedule::Empty();
+  StoreFetchingSchedule();
+  ApplyPersistentFetchingSchedule();
 }
 
-void SchedulingRemoteSuggestionsProvider::ApplyFetchingSchedule(
-    const FetchingSchedule& schedule) {
-  persistent_scheduler_->Schedule(schedule.interval_wifi,
-                                  schedule.interval_fallback);
-
-  StoreLastFetchingSchedule(schedule);
+void SchedulingRemoteSuggestionsProvider::ApplyPersistentFetchingSchedule() {
+  // The scheduler only exists on Android so far, it's null on other platforms.
+  if (persistent_scheduler_) {
+    if (schedule_.is_empty()) {
+      persistent_scheduler_->Unschedule();
+    } else {
+      persistent_scheduler_->Schedule(schedule_.interval_persistent_wifi,
+                                      schedule_.interval_persistent_fallback);
+    }
+  }
 }
 
 SchedulingRemoteSuggestionsProvider::FetchingSchedule
@@ -281,58 +337,82 @@
   UserClassifier::UserClass user_class = user_classifier_->GetUserClass();
 
   FetchingSchedule schedule;
-  schedule.interval_wifi =
-      GetDesiredUpdateInterval(/*is_wifi=*/true, user_class);
-  schedule.interval_fallback =
-      GetDesiredUpdateInterval(/*is_wifi=*/false, user_class);
+  schedule.interval_persistent_wifi =
+      GetDesiredFetchingInterval(FetchingInterval::PERSISTENT_WIFI, user_class);
+  schedule.interval_persistent_fallback = GetDesiredFetchingInterval(
+      FetchingInterval::PERSISTENT_FALLBACK, user_class);
+  schedule.interval_soft_on_usage_event = GetDesiredFetchingInterval(
+      FetchingInterval::SOFT_ON_USAGE_EVENT, user_class);
+
   return schedule;
 }
 
-SchedulingRemoteSuggestionsProvider::FetchingSchedule
-SchedulingRemoteSuggestionsProvider::GetLastFetchingSchedule() const {
-  FetchingSchedule schedule;
-  schedule.interval_wifi = base::TimeDelta::FromInternalValue(
-      pref_service_->GetInt64(prefs::kSnippetBackgroundFetchingIntervalWifi));
-  schedule.interval_fallback =
+void SchedulingRemoteSuggestionsProvider::LoadLastFetchingSchedule() {
+  schedule_.interval_persistent_wifi = base::TimeDelta::FromInternalValue(
+      pref_service_->GetInt64(prefs::kSnippetPersistentFetchingIntervalWifi));
+  schedule_.interval_persistent_fallback =
       base::TimeDelta::FromInternalValue(pref_service_->GetInt64(
-          prefs::kSnippetBackgroundFetchingIntervalFallback));
-  return schedule;
+          prefs::kSnippetPersistentFetchingIntervalFallback));
+  schedule_.interval_soft_on_usage_event = base::TimeDelta::FromInternalValue(
+      pref_service_->GetInt64(prefs::kSnippetSoftFetchingIntervalOnUsageEvent));
 }
 
-void SchedulingRemoteSuggestionsProvider::StoreLastFetchingSchedule(
-    const FetchingSchedule& schedule) {
+void SchedulingRemoteSuggestionsProvider::StoreFetchingSchedule() {
+  pref_service_->SetInt64(prefs::kSnippetPersistentFetchingIntervalWifi,
+                          schedule_.interval_persistent_wifi.ToInternalValue());
   pref_service_->SetInt64(
-      prefs::kSnippetBackgroundFetchingIntervalWifi,
-      schedule.interval_wifi.ToInternalValue());
+      prefs::kSnippetPersistentFetchingIntervalFallback,
+      schedule_.interval_persistent_fallback.ToInternalValue());
   pref_service_->SetInt64(
-      prefs::kSnippetBackgroundFetchingIntervalFallback,
-      schedule.interval_fallback.ToInternalValue());
+      prefs::kSnippetSoftFetchingIntervalOnUsageEvent,
+      schedule_.interval_soft_on_usage_event.ToInternalValue());
+}
+
+bool SchedulingRemoteSuggestionsProvider::BackgroundFetchesDisabled() const {
+  return schedule_.is_empty();
+}
+
+bool SchedulingRemoteSuggestionsProvider::ShouldRefetchInTheBackgroundNow() {
+  base::Time first_allowed_fetch_time =
+      base::Time::FromInternalValue(
+          pref_service_->GetInt64(prefs::kSnippetLastFetchAttempt)) +
+      schedule_.interval_soft_on_usage_event;
+  return first_allowed_fetch_time <= clock_->Now();
 }
 
 void SchedulingRemoteSuggestionsProvider::FetchFinished(
     const FetchDoneCallback& callback,
-    Status status_code,
+    Status fetch_status,
     std::vector<ContentSuggestion> suggestions) {
-  OnFetchCompleted(status_code);
-  callback.Run(status_code, std::move(suggestions));
+  OnFetchCompleted(fetch_status);
+  if (callback) {
+    callback.Run(fetch_status, std::move(suggestions));
+  }
+}
+
+void SchedulingRemoteSuggestionsProvider::RefetchInTheBackgroundFinished(
+    std::unique_ptr<FetchStatusCallback> callback,
+    Status fetch_status) {
+  background_fetch_in_progress_ = false;
+  OnFetchCompleted(fetch_status);
+  if (callback) {
+    callback->Run(fetch_status);
+  }
 }
 
 void SchedulingRemoteSuggestionsProvider::OnFetchCompleted(
     Status fetch_status) {
-  // The scheduler only exists on Android so far, it's null on other platforms.
-  if (!persistent_scheduler_) {
-    return;
-  }
+  pref_service_->SetInt64(prefs::kSnippetLastFetchAttempt,
+                          clock_->Now().ToInternalValue());
 
+  // Reschedule after a fetch. The persistent schedule is applied only after a
+  // successful fetch. After a failed fetch, we want to keep the previous
+  // persistent schedule intact so that we eventually get a persistent
+  // fallback fetch (if the wifi persistent fetches keep failing).
   if (fetch_status.code != StatusCode::SUCCESS) {
     return;
   }
-
-  // Reschedule after a successful fetch. This resets all currently scheduled
-  // fetches, to make sure the fallback interval triggers only if no wifi fetch
-  // succeeded, and also that we don't do a background fetch immediately after
-  // a user-initiated one.
-  ApplyFetchingSchedule(GetLastFetchingSchedule());
+  ApplyPersistentFetchingSchedule();
 }
 
 }  // namespace ntp_snippets
diff --git a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
index 71dd4f8..7870718 100644
--- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
+++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider.h
@@ -8,6 +8,7 @@
 #include <memory>
 #include <set>
 #include <string>
+#include <utility>
 #include <vector>
 
 #include "base/macros.h"
@@ -20,6 +21,10 @@
 class PrefRegistrySimple;
 class PrefService;
 
+namespace base {
+class Clock;
+}
+
 namespace ntp_snippets {
 
 struct Status;
@@ -55,7 +60,8 @@
       std::unique_ptr<RemoteSuggestionsProvider> provider,
       PersistentScheduler* persistent_scheduler,
       const UserClassifier* user_classifier,
-      PrefService* pref_service);
+      PrefService* pref_service,
+      std::unique_ptr<base::Clock> clock);
 
   ~SchedulingRemoteSuggestionsProvider() override;
 
@@ -98,7 +104,16 @@
 
  private:
   // Abstract description of the fetching schedule.
-  struct FetchingSchedule;
+  struct FetchingSchedule {
+      static FetchingSchedule Empty();
+      bool operator==(const FetchingSchedule& other) const;
+      bool operator!=(const FetchingSchedule& other) const;
+      bool is_empty() const;
+
+      base::TimeDelta interval_persistent_wifi;
+      base::TimeDelta interval_persistent_fallback;
+      base::TimeDelta interval_soft_on_usage_event;
+  };
 
   // Callback that is notified whenever the status of |provider_| changes.
   void OnProviderStatusChanged(
@@ -114,20 +129,32 @@
   // schedule.
   void StopScheduling();
 
+  // Checks whether it is time to perform a soft background fetch, according to
+  // |schedule|.
+  bool ShouldRefetchInTheBackgroundNow();
+
   // Callback after Fetch is completed.
   void FetchFinished(const FetchDoneCallback& callback,
-                     Status status_code,
+                     Status fetch_status,
                      std::vector<ContentSuggestion> suggestions);
 
+  // Callback after RefetchInTheBackground is completed.
+  void RefetchInTheBackgroundFinished(
+      std::unique_ptr<FetchStatusCallback> callback,
+      Status fetch_status);
+
+  // Common function to call after a fetch of any type is finished.
+  void OnFetchCompleted(Status fetch_status);
+
   FetchingSchedule GetDesiredFetchingSchedule() const;
-  FetchingSchedule GetLastFetchingSchedule() const;
-  void StoreLastFetchingSchedule(const FetchingSchedule& schedule);
 
-  // Common function to call after each fetch.
-  void OnFetchCompleted(Status status);
+  // Load and store |schedule_|.
+  void LoadLastFetchingSchedule();
+  void StoreFetchingSchedule();
+  bool BackgroundFetchesDisabled() const;
 
-  // Applies the provided |schedule|.
-  void ApplyFetchingSchedule(const FetchingSchedule& schedule);
+  // Applies the persistent schedule given by |schedule_|.
+  void ApplyPersistentFetchingSchedule();
 
   // Interface for doing all the actual work (apart from scheduling).
   std::unique_ptr<RemoteSuggestionsProvider> provider_;
@@ -136,10 +163,14 @@
   // null.
   PersistentScheduler* persistent_scheduler_;
 
+  FetchingSchedule schedule_;
+  bool background_fetch_in_progress_;
+
   // Used to adapt the schedule based on usage activity of the user. Not owned.
   const UserClassifier* user_classifier_;
 
   PrefService* pref_service_;
+  std::unique_ptr<base::Clock> clock_;
 
   DISALLOW_COPY_AND_ASSIGN(SchedulingRemoteSuggestionsProvider);
 };
diff --git a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc
index 0015c83..d5ee169 100644
--- a/components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc
+++ b/components/ntp_snippets/remote/scheduling_remote_suggestions_provider_unittest.cc
@@ -15,7 +15,9 @@
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
+#include "base/test/simple_test_clock.h"
 #include "base/threading/thread_task_runner_handle.h"
+#include "base/time/clock.h"
 #include "base/time/time.h"
 #include "components/ntp_snippets/features.h"
 #include "components/ntp_snippets/ntp_snippets_constants.h"
@@ -38,6 +40,7 @@
 using testing::Mock;
 using testing::MockFunction;
 using testing::Not;
+using testing::Return;
 using testing::SaveArg;
 using testing::SaveArgPointee;
 using testing::SizeIs;
@@ -133,10 +136,15 @@
     EXPECT_CALL(*underlying_provider_, SetProviderStatusCallback(_))
         .WillOnce(SaveArg<0>(&provider_status_callback_));
 
+    auto test_clock = base::MakeUnique<base::SimpleTestClock>();
+    test_clock_ = test_clock.get();
+    test_clock_->SetNow(base::Time::Now());
+
     scheduling_provider_ =
         base::MakeUnique<SchedulingRemoteSuggestionsProvider>(
             /*observer=*/nullptr, std::move(underlying_provider),
-            &persistent_scheduler_, &user_classifier_, utils_.pref_service());
+            &persistent_scheduler_, &user_classifier_, utils_.pref_service(),
+            std::move(test_clock));
   }
 
  protected:
@@ -144,6 +152,7 @@
   StrictMock<MockRemoteSuggestionsProvider>* underlying_provider_;
   std::unique_ptr<SchedulingRemoteSuggestionsProvider> scheduling_provider_;
   RemoteSuggestionsProvider::ProviderStatusCallback provider_status_callback_;
+  base::SimpleTestClock* test_clock_;
 
   void ChangeStatusOfUnderlyingProvider(
       RemoteSuggestionsProvider::ProviderStatus new_status) {
@@ -158,12 +167,171 @@
 };
 
 TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldIgnoreSignalsWhenNotEnabled) {
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
        ShouldFetchOnPersistentSchedulerWakeUp) {
+  // First enable the scheduler.
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
   EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_));
   scheduling_provider_->OnPersistentSchedulerWakeUp();
 }
 
 TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldFetchOnPersistentSchedulerWakeUpRepeated) {
+  RemoteSuggestionsProvider::FetchStatusCallback signal_fetch_done;
+  {
+    InSequence s;
+    EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+    EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_))
+        .WillOnce(SaveArg<0>(&signal_fetch_done));
+    EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+    EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_));
+  }
+  // First enable the scheduler -- calling Schedule() for the first time.
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+  // Make the first persistent fetch successful -- calling Schedule() again.
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+  signal_fetch_done.Run(Status::Success());
+  // Make the second fetch.
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldNotTriggerBackgroundFetchIfAlreadyInProgess) {
+  {
+    InSequence s;
+    EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+    EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_));
+    // RefetchInTheBackground is not called after the second trigger.
+  }
+  // First enable the scheduler -- calling Schedule() for the first time.
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+  // Make the first persistent fetch never finish.
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+  // Make the second fetch.
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldFetchOnNTPOpenedForTheFirstTime) {
+  // First enable the scheduler.
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
+  EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_));
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldNotFetchOnNTPOpenedAfterSuccessfulSoftFetch) {
+  // First enable the scheduler; the second Schedule is called after the
+  // successful fetch.
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _)).Times(2);
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
+  // Make the first soft fetch successful.
+  RemoteSuggestionsProvider::FetchStatusCallback signal_fetch_done;
+  EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_))
+      .WillOnce(SaveArg<0>(&signal_fetch_done));
+  scheduling_provider_->OnNTPOpened();
+  signal_fetch_done.Run(Status::Success());
+  // The second call is ignored if it happens right after the first one.
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldNotFetchOnNTPOpenedAfterSuccessfulPersistentFetch) {
+  // First enable the scheduler; the second Schedule is called after the
+  // successful fetch.
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _)).Times(2);
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
+  // Make the first persistent fetch successful.
+  RemoteSuggestionsProvider::FetchStatusCallback signal_fetch_done;
+  EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_))
+      .WillOnce(SaveArg<0>(&signal_fetch_done));
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+  signal_fetch_done.Run(Status::Success());
+  // The second call is ignored if it happens right after the first one.
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldNotFetchOnNTPOpenedAfterFailedSoftFetch) {
+  // First enable the scheduler.
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
+  // Make the first soft fetch failed.
+  RemoteSuggestionsProvider::FetchStatusCallback signal_fetch_done;
+  EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_))
+      .WillOnce(SaveArg<0>(&signal_fetch_done));
+  scheduling_provider_->OnNTPOpened();
+  signal_fetch_done.Run(Status(StatusCode::PERMANENT_ERROR, ""));
+
+  // The second call is ignored if it happens right after the first one.
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldNotFetchOnNTPOpenedAfterFailedPersistentFetch) {
+  // First enable the scheduler.
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
+  // Make the first persistent fetch failed.
+  RemoteSuggestionsProvider::FetchStatusCallback signal_fetch_done;
+  EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_))
+      .WillOnce(SaveArg<0>(&signal_fetch_done));
+  scheduling_provider_->OnPersistentSchedulerWakeUp();
+  signal_fetch_done.Run(Status(StatusCode::PERMANENT_ERROR, ""));
+
+  // The second call is ignored if it happens right after the first one.
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ShouldFetchAgainOnNTPOpenedLaterAgain) {
+  RemoteSuggestionsProvider::FetchStatusCallback signal_fetch_done;
+  {
+    InSequence s;
+    // Initial scheduling after being enabled.
+    EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+    // The first call to NTPOpened results in a fetch.
+    EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_))
+        .WillOnce(SaveArg<0>(&signal_fetch_done));
+    // Rescheduling after a succesful fetch.
+    EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
+    // The second call to NTPOpened 2hrs later again results in a fetch.
+    EXPECT_CALL(*underlying_provider_, RefetchInTheBackground(_));
+  }
+
+  // First enable the scheduler.
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+  // Make the first soft fetch successful.
+  scheduling_provider_->OnNTPOpened();
+  signal_fetch_done.Run(Status::Success());
+  // Open NTP again after 2hrs.
+  test_clock_->Advance(base::TimeDelta::FromHours(2));
+  scheduling_provider_->OnNTPOpened();
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
        ShouldRescheduleOnRescheduleFetching) {
   EXPECT_CALL(persistent_scheduler_, Schedule(_, _));
   scheduling_provider_->RescheduleFetching();
@@ -267,7 +435,7 @@
   // null. Change the wifi interval for this class.
   variations::testing::VariationParamsManager params_manager(
       ntp_snippets::kStudyName,
-      {{"fetching_interval_hours-wifi-active_ntp_user", "2"}},
+      {{"fetching_interval_hours-wifi-active_ntp_user", "1.5"}},
       {kArticleSuggestionsFeature.name});
 
   // Schedule() should get called for the second time after params have changed.
@@ -285,7 +453,25 @@
   // null. Change the wifi interval for this class.
   variations::testing::VariationParamsManager params_manager(
       ntp_snippets::kStudyName,
-      {{"fetching_interval_hours-fallback-active_ntp_user", "2"}},
+      {{"fetching_interval_hours-fallback-active_ntp_user", "1.5"}},
+      {kArticleSuggestionsFeature.name});
+
+  // Schedule() should get called for the second time after params have changed.
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+}
+
+TEST_F(SchedulingRemoteSuggestionsProviderTest,
+       ReschedulesWhenOnUsageEventParamChanges) {
+  EXPECT_CALL(persistent_scheduler_, Schedule(_, _)).Times(2);
+  ChangeStatusOfUnderlyingProvider(
+      RemoteSuggestionsProvider::ProviderStatus::ACTIVE);
+
+  // UserClassifier defaults to UserClass::ACTIVE_NTP_USER if PrefService is
+  // null. Change the wifi interval for this class.
+  variations::testing::VariationParamsManager params_manager(
+      ntp_snippets::kStudyName,
+      {{"soft_fetching_interval_hours-active-active_ntp_user", "1.5"}},
       {kArticleSuggestionsFeature.name});
 
   // Schedule() should get called for the second time after params have changed.
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc
index 376c4e45..4791873 100644
--- a/components/ntp_tiles/most_visited_sites.cc
+++ b/components/ntp_tiles/most_visited_sites.cc
@@ -62,7 +62,7 @@
       observer_(nullptr),
       num_sites_(0),
       top_sites_observer_(this),
-      mv_source_(NTPTileSource::SUGGESTIONS_SERVICE),
+      mv_source_(NTPTileSource::TOP_SITES),
       weak_ptr_factory_(this) {
   DCHECK(prefs_);
   // top_sites_ can be null in tests.
@@ -187,8 +187,12 @@
 
 void MostVisitedSites::OnMostVisitedURLsAvailable(
     const history::MostVisitedURLList& visited_list) {
-  // TODO(mastiz): Verify if suggestion service results have been fetched in
-  // the meantime, and if that's the case ignore this event.
+  // Ignore the event if tiles provided by the Suggestions Service, which take
+  // precedence.
+  if (mv_source_ == NTPTileSource::SUGGESTIONS_SERVICE) {
+    return;
+  }
+
   NTPTilesVector tiles;
   size_t num_tiles =
       std::min(visited_list.size(), static_cast<size_t>(num_sites_));
@@ -221,6 +225,7 @@
   // With no server suggestions, fall back to local TopSites.
   if (num_tiles == 0 ||
       !base::FeatureList::IsEnabled(kDisplaySuggestionsServiceTiles)) {
+    mv_source_ = NTPTileSource::TOP_SITES;
     InitiateTopSitesQuery();
     return;
   }
diff --git a/components/ntp_tiles/most_visited_sites_unittest.cc b/components/ntp_tiles/most_visited_sites_unittest.cc
index bc7f877..4273aee 100644
--- a/components/ntp_tiles/most_visited_sites_unittest.cc
+++ b/components/ntp_tiles/most_visited_sites_unittest.cc
@@ -351,9 +351,8 @@
   // Constructor sets basic expectations for a suggestions service cache miss.
 }
 
-// TODO(mastiz): This describes the current behavior but it actually is a bug.
 TEST_F(MostVisitedSitesWithEmptyCacheTest,
-       DoesNotIgnoreTopSitesIfSuggestionsServiceFaster) {
+       ShouldIgnoreTopSitesIfSuggestionsServiceFaster) {
   // Reply from suggestions service triggers and update to our observer.
   EXPECT_CALL(
       mock_observer_,
@@ -363,11 +362,7 @@
       MakeProfile({MakeSuggestion("Site 1", "http://site1/")}));
   VerifyAndClearExpectations();
 
-  // Reply from top sites is currently not ignored (i.e. is actually reported to
-  // observer).
-  EXPECT_CALL(mock_observer_,
-              OnMostVisitedURLsAvailable(ElementsAre(MatchesTile(
-                  "Site 2", "http://site2/", NTPTileSource::TOP_SITES))));
+  // Reply from top sites is ignored (i.e. not reported to observer).
   top_sites_callbacks_.ClearAndNotify(
       {MakeMostVisitedURL("Site 2", "http://site2/")});
   base::RunLoop().RunUntilIdle();
diff --git a/components/subresource_filter/core/browser/BUILD.gn b/components/subresource_filter/core/browser/BUILD.gn
index 39518b48..a137def 100644
--- a/components/subresource_filter/core/browser/BUILD.gn
+++ b/components/subresource_filter/core/browser/BUILD.gn
@@ -52,5 +52,6 @@
     "//components/subresource_filter/core/common:test_support",
     "//testing/gmock",
     "//testing/gtest",
+    "//third_party/protobuf:protobuf_lite",
   ]
 }
diff --git a/components/subresource_filter/core/common/BUILD.gn b/components/subresource_filter/core/common/BUILD.gn
index 905a444..5e260b7 100644
--- a/components/subresource_filter/core/common/BUILD.gn
+++ b/components/subresource_filter/core/common/BUILD.gn
@@ -53,6 +53,8 @@
   sources = [
     "test_ruleset_creator.cc",
     "test_ruleset_creator.h",
+    "test_ruleset_utils.cc",
+    "test_ruleset_utils.h",
   ]
   deps = [
     ":common",
diff --git a/components/subresource_filter/core/common/test_ruleset_creator.cc b/components/subresource_filter/core/common/test_ruleset_creator.cc
index 81dd7b3d..08cd627 100644
--- a/components/subresource_filter/core/common/test_ruleset_creator.cc
+++ b/components/subresource_filter/core/common/test_ruleset_creator.cc
@@ -9,6 +9,7 @@
 #include "base/strings/string_number_conversions.h"
 #include "components/subresource_filter/core/common/indexed_ruleset.h"
 #include "components/subresource_filter/core/common/proto/rules.pb.h"
+#include "components/subresource_filter/core/common/test_ruleset_utils.h"
 #include "components/subresource_filter/core/common/unindexed_ruleset.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "third_party/protobuf/src/google/protobuf/io/zero_copy_stream_impl_lite.h"
@@ -20,34 +21,29 @@
 // The methods below assume that char and uint8_t are interchangeable.
 static_assert(CHAR_BIT == 8, "Assumed char was 8 bits.");
 
-proto::UrlRule CreateSuffixRule(base::StringPiece suffix) {
-  proto::UrlRule rule;
-  rule.set_semantics(proto::RULE_SEMANTICS_BLACKLIST);
-  rule.set_source_type(proto::SOURCE_TYPE_ANY);
-  rule.set_element_types(proto::ELEMENT_TYPE_ALL);
-  rule.set_url_pattern_type(proto::URL_PATTERN_TYPE_SUBSTRING);
-  rule.set_anchor_left(proto::ANCHOR_TYPE_NONE);
-  rule.set_anchor_right(proto::ANCHOR_TYPE_BOUNDARY);
-  rule.set_url_pattern(suffix.as_string());
-  return rule;
-}
-
-std::vector<uint8_t> SerializeUnindexedRulesetWithSingleRule(
-    const proto::UrlRule& rule) {
+std::vector<uint8_t> SerializeUnindexedRulesetWithMultipleRules(
+    const std::vector<proto::UrlRule>& rules) {
   std::string ruleset_contents;
   google::protobuf::io::StringOutputStream output(&ruleset_contents);
   UnindexedRulesetWriter ruleset_writer(&output);
-  ruleset_writer.AddUrlRule(rule);
+  for (const auto& rule : rules)
+    ruleset_writer.AddUrlRule(rule);
   ruleset_writer.Finish();
 
   auto data = reinterpret_cast<const uint8_t*>(ruleset_contents.data());
   return std::vector<uint8_t>(data, data + ruleset_contents.size());
 }
 
-std::vector<uint8_t> SerializeIndexedRulesetWithSingleRule(
+std::vector<uint8_t> SerializeUnindexedRulesetWithSingleRule(
     const proto::UrlRule& rule) {
+  return SerializeUnindexedRulesetWithMultipleRules({rule});
+}
+
+std::vector<uint8_t> SerializeIndexedRulesetWithMultipleRules(
+    const std::vector<proto::UrlRule>& rules) {
   RulesetIndexer indexer;
-  EXPECT_TRUE(indexer.AddUrlRule(rule));
+  for (const auto& rule : rules)
+    EXPECT_TRUE(indexer.AddUrlRule(rule));
   indexer.Finish();
   return std::vector<uint8_t>(indexer.data(), indexer.data() + indexer.size());
 }
@@ -84,12 +80,7 @@
     TestRulesetPair* test_ruleset_pair) {
   DCHECK(test_ruleset_pair);
   proto::UrlRule suffix_rule = CreateSuffixRule(suffix);
-  ASSERT_NO_FATAL_FAILURE(CreateTestRulesetFromContents(
-      SerializeUnindexedRulesetWithSingleRule(suffix_rule),
-      &test_ruleset_pair->unindexed));
-  ASSERT_NO_FATAL_FAILURE(CreateTestRulesetFromContents(
-      SerializeIndexedRulesetWithSingleRule(suffix_rule),
-      &test_ruleset_pair->indexed));
+  CreateRulesetWithRules({suffix_rule}, test_ruleset_pair);
 }
 
 void TestRulesetCreator::CreateUnindexedRulesetToDisallowURLsWithPathSuffix(
@@ -102,6 +93,17 @@
       test_unindexed_ruleset));
 }
 
+void TestRulesetCreator::CreateRulesetWithRules(
+    const std::vector<proto::UrlRule>& rules,
+    TestRulesetPair* test_ruleset_pair) {
+  ASSERT_NO_FATAL_FAILURE(CreateTestRulesetFromContents(
+      SerializeUnindexedRulesetWithMultipleRules(rules),
+      &test_ruleset_pair->unindexed));
+  ASSERT_NO_FATAL_FAILURE(CreateTestRulesetFromContents(
+      SerializeIndexedRulesetWithMultipleRules(rules),
+      &test_ruleset_pair->indexed));
+}
+
 void TestRulesetCreator::GetUniqueTemporaryPath(base::FilePath* path) {
   DCHECK(path);
   ASSERT_TRUE(scoped_temp_dir_.IsValid() ||
diff --git a/components/subresource_filter/core/common/test_ruleset_creator.h b/components/subresource_filter/core/common/test_ruleset_creator.h
index 83c4cd3b..eef00b0 100644
--- a/components/subresource_filter/core/common/test_ruleset_creator.h
+++ b/components/subresource_filter/core/common/test_ruleset_creator.h
@@ -14,6 +14,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/macros.h"
 #include "base/strings/string_piece.h"
+#include "components/subresource_filter/core/common/proto/rules.pb.h"
 
 namespace subresource_filter {
 namespace testing {
@@ -60,6 +61,9 @@
       base::StringPiece suffix,
       TestRulesetPair* test_ruleset_pair);
 
+  void CreateRulesetWithRules(const std::vector<proto::UrlRule>& rules,
+                              TestRulesetPair* test_ruleset_pair);
+
   // Same as above, but only creates an unindexed ruleset.
   void CreateUnindexedRulesetToDisallowURLsWithPathSuffix(
       base::StringPiece suffix,
diff --git a/components/subresource_filter/core/common/test_ruleset_utils.cc b/components/subresource_filter/core/common/test_ruleset_utils.cc
new file mode 100644
index 0000000..081a4a1
--- /dev/null
+++ b/components/subresource_filter/core/common/test_ruleset_utils.cc
@@ -0,0 +1,36 @@
+// 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 "components/subresource_filter/core/common/test_ruleset_utils.h"
+
+namespace subresource_filter {
+namespace testing {
+
+proto::UrlRule CreateSuffixRule(base::StringPiece suffix) {
+  proto::UrlRule rule;
+  rule.set_semantics(proto::RULE_SEMANTICS_BLACKLIST);
+  rule.set_source_type(proto::SOURCE_TYPE_ANY);
+  rule.set_element_types(proto::ELEMENT_TYPE_ALL);
+  rule.set_url_pattern_type(proto::URL_PATTERN_TYPE_SUBSTRING);
+  rule.set_anchor_left(proto::ANCHOR_TYPE_NONE);
+  rule.set_anchor_right(proto::ANCHOR_TYPE_BOUNDARY);
+  rule.set_url_pattern(suffix.as_string());
+  return rule;
+}
+
+proto::UrlRule CreateWhitelistRuleForDocument(base::StringPiece pattern) {
+  proto::UrlRule rule;
+  rule.set_source_type(proto::SOURCE_TYPE_ANY);
+  rule.set_element_types(proto::ELEMENT_TYPE_ALL);
+  rule.set_url_pattern_type(proto::URL_PATTERN_TYPE_SUBSTRING);
+  rule.set_anchor_left(proto::ANCHOR_TYPE_NONE);
+  rule.set_anchor_right(proto::ANCHOR_TYPE_NONE);
+  rule.set_semantics(proto::RULE_SEMANTICS_WHITELIST);
+  rule.set_activation_types(proto::ACTIVATION_TYPE_DOCUMENT);
+  rule.set_url_pattern(pattern.as_string());
+  return rule;
+}
+
+}  // namespace testing
+}  // namespace subresource_filter
diff --git a/components/subresource_filter/core/common/test_ruleset_utils.h b/components/subresource_filter/core/common/test_ruleset_utils.h
new file mode 100644
index 0000000..97c2452
--- /dev/null
+++ b/components/subresource_filter/core/common/test_ruleset_utils.h
@@ -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.
+
+#ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_
+#define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_
+
+#include "base/strings/string_piece.h"
+#include "components/subresource_filter/core/common/proto/rules.pb.h"
+
+namespace subresource_filter {
+namespace testing {
+
+proto::UrlRule CreateSuffixRule(base::StringPiece suffix);
+
+proto::UrlRule CreateWhitelistRuleForDocument(base::StringPiece pattern);
+
+}  // namespace testing
+}  // namespace subresource_filter
+
+#endif  // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 564b13e2..e845a74 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -973,6 +973,8 @@
     "payments/payment_app_database.h",
     "payments/payment_app_manager.cc",
     "payments/payment_app_manager.h",
+    "payments/payment_app_provider_impl.cc",
+    "payments/payment_app_provider_impl.h",
     "permissions/permission_service_context.cc",
     "permissions/permission_service_context.h",
     "permissions/permission_service_impl.cc",
diff --git a/content/browser/host_zoom_map_observer.cc b/content/browser/host_zoom_map_observer.cc
index 88d42dfb..90f2695 100644
--- a/content/browser/host_zoom_map_observer.cc
+++ b/content/browser/host_zoom_map_observer.cc
@@ -23,23 +23,36 @@
   if (!navigation_handle->IsInMainFrame())
     return;
 
-  DCHECK(host_zoom_.is_bound());
-  if (!host_zoom_.is_bound())
-    return;
-
   RenderFrameHost* render_frame_host =
       navigation_handle->GetRenderFrameHost();
+  const auto& entry = host_zoom_ptrs_.find(render_frame_host);
+  if (entry == host_zoom_ptrs_.end())
+    return;
+
+  const mojom::HostZoomAssociatedPtr& host_zoom = entry->second;
+  DCHECK(host_zoom.is_bound());
+  if (host_zoom.encountered_error())
+    return;
+
   RenderProcessHost* render_process_host = render_frame_host->GetProcess();
   HostZoomMapImpl* host_zoom_map = static_cast<HostZoomMapImpl*>(
       render_process_host->GetStoragePartition()->GetHostZoomMap());
   double zoom_level = host_zoom_map->GetZoomLevelForView(
       navigation_handle->GetURL(), render_process_host->GetID(),
       render_frame_host->GetRenderViewHost()->GetRoutingID());
-  host_zoom_->SetHostZoomLevel(navigation_handle->GetURL(), zoom_level);
+  host_zoom->SetHostZoomLevel(navigation_handle->GetURL(), zoom_level);
 }
 
 void HostZoomMapObserver::RenderFrameCreated(RenderFrameHost* rfh) {
-  rfh->GetRemoteAssociatedInterfaces()->GetInterface(&host_zoom_);
+  mojom::HostZoomAssociatedPtr host_zoom;
+  rfh->GetRemoteAssociatedInterfaces()->GetInterface(&host_zoom);
+  host_zoom_ptrs_[rfh] = std::move(host_zoom);
+}
+
+void HostZoomMapObserver::RenderFrameDeleted(RenderFrameHost* rfh) {
+  const auto& entry = host_zoom_ptrs_.find(rfh);
+  DCHECK(entry != host_zoom_ptrs_.end());
+  host_zoom_ptrs_.erase(entry);
 }
 
 }  // namespace content
diff --git a/content/browser/host_zoom_map_observer.h b/content/browser/host_zoom_map_observer.h
index 4d0e730b..b61bad0 100644
--- a/content/browser/host_zoom_map_observer.h
+++ b/content/browser/host_zoom_map_observer.h
@@ -21,8 +21,9 @@
   // WebContentsObserver implementation:
   void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
   void RenderFrameCreated(RenderFrameHost* rfh) override;
+  void RenderFrameDeleted(RenderFrameHost* rfh) override;
 
-  mojom::HostZoomAssociatedPtr host_zoom_;
+  std::map<RenderFrameHost*, mojom::HostZoomAssociatedPtr> host_zoom_ptrs_;
 };
 
 }  // namespace content
diff --git a/content/browser/payments/payment_app_content_unittest_base.cc b/content/browser/payments/payment_app_content_unittest_base.cc
index 939ac9b..38ffa37 100644
--- a/content/browser/payments/payment_app_content_unittest_base.cc
+++ b/content/browser/payments/payment_app_content_unittest_base.cc
@@ -44,22 +44,18 @@
 PaymentAppContentUnitTestBase::PaymentAppContentUnitTestBase()
     : thread_bundle_(
           new TestBrowserThreadBundle(TestBrowserThreadBundle::IO_MAINLOOP)),
-      embedded_worker_helper_(new EmbeddedWorkerTestHelper(base::FilePath())),
-      storage_partition_impl_(
-          new StoragePartitionImpl(
-              embedded_worker_helper_->browser_context(), base::FilePath(),
-              nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
-              nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr)),
-      payment_app_context_(new PaymentAppContextImpl()) {
+      embedded_worker_helper_(new EmbeddedWorkerTestHelper(base::FilePath())) {
   embedded_worker_helper_->context_wrapper()->set_storage_partition(
-      storage_partition_impl_.get());
-  payment_app_context_->Init(embedded_worker_helper_->context_wrapper());
+      storage_partition());
+  payment_app_context()->Init(embedded_worker_helper_->context_wrapper());
   base::RunLoop().RunUntilIdle();
 }
 
-PaymentAppContentUnitTestBase::~PaymentAppContentUnitTestBase() {
-  payment_app_context_->Shutdown();
-  base::RunLoop().RunUntilIdle();
+PaymentAppContentUnitTestBase::~PaymentAppContentUnitTestBase() {}
+
+BrowserContext* PaymentAppContentUnitTestBase::browser_context() {
+  DCHECK(embedded_worker_helper_);
+  return embedded_worker_helper_->browser_context();
 }
 
 PaymentAppManager* PaymentAppContentUnitTestBase::CreatePaymentAppManager(
@@ -75,12 +71,12 @@
 
   // This function should eventually return created payment app manager
   // but there is no way to get last created payment app manager from
-  // payment_app_context_->payment_app_managers_ because its type is std::map
+  // payment_app_context()->payment_app_managers_ because its type is std::map
   // and can not ensure its order. So, just make a set of existing payment app
   // managers before creating a new manager and then check what is a new thing.
   std::set<PaymentAppManager*> existing_managers;
   for (const auto& existing_manager :
-       payment_app_context_->payment_app_managers_) {
+       payment_app_context()->payment_app_managers_) {
     existing_managers.insert(existing_manager.first);
   }
 
@@ -89,12 +85,12 @@
   mojo::InterfaceRequest<payments::mojom::PaymentAppManager> request =
       mojo::MakeRequest(&manager);
   payment_app_managers_.push_back(std::move(manager));
-  payment_app_context_->CreatePaymentAppManager(std::move(request));
+  payment_app_context()->CreatePaymentAppManager(std::move(request));
   base::RunLoop().RunUntilIdle();
 
   // Find a last registered payment app manager.
   for (const auto& candidate_manager :
-       payment_app_context_->payment_app_managers_) {
+       payment_app_context()->payment_app_managers_) {
     if (!base::ContainsKey(existing_managers, candidate_manager.first)) {
       candidate_manager.first->Init(scope_url.spec());
       base::RunLoop().RunUntilIdle();
@@ -152,4 +148,13 @@
   EXPECT_TRUE(called);
 }
 
+StoragePartitionImpl* PaymentAppContentUnitTestBase::storage_partition() {
+  return static_cast<StoragePartitionImpl*>(
+      BrowserContext::GetDefaultStoragePartition(browser_context()));
+}
+
+PaymentAppContextImpl* PaymentAppContentUnitTestBase::payment_app_context() {
+  return storage_partition()->GetPaymentAppContext();
+}
+
 }  // namespace content
diff --git a/content/browser/payments/payment_app_content_unittest_base.h b/content/browser/payments/payment_app_content_unittest_base.h
index 3e4413a2..b0d9ce9e 100644
--- a/content/browser/payments/payment_app_content_unittest_base.h
+++ b/content/browser/payments/payment_app_content_unittest_base.h
@@ -18,6 +18,7 @@
 
 namespace content {
 
+class BrowserContext;
 class EmbeddedWorkerTestHelper;
 class PaymentAppContextImpl;
 class StoragePartitionImpl;
@@ -28,9 +29,7 @@
   PaymentAppContentUnitTestBase();
   ~PaymentAppContentUnitTestBase() override;
 
-  PaymentAppContextImpl* payment_app_context() const {
-    return payment_app_context_.get();
-  }
+  BrowserContext* browser_context();
   PaymentAppManager* CreatePaymentAppManager(const GURL& scope_url,
                                              const GURL& sw_script_url);
   void SetManifest(PaymentAppManager* manager,
@@ -43,10 +42,11 @@
   void UnregisterServiceWorker(const GURL& scope_url);
 
  private:
+  StoragePartitionImpl* storage_partition();
+  PaymentAppContextImpl* payment_app_context();
+
   std::unique_ptr<TestBrowserThreadBundle> thread_bundle_;
   std::unique_ptr<EmbeddedWorkerTestHelper> embedded_worker_helper_;
-  std::unique_ptr<StoragePartitionImpl> storage_partition_impl_;
-  scoped_refptr<PaymentAppContextImpl> payment_app_context_;
   std::vector<payments::mojom::PaymentAppManagerPtr> payment_app_managers_;
 
   DISALLOW_COPY_AND_ASSIGN(PaymentAppContentUnitTestBase);
diff --git a/content/browser/payments/payment_app_context_impl.cc b/content/browser/payments/payment_app_context_impl.cc
index eb5a955..20192b1c 100644
--- a/content/browser/payments/payment_app_context_impl.cc
+++ b/content/browser/payments/payment_app_context_impl.cc
@@ -61,14 +61,6 @@
   return payment_app_database_.get();
 }
 
-void PaymentAppContextImpl::GetAllManifests(
-    const GetAllManifestsCallback& callback) {
-  DCHECK_CURRENTLY_ON(BrowserThread::UI);
-  BrowserThread::PostTask(
-      BrowserThread::IO, FROM_HERE,
-      base::Bind(&PaymentAppContextImpl::GetAllManifestsOnIO, this, callback));
-}
-
 PaymentAppContextImpl::~PaymentAppContextImpl() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   DCHECK(is_shutdown_);
@@ -103,21 +95,4 @@
   is_shutdown_ = true;
 }
 
-void PaymentAppContextImpl::GetAllManifestsOnIO(
-    const GetAllManifestsCallback& callback) {
-  DCHECK_CURRENTLY_ON(BrowserThread::IO);
-  payment_app_database()->ReadAllManifests(base::Bind(
-      &PaymentAppContextImpl::DidGetAllManifestsOnIO, this, callback));
-}
-
-void PaymentAppContextImpl::DidGetAllManifestsOnIO(
-    const GetAllManifestsCallback& callback,
-    Manifests manifests) {
-  DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
-  BrowserThread::PostTask(
-      BrowserThread::UI, FROM_HERE,
-      base::Bind(callback, base::Passed(std::move(manifests))));
-}
-
 }  // namespace content
diff --git a/content/browser/payments/payment_app_context_impl.h b/content/browser/payments/payment_app_context_impl.h
index 8785bbc..4b9ba42 100644
--- a/content/browser/payments/payment_app_context_impl.h
+++ b/content/browser/payments/payment_app_context_impl.h
@@ -13,7 +13,6 @@
 #include "components/payments/payment_app.mojom.h"
 #include "content/browser/payments/payment_app_database.h"
 #include "content/common/content_export.h"
-#include "content/public/browser/payment_app_context.h"
 
 namespace content {
 
@@ -42,8 +41,7 @@
 //   4) Shutdown()
 //   5) Destructor
 class CONTENT_EXPORT PaymentAppContextImpl
-    : public base::RefCountedThreadSafe<PaymentAppContextImpl>,
-      NON_EXPORTED_BASE(public PaymentAppContext) {
+    : public base::RefCountedThreadSafe<PaymentAppContextImpl> {
  public:
   PaymentAppContextImpl();
 
@@ -66,14 +64,10 @@
   // Should be accessed only on the IO thread.
   PaymentAppDatabase* payment_app_database() const;
 
-  // PaymentAppContext implementation:
-  // Should be accessed only on the UI thread.
-  void GetAllManifests(const GetAllManifestsCallback& callback) override;
-
  private:
   friend class PaymentAppContentUnitTestBase;
   friend class base::RefCountedThreadSafe<PaymentAppContextImpl>;
-  ~PaymentAppContextImpl() override;
+  ~PaymentAppContextImpl();
 
   void CreatePaymentAppDatabaseOnIO(
       scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
@@ -84,10 +78,6 @@
   void ShutdownOnIO();
   void DidShutdown();
 
-  void GetAllManifestsOnIO(const GetAllManifestsCallback& callback);
-  void DidGetAllManifestsOnIO(const GetAllManifestsCallback& callback,
-                              PaymentAppDatabase::Manifests manifests);
-
   // Only accessed on the IO thread.
   std::unique_ptr<PaymentAppDatabase> payment_app_database_;
 
diff --git a/content/browser/payments/payment_app_provider_impl.cc b/content/browser/payments/payment_app_provider_impl.cc
new file mode 100644
index 0000000..0d88e87
--- /dev/null
+++ b/content/browser/payments/payment_app_provider_impl.cc
@@ -0,0 +1,64 @@
+// 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/browser/payments/payment_app_provider_impl.h"
+
+#include "content/browser/payments/payment_app_context_impl.h"
+#include "content/browser/storage_partition_impl.h"
+#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+namespace {
+
+void DidGetAllManifestsOnIO(
+    const PaymentAppProvider::GetAllManifestsCallback& callback,
+    PaymentAppProvider::Manifests manifests) {
+  BrowserThread::PostTask(
+      BrowserThread::UI, FROM_HERE,
+      base::Bind(callback, base::Passed(std::move(manifests))));
+}
+
+void GetAllManifestsOnIO(
+    const scoped_refptr<PaymentAppContextImpl>& payment_app_context,
+    const PaymentAppProvider::GetAllManifestsCallback& callback) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+  payment_app_context->payment_app_database()->ReadAllManifests(
+      base::Bind(&DidGetAllManifestsOnIO, callback));
+}
+
+}  // namespace
+
+// static
+PaymentAppProvider* PaymentAppProvider::GetInstance() {
+  return PaymentAppProviderImpl::GetInstance();
+}
+
+// static
+PaymentAppProviderImpl* PaymentAppProviderImpl::GetInstance() {
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  return base::Singleton<PaymentAppProviderImpl>::get();
+}
+
+void PaymentAppProviderImpl::GetAllManifests(
+    BrowserContext* browser_context,
+    const GetAllManifestsCallback& callback) {
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+  StoragePartitionImpl* partition = static_cast<StoragePartitionImpl*>(
+      BrowserContext::GetDefaultStoragePartition(browser_context));
+  scoped_refptr<PaymentAppContextImpl> payment_app_context =
+      partition->GetPaymentAppContext();
+
+  BrowserThread::PostTask(
+      BrowserThread::IO, FROM_HERE,
+      base::Bind(&GetAllManifestsOnIO, payment_app_context, callback));
+}
+
+PaymentAppProviderImpl::PaymentAppProviderImpl() {}
+
+PaymentAppProviderImpl::~PaymentAppProviderImpl() {}
+
+}  // namespace content
diff --git a/content/browser/payments/payment_app_provider_impl.h b/content/browser/payments/payment_app_provider_impl.h
new file mode 100644
index 0000000..127e181e
--- /dev/null
+++ b/content/browser/payments/payment_app_provider_impl.h
@@ -0,0 +1,40 @@
+// 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_BROWSER_PAYMENTS_PAYMENT_APP_PROVIDER_IMPL_H_
+#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_PROVIDER_IMPL_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "base/memory/singleton.h"
+#include "components/payments/payment_app.mojom.h"
+#include "content/common/content_export.h"
+#include "content/public/browser/payment_app_provider.h"
+
+namespace content {
+
+class BrowserContext;
+
+class CONTENT_EXPORT PaymentAppProviderImpl : public PaymentAppProvider {
+ public:
+  static PaymentAppProviderImpl* GetInstance();
+
+  // PaymentAppProvider implementation:
+  // Should be accessed only on the UI thread.
+  void GetAllManifests(BrowserContext* browser_context,
+                       const GetAllManifestsCallback& callback) override;
+
+ private:
+  PaymentAppProviderImpl();
+  ~PaymentAppProviderImpl() override;
+
+  friend struct base::DefaultSingletonTraits<PaymentAppProviderImpl>;
+
+  DISALLOW_COPY_AND_ASSIGN(PaymentAppProviderImpl);
+};
+
+}  // namespace content
+
+#endif  // CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_PROVIDER_IMPL_H_
diff --git a/content/browser/payments/payment_app_context_impl_unittest.cc b/content/browser/payments/payment_app_provider_impl_unittest.cc
similarity index 79%
rename from content/browser/payments/payment_app_context_impl_unittest.cc
rename to content/browser/payments/payment_app_provider_impl_unittest.cc
index 0a76508..8fde6670 100644
--- a/content/browser/payments/payment_app_context_impl_unittest.cc
+++ b/content/browser/payments/payment_app_provider_impl_unittest.cc
@@ -10,8 +10,7 @@
 #include "base/run_loop.h"
 #include "components/payments/payment_app.mojom.h"
 #include "content/browser/payments/payment_app_content_unittest_base.h"
-#include "content/browser/payments/payment_app_context_impl.h"
-#include "content/public/browser/payment_app_context.h"
+#include "content/browser/payments/payment_app_provider_impl.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "url/gurl.h"
 
@@ -32,21 +31,22 @@
 }
 
 void GetAllManifestsCallback(bool* called,
-                             PaymentAppContext::Manifests* out_manifests,
-                             PaymentAppContext::Manifests manifests) {
+                             PaymentAppProvider::Manifests* out_manifests,
+                             PaymentAppProvider::Manifests manifests) {
   *called = true;
   *out_manifests = std::move(manifests);
 }
 
 }  // namespace
 
-class PaymentAppContextTest : public PaymentAppContentUnitTestBase {
+class PaymentAppProviderTest : public PaymentAppContentUnitTestBase {
  public:
-  PaymentAppContextTest() {}
-  ~PaymentAppContextTest() override {}
+  PaymentAppProviderTest() {}
+  ~PaymentAppProviderTest() override {}
 
-  void GetAllManifests(PaymentAppContext::GetAllManifestsCallback callback) {
-    payment_app_context()->GetAllManifests(callback);
+  void GetAllManifests(PaymentAppProvider::GetAllManifestsCallback callback) {
+    PaymentAppProviderImpl::GetInstance()->GetAllManifests(browser_context(),
+                                                           callback);
     base::RunLoop().RunUntilIdle();
   }
 
@@ -65,10 +65,10 @@
   }
 
  private:
-  DISALLOW_COPY_AND_ASSIGN(PaymentAppContextTest);
+  DISALLOW_COPY_AND_ASSIGN(PaymentAppProviderTest);
 };
 
-TEST_F(PaymentAppContextTest, Test) {
+TEST_F(PaymentAppProviderTest, Test) {
   static const struct {
     const char* scopeUrl;
     const char* scriptUrl;
@@ -82,7 +82,7 @@
                      GURL(kPaymentAppInfo[i].scriptUrl));
   }
 
-  PaymentAppContext::Manifests manifests;
+  PaymentAppProvider::Manifests manifests;
   bool called = false;
   GetAllManifests(base::Bind(&GetAllManifestsCallback, &called, &manifests));
   ASSERT_TRUE(called);
diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc
index b128e2a..3333a8a 100644
--- a/content/browser/service_worker/service_worker_browsertest.cc
+++ b/content/browser/service_worker/service_worker_browsertest.cc
@@ -1764,7 +1764,7 @@
   NavigateToURL(shell(), embedded_test_server()->GetURL(kPageUrl1));
   EXPECT_EQ(title1, title_watcher1.WaitAndGetTitle());
   // When the navigation started, the navigation preload was not enabled yet.
-  EXPECT_EQ("null", GetTextContent());
+  EXPECT_EQ("undefined", GetTextContent());
   ASSERT_EQ(0, GetRequestCount(kPageUrl1));
 
   const std::string kPageUrl2 = kPageUrl + "?change";
@@ -1799,7 +1799,7 @@
   NavigateToURL(shell(), embedded_test_server()->GetURL(kPageUrl4));
   EXPECT_EQ(title4, title_watcher4.WaitAndGetTitle());
   // When the navigation started, the navigation preload must be disabled.
-  EXPECT_EQ("null", GetTextContent());
+  EXPECT_EQ("undefined", GetTextContent());
   ASSERT_EQ(0, GetRequestCount(kPageUrl4));
 }
 
@@ -2051,7 +2051,7 @@
   // The page request must not be sent, since the worker responded with a
   // generated Response and the navigation preload isn't enabled.
   EXPECT_EQ(0, GetRequestCount(kPageUrl));
-  EXPECT_EQ("Resolved with null.", GetTextContent());
+  EXPECT_EQ("Resolved with undefined.", GetTextContent());
 }
 
 IN_PROC_BROWSER_TEST_P(ServiceWorkerNavigationPreloadTest,
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h
index 8e9e914..50100a9 100644
--- a/content/browser/storage_partition_impl.h
+++ b/content/browser/storage_partition_impl.h
@@ -73,9 +73,9 @@
   HostZoomLevelContext* GetHostZoomLevelContext() override;
   ZoomLevelDelegate* GetZoomLevelDelegate() override;
   PlatformNotificationContextImpl* GetPlatformNotificationContext() override;
-  PaymentAppContextImpl* GetPaymentAppContext() override;
 
   BackgroundSyncContext* GetBackgroundSyncContext();
+  PaymentAppContextImpl* GetPaymentAppContext();
   BroadcastChannelProvider* GetBroadcastChannelProvider();
 
   // mojom::StoragePartitionService interface.
diff --git a/content/browser/zoom_browsertest.cc b/content/browser/zoom_browsertest.cc
index 1b1d546..38b2753 100644
--- a/content/browser/zoom_browsertest.cc
+++ b/content/browser/zoom_browsertest.cc
@@ -371,7 +371,7 @@
 
   // We exclude the remainder of this test on Android since Android does not
   // set page zoom levels for loading pages.
-  // See RenderViewImpl::OnSetZoomLevelForLoadingURL().
+  // See RenderFrameImpl::SetHostZoomLevel().
 #if !defined(OS_ANDROID)
   // When we navigate so that b.com is the top-level site, then it has the
   // expected zoom.
@@ -591,4 +591,71 @@
 }
 #endif
 
+// Tests that on cross-site navigation from a page that has a subframe, the
+// appropriate zoom is applied to the new page.
+// crbug.com/673065
+// Note: We exclude the this test on Android since Android does not set page
+// zoom levels for loading pages.
+// See RenderFrameImpl::SetHostZoomLevel().
+#if !defined(OS_ANDROID)
+IN_PROC_BROWSER_TEST_F(IFrameZoomBrowserTest,
+                       SubframesDontBreakConnectionToRenderer) {
+  std::string top_level_host("a.com");
+  GURL main_url(embedded_test_server()->GetURL(
+      top_level_host, "/page_with_iframe_and_link.html"));
+  EXPECT_TRUE(NavigateToURL(shell(), main_url));
+  NavigationEntry* entry =
+      web_contents()->GetController().GetLastCommittedEntry();
+  ASSERT_TRUE(entry);
+  GURL loaded_url = HostZoomMap::GetURLFromEntry(entry);
+  EXPECT_EQ(top_level_host, loaded_url.host());
+
+  // The following calls must be made when the page's scale factor = 1.0.
+  double main_frame_window_border = GetMainframeWindowBorder(web_contents());
+
+  HostZoomMap* host_zoom_map = HostZoomMap::GetForWebContents(web_contents());
+  double default_zoom_level = host_zoom_map->GetDefaultZoomLevel();
+  EXPECT_EQ(0.0, default_zoom_level);
+  EXPECT_DOUBLE_EQ(
+      1.0, GetMainFrameZoomFactor(web_contents(), main_frame_window_border));
+
+  // Set a zoom for a host that will be navigated to below.
+  const double new_zoom_factor = 2.0;
+  const double new_zoom_level =
+      default_zoom_level + ZoomFactorToZoomLevel(new_zoom_factor);
+  host_zoom_map->SetZoomLevelForHost("foo.com", new_zoom_level);
+
+  // Navigate forward in the same RFH to a site with that host via a
+  // renderer-initiated navigation.
+  {
+    const char kReplacePortNumber[] =
+        "window.domAutomationController.send(setPortNumber(%d));";
+    uint16_t port_number = embedded_test_server()->port();
+    bool success = false;
+    EXPECT_TRUE(ExecuteScriptAndExtractBool(
+        shell(), base::StringPrintf(kReplacePortNumber, port_number),
+        &success));
+    TestNavigationObserver observer(shell()->web_contents());
+    GURL url = embedded_test_server()->GetURL("foo.com", "/title2.html");
+    success = false;
+    EXPECT_TRUE(ExecuteScriptAndExtractBool(
+        shell(), "window.domAutomationController.send(clickCrossSiteLink());",
+        &success));
+    EXPECT_TRUE(success);
+    EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
+    EXPECT_EQ(url, observer.last_navigation_url());
+    EXPECT_TRUE(observer.last_navigation_succeeded());
+  }
+
+  // Check that the requested zoom has been applied to the new site.
+  // NOTE: Local observation on Linux has shown that this comparison has to be
+  // approximate. As the common failure mode would be that the zoom is ~1
+  // instead of ~2, this approximation shouldn't be problematic.
+  EXPECT_NEAR(
+      new_zoom_factor,
+      GetMainFrameZoomFactor(web_contents(), main_frame_window_border),
+      .1);
+}
+#endif
+
 }  // namespace content
diff --git a/content/public/browser/BUILD.gn b/content/public/browser/BUILD.gn
index e90440a..8dd0ebca8 100644
--- a/content/public/browser/BUILD.gn
+++ b/content/public/browser/BUILD.gn
@@ -172,6 +172,7 @@
     "overscroll_configuration.h",
     "page_navigator.cc",
     "page_navigator.h",
+    "payment_app_provider.h",
     "pepper_flash_settings_helper.h",
     "pepper_vpn_provider_resource_host_proxy.h",
     "permission_manager.h",
diff --git a/content/public/browser/payment_app_context.h b/content/public/browser/payment_app_context.h
deleted file mode 100644
index 34401318..0000000
--- a/content/public/browser/payment_app_context.h
+++ /dev/null
@@ -1,31 +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.
-
-#ifndef CONTENT_PUBLIC_BROWSER_PAYMENT_APP_CONTEXT_H_
-#define CONTENT_PUBLIC_BROWSER_PAYMENT_APP_CONTEXT_H_
-
-#include <utility>
-#include <vector>
-
-#include "base/callback_forward.h"
-
-namespace content {
-
-class PaymentAppContext {
- public:
-  virtual ~PaymentAppContext() {}
-
-  // The ManifestWithID is a pair of the service worker registration id and
-  // the payment app manifest data associated with it.
-  using ManifestWithID =
-      std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>;
-  using Manifests = std::vector<ManifestWithID>;
-  using GetAllManifestsCallback = base::Callback<void(Manifests)>;
-
-  virtual void GetAllManifests(const GetAllManifestsCallback& callback) = 0;
-};
-
-}  // namespace content
-
-#endif  // CONTENT_PUBLIC_BROWSER_PAYMENT_APP_CONTEXT_H_
diff --git a/content/public/browser/payment_app_provider.h b/content/public/browser/payment_app_provider.h
new file mode 100644
index 0000000..022e8c6
--- /dev/null
+++ b/content/public/browser/payment_app_provider.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_
+#define CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_
+
+#include <utility>
+#include <vector>
+
+#include "base/callback_forward.h"
+#include "content/common/content_export.h"
+
+namespace content {
+
+class BrowserContext;
+
+// This is providing the service worker based payment app related APIs to
+// Chrome layer. This class is a singleton, the instance of which can be
+// retrieved using the static GetInstance() method.
+// All methods must be called on the UI thread.
+class CONTENT_EXPORT PaymentAppProvider {
+ public:
+  // This static function is actually implemented in PaymentAppProviderImpl.cc.
+  // Please see: content/browser/payments/payment_app_provider_impl.cc
+  static PaymentAppProvider* GetInstance();
+
+  // The ManifestWithID is a pair of the service worker registration id and
+  // the payment app manifest data associated with it.
+  using ManifestWithID =
+      std::pair<int64_t, payments::mojom::PaymentAppManifestPtr>;
+  using Manifests = std::vector<ManifestWithID>;
+  using GetAllManifestsCallback = base::Callback<void(Manifests)>;
+
+  // Should be accessed only on the UI thread.
+  virtual void GetAllManifests(BrowserContext* browser_context,
+                               const GetAllManifestsCallback& callback) = 0;
+
+ protected:
+  virtual ~PaymentAppProvider() {}
+};
+
+}  // namespace content
+
+#endif  // CONTENT_PUBLIC_BROWSER_PAYMENT_APP_PROVIDER_H_
diff --git a/content/public/browser/storage_partition.h b/content/public/browser/storage_partition.h
index 9cb62329..909b370 100644
--- a/content/public/browser/storage_partition.h
+++ b/content/public/browser/storage_partition.h
@@ -47,7 +47,6 @@
 class HostZoomLevelContext;
 class HostZoomMap;
 class IndexedDBContext;
-class PaymentAppContext;
 class PlatformNotificationContext;
 class ServiceWorkerContext;
 class ZoomLevelDelegate;
@@ -75,7 +74,6 @@
   virtual HostZoomLevelContext* GetHostZoomLevelContext() = 0;
   virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0;
   virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0;
-  virtual PaymentAppContext* GetPaymentAppContext() = 0;
 
   enum : uint32_t {
     REMOVE_DATA_MASK_APPCACHE = 1 << 0,
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn
index a24f66fe..8b795cf 100644
--- a/content/test/BUILD.gn
+++ b/content/test/BUILD.gn
@@ -1150,8 +1150,8 @@
     "../browser/notifications/type_converters_unittest.cc",
     "../browser/payments/payment_app_content_unittest_base.cc",
     "../browser/payments/payment_app_content_unittest_base.h",
-    "../browser/payments/payment_app_context_impl_unittest.cc",
     "../browser/payments/payment_app_manager_unittest.cc",
+    "../browser/payments/payment_app_provider_impl_unittest.cc",
     "../browser/presentation/presentation_service_impl_unittest.cc",
     "../browser/presentation/presentation_type_converters_unittest.cc",
     "../browser/quota/mock_quota_manager.cc",
diff --git a/content/test/data/page_with_iframe_and_link.html b/content/test/data/page_with_iframe_and_link.html
new file mode 100644
index 0000000..3a4746a0
--- /dev/null
+++ b/content/test/data/page_with_iframe_and_link.html
@@ -0,0 +1,31 @@
+<html>
+
+ <head><title>Page with iframe and link</title>
+ <script>
+  function simulateClick(target) {
+    var evt = document.createEvent("MouseEvents");
+    evt.initMouseEvent("click", true, true, window,
+                       0, 0, 0, 0, 0, false, false,
+                       false, false, 0, null);
+
+    return target.dispatchEvent(evt);
+  }
+
+  function setPortNumber(portNumber) {
+    var link = document.getElementById("cross_site_link");
+    link.setAttribute("href", "http://foo.com:" + portNumber + "/title2.html");
+    return true;
+  }
+
+  function clickCrossSiteLink() {
+    return simulateClick(document.getElementById("cross_site_link"));
+  }
+ </script>
+ </head>
+
+<a href="http://foo.com/title2.html" id="cross_site_link">cross-site</a><br>
+
+<p>This page has an iframe. Yay for iframes!
+<p><iframe src="about:blank"></iframe>
+
+</html>
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 66c9ccb4..338e71d 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
@@ -181,8 +181,8 @@
     auto scheduling_provider =
         base::MakeUnique<SchedulingRemoteSuggestionsProvider>(
             service.get(), std::move(provider),
-            /*persistent_scheduler=*/nullptr, service->user_classifier(),
-            prefs);
+            /*persistent_scheduler=*/nullptr, service->user_classifier(), prefs,
+            base::MakeUnique<base::DefaultClock>());
     service->set_remote_suggestions_provider(scheduling_provider.get());
     service->set_remote_suggestions_scheduler(scheduling_provider.get());
     service->RegisterProvider(std::move(scheduling_provider));
diff --git a/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller.mm b/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller.mm
index 178ee0c3..94b5d53a 100644
--- a/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller.mm
@@ -4,10 +4,10 @@
 
 #import "ios/chrome/browser/ui/settings/about_chrome_collection_view_controller.h"
 
-#include "base/ios/block_types.h"
+#import "base/ios/block_types.h"
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
 #include "components/version_info/version_info.h"
diff --git a/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller_unittest.mm
index 403624a..9059fe2 100644
--- a/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/about_chrome_collection_view_controller_unittest.mm
@@ -6,7 +6,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/logging.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "ios/chrome/browser/chrome_url_constants.h"
 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
diff --git a/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm b/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm
index a3e52cb..35ebc135 100644
--- a/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/accounts_collection_view_controller.mm
@@ -6,7 +6,7 @@
 
 #import "base/ios/weak_nsobject.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/metrics/user_metrics.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
@@ -14,17 +14,17 @@
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/profile_oauth2_token_service.h"
 #include "components/signin/core/browser/signin_manager.h"
-#include "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
+#import "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
 #include "components/strings/grit/components_strings.h"
-#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
 #import "ios/chrome/browser/signin/authentication_service.h"
-#import "ios/chrome/browser/signin/authentication_service_factory.h"
-#include "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
+#include "ios/chrome/browser/signin/authentication_service_factory.h"
+#import "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
 #include "ios/chrome/browser/signin/signin_manager_factory.h"
 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
-#include "ios/chrome/browser/sync/sync_observer_bridge.h"
+#import "ios/chrome/browser/sync/sync_observer_bridge.h"
 #include "ios/chrome/browser/sync/sync_setup_service.h"
 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
 #import "ios/chrome/browser/ui/alert_coordinator/alert_coordinator.h"
@@ -46,8 +46,8 @@
 #import "ios/chrome/browser/ui/sync/sync_util.h"
 #include "ios/chrome/grit/ios_chromium_strings.h"
 #include "ios/chrome/grit/ios_strings.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
-#include "ios/public/provider/chrome/browser/images/branded_image_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/images/branded_image_provider.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity_browser_opener.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h"
diff --git a/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm b/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
index a3839aef..20a40cab 100644
--- a/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/autofill_collection_view_controller.mm
@@ -4,14 +4,14 @@
 
 #import "ios/chrome/browser/ui/settings/autofill_collection_view_controller.h"
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/objc_property_releaser.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/objc_property_releaser.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/autofill/core/browser/personal_data_manager.h"
 #include "components/autofill/core/common/autofill_pref_names.h"
-#include "components/autofill/ios/browser/credit_card_util.h"
+#import "components/autofill/ios/browser/credit_card_util.h"
 #import "components/autofill/ios/browser/personal_data_manager_observer_bridge.h"
 #include "components/prefs/pref_service.h"
 #include "ios/chrome/browser/application_context.h"
diff --git a/ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.mm b/ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.mm
index b47af71..a7ed56c 100644
--- a/ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/autofill_credit_card_edit_collection_view_controller.mm
@@ -8,14 +8,14 @@
 #import "base/ios/block_types.h"
 #import "base/ios/weak_nsobject.h"
 #import "base/mac/foundation_util.h"
-#import "base/mac/scoped_block.h"
+#include "base/mac/scoped_block.h"
 #import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/autofill/core/browser/credit_card.h"
 #include "components/autofill/core/browser/field_types.h"
 #include "components/autofill/core/browser/payments/payments_service_url.h"
 #include "components/autofill/core/browser/personal_data_manager.h"
-#include "components/autofill/ios/browser/credit_card_util.h"
+#import "components/autofill/ios/browser/credit_card_util.h"
 #include "components/strings/grit/components_strings.h"
 #include "ios/chrome/browser/application_context.h"
 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
diff --git a/ios/chrome/browser/ui/settings/autofill_edit_accessory_view.mm b/ios/chrome/browser/ui/settings/autofill_edit_accessory_view.mm
index b766fc6..177d0ab97 100644
--- a/ios/chrome/browser/ui/settings/autofill_edit_accessory_view.mm
+++ b/ios/chrome/browser/ui/settings/autofill_edit_accessory_view.mm
@@ -6,7 +6,7 @@
 
 #include <string>
 
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #import "ios/chrome/browser/ui/image_util.h"
 #include "ios/chrome/browser/ui/ui_util.h"
 
diff --git a/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.mm b/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.mm
index e85b32d7..6af6bb1 100644
--- a/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.mm
@@ -4,9 +4,9 @@
 
 #import "ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller.h"
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/autofill/core/browser/autofill_profile.h"
 #include "components/autofill/core/browser/field_types.h"
diff --git a/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller_unittest.mm
index fedc642..d3cabc0 100644
--- a/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller_unittest.mm
@@ -7,7 +7,7 @@
 #include <memory>
 
 #include "base/guid.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
diff --git a/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm b/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm
index 41f8d9e4..bcf864a 100644
--- a/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm
+++ b/ios/chrome/browser/ui/settings/autofill_settings_egtest.mm
@@ -4,16 +4,16 @@
 
 #import <XCTest/XCTest.h>
 
-#include "base/mac/bind_objc_block.h"
+#import "base/mac/bind_objc_block.h"
 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
 #include "ios/chrome/grit/ios_strings.h"
-#import "ios/chrome/test/app/web_view_interaction_test_util.h"
+#include "ios/chrome/test/app/web_view_interaction_test_util.h"
 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
 #import "ios/web/public/test/http_server.h"
-#import "ios/web/public/test/http_server_util.h"
+#include "ios/web/public/test/http_server_util.h"
 #include "ui/base/l10n/l10n_util.h"
 
 using chrome_test_util::buttonWithAccessibilityLabel;
diff --git a/ios/chrome/browser/ui/settings/bandwidth_management_collection_view_controller.mm b/ios/chrome/browser/ui/settings/bandwidth_management_collection_view_controller.mm
index b75d9d5..18eefc1 100644
--- a/ios/chrome/browser/ui/settings/bandwidth_management_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/bandwidth_management_collection_view_controller.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/bandwidth_management_collection_view_controller.h"
 
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/prefs/pref_change_registrar.h"
 #include "components/prefs/pref_service.h"
 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm b/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm
index f37bd9a6..5586ac5 100644
--- a/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm
+++ b/ios/chrome/browser/ui/settings/bar_button_activity_indicator.mm
@@ -2,9 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ios/chrome/browser/ui/settings/bar_button_activity_indicator.h"
+#import "ios/chrome/browser/ui/settings/bar_button_activity_indicator.h"
 
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "ios/chrome/browser/ui/ui_util.h"
 
 @implementation BarButtonActivityIndicator {
diff --git a/ios/chrome/browser/ui/settings/block_popups_collection_view_controller.mm b/ios/chrome/browser/ui/settings/block_popups_collection_view_controller.mm
index 3041f48..39638f8 100644
--- a/ios/chrome/browser/ui/settings/block_popups_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/block_popups_collection_view_controller.mm
@@ -4,10 +4,10 @@
 
 #import "ios/chrome/browser/ui/settings/block_popups_collection_view_controller.h"
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/values.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
diff --git a/ios/chrome/browser/ui/settings/block_popups_egtest.mm b/ios/chrome/browser/ui/settings/block_popups_egtest.mm
index 4858d8f90..415e1d741 100644
--- a/ios/chrome/browser/ui/settings/block_popups_egtest.mm
+++ b/ios/chrome/browser/ui/settings/block_popups_egtest.mm
@@ -16,9 +16,9 @@
 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h"
 #include "ios/chrome/grit/ios_strings.h"
 #import "ios/chrome/test/app/chrome_test_util.h"
-#import "ios/chrome/test/app/navigation_test_util.h"
-#import "ios/chrome/test/app/web_view_interaction_test_util.h"
-#import "ios/chrome/test/earl_grey/accessibility_util.h"
+#include "ios/chrome/test/app/navigation_test_util.h"
+#include "ios/chrome/test/app/web_view_interaction_test_util.h"
+#include "ios/chrome/test/earl_grey/accessibility_util.h"
 #import "ios/chrome/test/earl_grey/chrome_actions.h"
 #import "ios/chrome/test/earl_grey/chrome_assertions.h"
 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
@@ -26,7 +26,7 @@
 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
 #import "ios/web/public/test/http_server.h"
-#import "ios/web/public/test/http_server_util.h"
+#include "ios/web/public/test/http_server_util.h"
 #import "ios/web/public/test/web_view_interaction_test_util.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 #include "url/gurl.h"
diff --git a/ios/chrome/browser/ui/settings/cells/account_control_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/account_control_item_unittest.mm
index bff5500..eb0794d 100644
--- a/ios/chrome/browser/ui/settings/cells/account_control_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/account_control_item_unittest.mm
@@ -6,7 +6,7 @@
 
 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm
index 30e4718..9096997b 100644
--- a/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm
@@ -8,7 +8,7 @@
 #import <UIKit/UIKit.h>
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
index 1038a30..3dbe6cc 100644
--- a/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
@@ -6,7 +6,7 @@
 
 #import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/autofill_edit_item.mm b/ios/chrome/browser/ui/settings/cells/autofill_edit_item.mm
index f816fd1a..0c17215 100644
--- a/ios/chrome/browser/ui/settings/cells/autofill_edit_item.mm
+++ b/ios/chrome/browser/ui/settings/cells/autofill_edit_item.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/autofill_edit_item.h"
 
 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
-#include "ios/chrome/browser/ui/rtl_geometry.h"
+#import "ios/chrome/browser/ui/rtl_geometry.h"
 #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoFontLoader.h"
 
diff --git a/ios/chrome/browser/ui/settings/cells/autofill_edit_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/autofill_edit_item_unittest.mm
index e558d752..df13df52 100644
--- a/ios/chrome/browser/ui/settings/cells/autofill_edit_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/autofill_edit_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/autofill_edit_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm
index 703ba3860..df3ebd2b 100644
--- a/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/byo_textfield_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm
index c63e883..6c08662 100644
--- a/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/card_multiline_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm
index 619c4bd..f8531a8 100644
--- a/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm
@@ -8,7 +8,7 @@
 #include "ios/chrome/grit/ios_chromium_strings.h"
 #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm
index 9812c38b..9fb0afb 100644
--- a/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/encryption_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm b/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm
index a3319ab2..7f633f3 100644
--- a/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm
@@ -6,7 +6,7 @@
 
 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/native_app_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/native_app_item_unittest.mm
index b841ba0d..d83e1cb7 100644
--- a/ios/chrome/browser/ui/settings/cells/native_app_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/native_app_item_unittest.mm
@@ -6,7 +6,7 @@
 
 #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm
index 10c5e4b..932a1e0 100644
--- a/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/passphrase_error_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm
index a76e9bee..f3ef3a7 100644
--- a/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/password_details_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm
index 5ba1520..e76ff621 100644
--- a/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm
index 4a3b4b2d..1106c7b 100644
--- a/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm
+++ b/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm
@@ -6,7 +6,7 @@
 #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
 
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 #if !defined(__has_feature) || !__has_feature(objc_arc)
 #error "This file requires ARC support."
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.mm
index d595c8e..125e0fd 100644
--- a/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller.mm
@@ -8,11 +8,11 @@
 #include <string>
 
 #include "base/ios/ios_util.h"
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/logging.h"
-#include "base/mac/bind_objc_block.h"
+#import "base/mac/bind_objc_block.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/memory/ptr_util.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/strings/string_piece.h"
@@ -55,8 +55,8 @@
 #include "ios/chrome/common/channel_info.h"
 #include "ios/chrome/grit/ios_chromium_strings.h"
 #include "ios/chrome/grit/ios_strings.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
-#include "ios/public/provider/chrome/browser/images/branded_image_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/images/branded_image_provider.h"
 #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 #include "url/gurl.h"
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller_unittest.mm
index f32dd9f8..f2deed4 100644
--- a/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/clear_browsing_data_collection_view_controller_unittest.mm
@@ -31,11 +31,11 @@
 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_test_util.h"
 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
-#include "ios/chrome/common/string_util.h"
+#import "ios/chrome/common/string_util.h"
 #include "ios/chrome/grit/ios_strings.h"
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "ui/base/l10n/l10n_util.h"
 
 using testing::Return;
diff --git a/ios/chrome/browser/ui/settings/content_settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/content_settings_collection_view_controller.mm
index fe7c564b..717f290 100644
--- a/ios/chrome/browser/ui/settings/content_settings_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/content_settings_collection_view_controller.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/content_settings_collection_view_controller.h"
 
 #include "base/logging.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/content_settings/core/common/content_settings.h"
 #include "components/content_settings/core/common/content_settings_types.h"
diff --git a/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller.mm b/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller.mm
index f3068231..7c891b1 100644
--- a/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/contextual_search_collection_view_controller.h"
 
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/google/core/browser/google_util.h"
 #include "components/strings/grit/components_strings.h"
 #include "ios/chrome/browser/application_context.h"
diff --git a/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller_unittest.mm
index e32f823..be1d1f6 100644
--- a/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/contextual_search_collection_view_controller_unittest.mm
@@ -12,7 +12,7 @@
 #include "ios/chrome/grit/ios_strings.h"
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
diff --git a/ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controller.mm b/ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controller.mm
index 93cb4e59..b79607a 100644
--- a/ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/dataplan_usage_collection_view_controller.mm
@@ -6,7 +6,7 @@
 
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/prefs/pref_member.h"
 #include "components/prefs/pref_service.h"
 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_text_item.h"
diff --git a/ios/chrome/browser/ui/settings/do_not_track_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/do_not_track_collection_view_controller_unittest.mm
index 63100f3..3eca362 100644
--- a/ios/chrome/browser/ui/settings/do_not_track_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/do_not_track_collection_view_controller_unittest.mm
@@ -8,7 +8,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/files/file_path.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/message_loop/message_loop.h"
 #include "components/prefs/pref_member.h"
 #include "components/prefs/pref_registry_simple.h"
@@ -18,7 +18,7 @@
 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
 #include "ios/chrome/grit/ios_strings.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
diff --git a/ios/chrome/browser/ui/settings/import_data_collection_view_controller.h b/ios/chrome/browser/ui/settings/import_data_collection_view_controller.h
index 59fba3f..e107458 100644
--- a/ios/chrome/browser/ui/settings/import_data_collection_view_controller.h
+++ b/ios/chrome/browser/ui/settings/import_data_collection_view_controller.h
@@ -5,7 +5,7 @@
 #ifndef IOS_CHROME_BROWSER_UI_SETTINGS_IMPORT_DATA_COLLECTION_VIEW_CONTROLLER_H_
 #define IOS_CHROME_BROWSER_UI_SETTINGS_IMPORT_DATA_COLLECTION_VIEW_CONTROLLER_H_
 
-#include "ios/chrome/browser/signin/constants.h"
+#import "ios/chrome/browser/signin/constants.h"
 #import "ios/chrome/browser/ui/settings/settings_root_collection_view_controller.h"
 
 @class ImportDataCollectionViewController;
diff --git a/ios/chrome/browser/ui/settings/import_data_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/import_data_collection_view_controller_unittest.mm
index c6fa7c3b..95194b3 100644
--- a/ios/chrome/browser/ui/settings/import_data_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/import_data_collection_view_controller_unittest.mm
@@ -12,7 +12,7 @@
 #import "ios/chrome/browser/ui/settings/cells/card_multiline_item.h"
 #include "ios/chrome/grit/ios_strings.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
diff --git a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
index 23e2d48..90918d7 100644
--- a/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/material_cell_catalog_view_controller.mm
@@ -26,8 +26,8 @@
 #import "ios/chrome/browser/ui/settings/cells/sync_switch_item.h"
 #import "ios/chrome/browser/ui/settings/cells/text_and_error_item.h"
 #import "ios/chrome/browser/ui/uikit_ui_util.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
-#include "ios/public/provider/chrome/browser/signin/signin_resources_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/signin/signin_resources_provider.h"
 #import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
 #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
 #import "ios/third_party/material_roboto_font_loader_ios/src/src/MaterialRobotoFontLoader.h"
diff --git a/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm b/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
index ff8cdad..77f1eb36 100644
--- a/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/native_apps_collection_view_controller.mm
@@ -7,10 +7,10 @@
 
 #import <StoreKit/StoreKit.h>
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/metrics/histogram.h"
 #include "base/metrics/user_metrics.h"
 #include "base/metrics/user_metrics_action.h"
@@ -22,9 +22,9 @@
 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
 #import "ios/chrome/browser/ui/settings/cells/native_app_item.h"
 #import "ios/chrome/browser/ui/settings/settings_utils.h"
-#include "ios/chrome/common/string_util.h"
+#import "ios/chrome/common/string_util.h"
 #include "ios/chrome/grit/ios_strings.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_metadata.h"
 #import "ios/public/provider/chrome/browser/native_app_launcher/native_app_whitelist_manager.h"
 #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h"
diff --git a/ios/chrome/browser/ui/settings/native_apps_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/native_apps_collection_view_controller_unittest.mm
index 6dfccbd..db97983c 100644
--- a/ios/chrome/browser/ui/settings/native_apps_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/native_apps_collection_view_controller_unittest.mm
@@ -8,7 +8,7 @@
 #include <memory>
 
 #include "base/compiler_specific.h"
-#include "base/ios/block_types.h"
+#import "base/ios/block_types.h"
 #include "base/test/histogram_tester.h"
 #include "base/threading/thread_task_runner_handle.h"
 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
@@ -18,7 +18,7 @@
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "net/url_request/url_request_test_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #import "third_party/ocmock/OCMock/OCMock.h"
 #include "ui/base/l10n/l10n_util.h"
 
diff --git a/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h b/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h
index ed351cd..7edc874 100644
--- a/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h
+++ b/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h
@@ -8,7 +8,7 @@
 #include <memory>
 
 #include "base/compiler_specific.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/keyed_service/core/keyed_service.h"
 #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
 #include "google_apis/gaia/google_service_auth_error.h"
diff --git a/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.mm b/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.mm
index 2207641c..d821c56 100644
--- a/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.mm
+++ b/ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.mm
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h"
+#import "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h"
 
 #import <UIKit/UIKit.h>
 
@@ -25,8 +25,8 @@
 #include "ios/chrome/browser/sync/sync_setup_service.h"
 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
 #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
-#include "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h"
-#include "testing/gtest_mac.h"
+#import "ios/public/provider/chrome/browser/signin/fake_chrome_identity_service.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 
 using testing::DefaultValue;
diff --git a/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm b/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm
index d6cfabf..a67ab23 100644
--- a/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/password_details_collection_view_controller.mm
@@ -6,7 +6,7 @@
 
 #import "base/ios/weak_nsobject.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/affiliation_utils.h"
diff --git a/ios/chrome/browser/ui/settings/password_details_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/password_details_collection_view_controller_unittest.mm
index ce0d016..523c8602 100644
--- a/ios/chrome/browser/ui/settings/password_details_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/password_details_collection_view_controller_unittest.mm
@@ -5,7 +5,7 @@
 #import "ios/chrome/browser/ui/settings/password_details_collection_view_controller.h"
 
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/autofill/core/common/password_form.h"
 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
@@ -15,7 +15,7 @@
 #include "ios/chrome/grit/ios_strings.h"
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "ui/base/l10n/l10n_util.h"
 
 @interface MockReauthenticationModule : NSObject<ReauthenticationProtocol>
diff --git a/ios/chrome/browser/ui/settings/physical_web_collection_view_controller.mm b/ios/chrome/browser/ui/settings/physical_web_collection_view_controller.mm
index bae23328..a086c2a 100644
--- a/ios/chrome/browser/ui/settings/physical_web_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/physical_web_collection_view_controller.mm
@@ -6,7 +6,7 @@
 
 #import <CoreLocation/CoreLocation.h>
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #import "base/mac/foundation_util.h"
 #import "base/mac/scoped_nsobject.h"
 #include "base/metrics/user_metrics.h"
@@ -25,7 +25,7 @@
 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
 #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h"
 #import "ios/chrome/browser/ui/settings/settings_utils.h"
-#include "ios/chrome/common/string_util.h"
+#import "ios/chrome/common/string_util.h"
 #include "ios/chrome/grit/ios_chromium_strings.h"
 #include "ios/chrome/grit/ios_strings.h"
 #import "ios/third_party/material_components_ios/src/components/Palettes/src/MaterialPalettes.h"
diff --git a/ios/chrome/browser/ui/settings/privacy_collection_view_controller.mm b/ios/chrome/browser/ui/settings/privacy_collection_view_controller.mm
index 96ab7e8..57e789c 100644
--- a/ios/chrome/browser/ui/settings/privacy_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/privacy_collection_view_controller.mm
@@ -5,10 +5,10 @@
 #import "ios/chrome/browser/ui/settings/privacy_collection_view_controller.h"
 
 #include "base/ios/ios_util.h"
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/google/core/browser/google_util.h"
 #include "components/handoff/pref_names_ios.h"
 #include "components/metrics/metrics_pref_names.h"
diff --git a/ios/chrome/browser/ui/settings/reauthentication_module.mm b/ios/chrome/browser/ui/settings/reauthentication_module.mm
index 8c5a0025..1c7e355 100644
--- a/ios/chrome/browser/ui/settings/reauthentication_module.mm
+++ b/ios/chrome/browser/ui/settings/reauthentication_module.mm
@@ -6,7 +6,7 @@
 #import <LocalAuthentication/LocalAuthentication.h>
 
 #import "base/ios/weak_nsobject.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 
 @implementation ReauthenticationModule {
   // Authentication context on which the authentication policy is evaluated.
diff --git a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm
index 765c944..32a5317 100644
--- a/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/save_passwords_collection_view_controller.mm
@@ -7,11 +7,11 @@
 #include <memory>
 
 #include "base/ios/ios_util.h"
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/logging.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/objc_property_releaser.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/objc_property_releaser.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/memory/scoped_vector.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/sys_string_conversions.h"
diff --git a/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller.mm
index 86fefe25..23abb39a 100644
--- a/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller.mm
@@ -6,9 +6,9 @@
 
 #include <memory>
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/search_engines/template_url_service.h"
 #include "components/search_engines/template_url_service_observer.h"
diff --git a/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller_unittest.mm
index edfcfcf..c493b2e 100644
--- a/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/search_engine_settings_collection_view_controller_unittest.mm
@@ -19,7 +19,7 @@
 #import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h"
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 
 namespace {
 
diff --git a/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm
index 6298164..23aeae6 100644
--- a/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/settings_collection_view_controller.mm
@@ -24,7 +24,7 @@
 #include "components/signin/core/common/signin_pref_names.h"
 #include "components/strings/grit/components_strings.h"
 #include "ios/chrome/browser/application_context.h"
-#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 #include "ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.h"
 #include "ios/chrome/browser/experimental_flags.h"
 #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
@@ -33,10 +33,10 @@
 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
 #import "ios/chrome/browser/signin/authentication_service.h"
 #include "ios/chrome/browser/signin/authentication_service_factory.h"
-#include "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
+#import "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
 #include "ios/chrome/browser/signin/signin_manager_factory.h"
 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
-#include "ios/chrome/browser/sync/sync_observer_bridge.h"
+#import "ios/chrome/browser/sync/sync_observer_bridge.h"
 #include "ios/chrome/browser/sync/sync_setup_service.h"
 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
 #import "ios/chrome/browser/ui/authentication/signin_interaction_controller.h"
@@ -65,9 +65,9 @@
 #include "ios/chrome/browser/voice/speech_input_locale_config.h"
 #include "ios/chrome/grit/ios_chromium_strings.h"
 #include "ios/chrome/grit/ios_strings.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
-#include "ios/public/provider/chrome/browser/signin/signin_resources_provider.h"
+#import "ios/public/provider/chrome/browser/signin/signin_resources_provider.h"
 #include "ios/public/provider/chrome/browser/voice/voice_search_prefs.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
@@ -907,10 +907,10 @@
     return;
   }
   identityAccountItem.image = [self userAccountImage];
+  identityAccountItem.text = [_identity userFullName];
 
   SyncSetupService* syncSetupService =
       SyncSetupServiceFactory::GetForBrowserState(_mainBrowserState);
-
   if (!syncSetupService->HasFinishedInitialSetup()) {
     identityAccountItem.detailText =
         l10n_util::GetNSString(IDS_IOS_SYNC_SETUP_IN_PROGRESS);
@@ -920,7 +920,6 @@
   identityAccountItem.shouldDisplayError =
       !ios_internal::sync::IsTransientSyncError(
           syncSetupService->GetSyncServiceState());
-  identityAccountItem.text = [_identity userFullName];
   if (identityAccountItem.shouldDisplayError) {
     identityAccountItem.detailText =
         ios_internal::sync::GetSyncErrorDescriptionForBrowserState(
diff --git a/ios/chrome/browser/ui/settings/settings_egtest.mm b/ios/chrome/browser/ui/settings/settings_egtest.mm
index 32eede47..842ce36d 100644
--- a/ios/chrome/browser/ui/settings/settings_egtest.mm
+++ b/ios/chrome/browser/ui/settings/settings_egtest.mm
@@ -28,18 +28,18 @@
 #include "ios/chrome/grit/ios_strings.h"
 #include "ios/chrome/grit/ios_theme_resources.h"
 #import "ios/chrome/test/app/chrome_test_util.h"
-#import "ios/chrome/test/app/navigation_test_util.h"
+#include "ios/chrome/test/app/navigation_test_util.h"
 #import "ios/chrome/test/app/tab_test_util.h"
 #include "ios/chrome/test/app/web_view_interaction_test_util.h"
-#import "ios/chrome/test/earl_grey/accessibility_util.h"
+#include "ios/chrome/test/earl_grey/accessibility_util.h"
 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
 #import "ios/web/public/test/http_server.h"
-#import "ios/web/public/test/http_server_util.h"
+#include "ios/web/public/test/http_server_util.h"
 #import "ios/web/public/test/web_view_interaction_test_util.h"
-#include "ios/web/public/web_state/web_state.h"
+#import "ios/web/public/web_state/web_state.h"
 #include "ios/web/public/web_thread.h"
 #include "net/ssl/channel_id_service.h"
 #include "net/ssl/channel_id_store.h"
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
index bdf380b..13e6835c 100644
--- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
+++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -35,7 +35,7 @@
 #include "ios/chrome/browser/ui/ui_util.h"
 #import "ios/chrome/browser/ui/uikit_ui_util.h"
 #include "ios/chrome/grit/ios_strings.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
 #import "ios/public/provider/chrome/browser/user_feedback/user_feedback_provider.h"
 #import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h"
 #include "ui/base/l10n/l10n_util.h"
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm
index 7a41d6f..3f276c9 100644
--- a/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/settings_navigation_controller_unittest.mm
@@ -9,22 +9,22 @@
 #include <memory>
 
 #include "base/mac/scoped_nsautorelease_pool.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/memory/ptr_util.h"
 #include "components/search_engines/template_url_service.h"
 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
 #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h"
 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
-#include "ios/chrome/browser/signin/authentication_service.h"
+#import "ios/chrome/browser/signin/authentication_service.h"
 #include "ios/chrome/browser/signin/authentication_service_factory.h"
-#include "ios/chrome/browser/signin/authentication_service_fake.h"
+#import "ios/chrome/browser/signin/authentication_service_fake.h"
 #include "ios/chrome/browser/sync/sync_setup_service.h"
 #include "ios/chrome/browser/sync/sync_setup_service_factory.h"
 #include "ios/chrome/test/testing_application_context.h"
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #import "third_party/ocmock/OCMock/OCMock.h"
 #include "third_party/ocmock/gtest_support.h"
diff --git a/ios/chrome/browser/ui/settings/settings_root_collection_view_controller.mm b/ios/chrome/browser/ui/settings/settings_root_collection_view_controller.mm
index 0e165397..d259ef5 100644
--- a/ios/chrome/browser/ui/settings/settings_root_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/settings_root_collection_view_controller.mm
@@ -7,13 +7,13 @@
 #include "base/ios/ios_util.h"
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/objc_property_releaser.h"
-#include "base/mac/scoped_nsobject.h"
-#import "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#import "base/mac/objc_property_releaser.h"
+#import "base/mac/scoped_nsobject.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
 #import "ios/chrome/browser/ui/commands/open_url_command.h"
-#include "ios/chrome/browser/ui/settings/bar_button_activity_indicator.h"
+#import "ios/chrome/browser/ui/settings/bar_button_activity_indicator.h"
 #import "ios/chrome/browser/ui/settings/settings_navigation_controller.h"
 #import "ios/chrome/browser/ui/settings/settings_utils.h"
 #include "ios/chrome/browser/ui/ui_util.h"
diff --git a/ios/chrome/browser/ui/settings/settings_root_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/settings_root_collection_view_controller_unittest.mm
index 0272456..32144bd 100644
--- a/ios/chrome/browser/ui/settings/settings_root_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/settings_root_collection_view_controller_unittest.mm
@@ -6,11 +6,11 @@
 
 #import <Foundation/Foundation.h>
 
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
 #import "ios/chrome/browser/ui/collection_view/collection_view_model.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 
 @interface TestSettingsRootCollectionViewController
diff --git a/ios/chrome/browser/ui/settings/settings_utils.h b/ios/chrome/browser/ui/settings/settings_utils.h
index b27f9e3e..e1601b14 100644
--- a/ios/chrome/browser/ui/settings/settings_utils.h
+++ b/ios/chrome/browser/ui/settings/settings_utils.h
@@ -7,7 +7,7 @@
 
 #import <UIKit/UIKit.h>
 
-#include "ios/chrome/browser/procedural_block_types.h"
+#import "ios/chrome/browser/procedural_block_types.h"
 
 namespace ios_internal_settings {
 
diff --git a/ios/chrome/browser/ui/settings/settings_utils.mm b/ios/chrome/browser/ui/settings/settings_utils.mm
index 9a35e81..be44fa8 100644
--- a/ios/chrome/browser/ui/settings/settings_utils.mm
+++ b/ios/chrome/browser/ui/settings/settings_utils.mm
@@ -4,8 +4,8 @@
 
 #import "ios/chrome/browser/ui/settings/settings_utils.h"
 
-#include "base/ios/weak_nsobject.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/ios/weak_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h"
 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
diff --git a/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller.mm b/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller.mm
index be5191f..7f99423 100644
--- a/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller.mm
@@ -8,7 +8,7 @@
 
 #include "base/logging.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/strings/grit/components_strings.h"
 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
diff --git a/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller_unittest.mm
index e21c9018..33ed556 100644
--- a/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/sync_create_passphrase_collection_view_controller_unittest.mm
@@ -7,17 +7,17 @@
 #import <UIKit/UIKit.h>
 
 #include "base/compiler_specific.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #import "base/test/ios/wait_util.h"
 #include "components/browser_sync/profile_sync_service_mock.h"
 #include "components/strings/grit/components_strings.h"
 #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
 #import "ios/chrome/browser/ui/settings/cells/byo_textfield_item.h"
 #import "ios/chrome/browser/ui/settings/cells/passphrase_error_item.h"
-#include "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h"
+#import "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h"
 #include "ios/chrome/grit/ios_strings.h"
 #include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/l10n/l10n_util_mac.h"
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller.mm b/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller.mm
index 40e9313..2c8be47 100644
--- a/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller.mm
@@ -4,7 +4,7 @@
 
 #import "ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller.h"
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/browser_sync/profile_sync_service.h"
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller_unittest.mm
index 232a987..47f94d88 100644
--- a/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/sync_encryption_collection_view_controller_unittest.mm
@@ -19,7 +19,7 @@
 #include "ios/web/public/test/test_web_thread_bundle.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "ui/base/l10n/l10n_util.h"
 
 namespace {
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm
index ca6a4f0..2ccd5b3 100644
--- a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller.mm
@@ -8,19 +8,19 @@
 
 #include "base/i18n/time_formatting.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/objc_property_releaser.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/objc_property_releaser.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/browser_sync/profile_sync_service.h"
 #include "components/google/core/browser/google_util.h"
 #include "components/signin/core/browser/profile_oauth2_token_service.h"
-#include "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
+#import "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
 #include "components/strings/grit/components_strings.h"
 #include "ios/chrome/browser/application_context.h"
 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 #include "ios/chrome/browser/chrome_url_constants.h"
 #import "ios/chrome/browser/signin/authentication_service.h"
-#import "ios/chrome/browser/signin/authentication_service_factory.h"
+#include "ios/chrome/browser/signin/authentication_service_factory.h"
 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
 #include "ios/chrome/browser/sync/sync_setup_service.h"
diff --git a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm
index b7317e2..8248e6f 100644
--- a/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/sync_encryption_passphrase_collection_view_controller_unittest.mm
@@ -9,7 +9,7 @@
 #include <memory>
 
 #include "base/compiler_specific.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/memory/ptr_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/strings/sys_string_conversions.h"
@@ -23,9 +23,9 @@
 #include "ios/chrome/browser/sync/sync_setup_service_mock.h"
 #import "ios/chrome/browser/ui/settings/cells/byo_textfield_item.h"
 #import "ios/chrome/browser/ui/settings/cells/card_multiline_item.h"
-#include "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h"
+#import "ios/chrome/browser/ui/settings/passphrase_collection_view_controller_test.h"
 #import "ios/chrome/browser/ui/sync/sync_util.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/l10n/l10n_util_mac.h"
diff --git a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm
index 14905c7..9e35a430 100644
--- a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller.mm
@@ -8,12 +8,12 @@
 
 #include "base/auto_reset.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/browser_sync/profile_sync_service.h"
 #include "components/google/core/browser/google_util.h"
 #include "components/signin/core/browser/account_tracker_service.h"
 #include "components/signin/core/browser/profile_oauth2_token_service.h"
-#include "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
+#import "components/signin/ios/browser/oauth2_token_service_observer_bridge.h"
 #include "components/strings/grit/components_strings.h"
 #include "components/sync/base/model_type.h"
 #include "ios/chrome/browser/application_context.h"
@@ -21,8 +21,8 @@
 #include "ios/chrome/browser/experimental_flags.h"
 #include "ios/chrome/browser/signin/account_tracker_service_factory.h"
 #import "ios/chrome/browser/signin/authentication_service.h"
-#import "ios/chrome/browser/signin/authentication_service_factory.h"
-#include "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
+#include "ios/chrome/browser/signin/authentication_service_factory.h"
+#import "ios/chrome/browser/signin/chrome_identity_service_observer_bridge.h"
 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
 #include "ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory.h"
 #include "ios/chrome/browser/sync/sync_setup_service.h"
@@ -46,7 +46,7 @@
 #import "ios/chrome/browser/ui/sync/sync_util.h"
 #import "ios/chrome/browser/ui/uikit_ui_util.h"
 #include "ios/chrome/grit/ios_strings.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h"
 #include "ui/base/l10n/l10n_util_mac.h"
diff --git a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm
index 61292f05..167dcd8 100644
--- a/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/sync_settings_collection_view_controller_unittest.mm
@@ -27,7 +27,7 @@
 #import "ios/chrome/browser/ui/sync/sync_util.h"
 #include "ios/chrome/grit/ios_strings.h"
 #include "ios/web/public/test/test_web_thread_bundle.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "ui/base/l10n/l10n_util.h"
 
 @interface SyncSettingsCollectionViewController (ExposedForTesting)
diff --git a/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm b/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
index 391496d5..7fc05006 100644
--- a/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller.mm
@@ -6,7 +6,7 @@
 
 #import "base/ios/weak_nsobject.h"
 #import "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/browsing_data/core/pref_names.h"
 #include "components/prefs/pref_member.h"
 #include "components/prefs/pref_service.h"
diff --git a/ios/chrome/browser/ui/settings/translate_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/translate_collection_view_controller_unittest.mm
index cde3e277..511ce28b 100644
--- a/ios/chrome/browser/ui/settings/translate_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/translate_collection_view_controller_unittest.mm
@@ -22,7 +22,7 @@
 #import "ios/chrome/browser/ui/collection_view/collection_view_controller_test.h"
 #include "ios/chrome/grit/ios_strings.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/l10n/l10n_util_mac.h"
diff --git a/ios/chrome/browser/ui/settings/translate_ui_egtest.mm b/ios/chrome/browser/ui/settings/translate_ui_egtest.mm
index f806a808..2b3614c 100644
--- a/ios/chrome/browser/ui/settings/translate_ui_egtest.mm
+++ b/ios/chrome/browser/ui/settings/translate_ui_egtest.mm
@@ -9,7 +9,7 @@
 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h"
 #import "ios/chrome/browser/ui/tools_menu/tools_popup_controller.h"
 #include "ios/chrome/grit/ios_strings.h"
-#import "ios/chrome/test/earl_grey/accessibility_util.h"
+#include "ios/chrome/test/earl_grey/accessibility_util.h"
 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
diff --git a/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.mm b/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.mm
index 0e17a5fbd..7a553096 100644
--- a/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.mm
+++ b/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.mm
@@ -4,7 +4,7 @@
 
 #import "ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.h"
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/scoped_observer.h"
 #include "components/content_settings/core/browser/content_settings_details.h"
 #include "components/content_settings/core/browser/content_settings_observer.h"
diff --git a/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean_unittest.mm b/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean_unittest.mm
index cf12cdce..861fcb2 100644
--- a/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean_unittest.mm
+++ b/ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean_unittest.mm
@@ -4,7 +4,7 @@
 
 #import "ios/chrome/browser/ui/settings/utils/content_setting_backed_boolean.h"
 
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/content_settings/core/common/content_settings.h"
 #include "components/content_settings/core/common/content_settings_types.h"
diff --git a/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm b/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
index ba40530..b389227 100644
--- a/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
+++ b/ios/chrome/browser/ui/settings/utils/pref_backed_boolean_unittest.mm
@@ -4,7 +4,7 @@
 
 #import "ios/chrome/browser/ui/settings/utils/pref_backed_boolean.h"
 
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/values.h"
 #include "components/prefs/pref_registry_simple.h"
 #include "components/prefs/testing_pref_service.h"
diff --git a/ios/chrome/browser/ui/settings/utils/resized_avatar_cache.mm b/ios/chrome/browser/ui/settings/utils/resized_avatar_cache.mm
index 2f4a4fd..7f3c775 100644
--- a/ios/chrome/browser/ui/settings/utils/resized_avatar_cache.mm
+++ b/ios/chrome/browser/ui/settings/utils/resized_avatar_cache.mm
@@ -4,12 +4,12 @@
 
 #import "ios/chrome/browser/ui/settings/utils/resized_avatar_cache.h"
 
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #import "ios/chrome/browser/ui/uikit_ui_util.h"
-#include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#import "ios/public/provider/chrome/browser/chrome_browser_provider.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity.h"
 #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h"
-#include "ios/public/provider/chrome/browser/signin/signin_resources_provider.h"
+#import "ios/public/provider/chrome/browser/signin/signin_resources_provider.h"
 
 namespace {
 const CGFloat kAccountProfilePhotoDimension = 40.0f;
diff --git a/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.mm b/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.mm
index 5298b8f..603c2c7 100644
--- a/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.mm
+++ b/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.mm
@@ -4,10 +4,10 @@
 
 #import "ios/chrome/browser/ui/settings/voicesearch_collection_view_controller.h"
 
-#include "base/ios/weak_nsobject.h"
+#import "base/ios/weak_nsobject.h"
 #include "base/logging.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/strings/sys_string_conversions.h"
 #include "components/prefs/pref_member.h"
 #include "components/prefs/pref_service.h"
diff --git a/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller_unittest.mm
index 27b9352..7af6561a 100644
--- a/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/voicesearch_collection_view_controller_unittest.mm
@@ -9,7 +9,7 @@
 #include "base/compiler_specific.h"
 #include "base/files/file_path.h"
 #include "base/mac/foundation_util.h"
-#include "base/mac/scoped_nsobject.h"
+#import "base/mac/scoped_nsobject.h"
 #include "base/message_loop/message_loop.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "components/prefs/pref_member.h"
@@ -21,7 +21,7 @@
 #include "ios/chrome/browser/voice/speech_input_locale_config_impl.h"
 #include "ios/public/provider/chrome/browser/voice/voice_search_prefs.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "testing/gtest_mac.h"
+#import "testing/gtest_mac.h"
 #include "testing/platform_test.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
diff --git a/testing/buildbot/filters/site-per-process.browser_tests.filter b/testing/buildbot/filters/site-per-process.browser_tests.filter
index 06787d05..b78a5594 100644
--- a/testing/buildbot/filters/site-per-process.browser_tests.filter
+++ b/testing/buildbot/filters/site-per-process.browser_tests.filter
@@ -24,3 +24,6 @@
 
 # crbug.com/670362: Flaky failure (expected MouseDown not found)
 -DevToolsPixelOutputTests.TestLatencyInfoInstrumentation
+
+# crbug.com/637415
+-SubresourceFilterBrowserTest.CrossSiteSubFrameActivationWithWhitelist
diff --git a/third_party/WebKit/LayoutTests/fast/css/preserve-user-specified-zoom-level-on-reload.html b/third_party/WebKit/LayoutTests/fast/css/preserve-user-specified-zoom-level-on-reload.html
deleted file mode 100644
index 6de6edc3..0000000
--- a/third_party/WebKit/LayoutTests/fast/css/preserve-user-specified-zoom-level-on-reload.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html>
-<head>
-<script>
-function runTest()
-{
-    if (!window.testRunner)
-        return;
-
-    if (!window.eventSender)
-        return;
-
-    if (!window.sessionStorage)
-        return;
-
-    testRunner.waitUntilDone();
-    if (sessionStorage.testCompleted) {
-        delete sessionStorage.testCompleted;
-        testRunner.notifyDone();
-    } else {
-        // Note, it is sufficient to zoom-in only once, but so as to make it easier
-        // for a human to compare the pixel test results we zoom-in up to Safari's
-        // maximum zoom level, which at the time of writing (09/17/2010) is 6.
-        const MaxZoomIn = 6;
-
-        for (var i = 0; i < MaxZoomIn; ++i)
-            eventSender.zoomPageIn();
-        sessionStorage.testCompleted = true;
-        document.location.reload(true);
-    }
-}
-
-window.onload = runTest;
-</script>
-</head>
-<body>
-<p>This test ensures that we preserve the user-specified zoom level of the page on reload.</p>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt b/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt
new file mode 100644
index 0000000..31b0a01
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution-expected.txt
@@ -0,0 +1,7 @@
+Test for chromium bug : 396653. Tables with specific merge cell configuration render improperly when removing table column.
+
+Second row is rowspan-only-cell and some empty cells present in the row because td node is deleted from the dom tree using script. So Please check that second row height should not be zero in this case.
+
+PASS
+PASS
+PASS
diff --git a/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution.html b/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution.html
new file mode 100644
index 0000000..0e2245b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/table/rowspan-only-rows-height-distribution.html
@@ -0,0 +1,51 @@
+<style>
+    table {
+        border-collapse: collapse;
+    }
+    td {
+        border: 1px solid #000000;
+    }
+</style>
+<script src="../../resources/check-layout.js"></script>
+<script>
+    function calls() {
+        removeCol();
+        checkLayout('tr');
+    }
+
+    function removeCol() {
+        var mutatedTable = document.getElementById("mutated-table");
+        var trElements = mutatedTable.getElementsByTagName('tr');
+
+        for (var i = 0; i < 3; i++) {
+            // Remove the third child in each row
+            var tr = trElements[i];
+            var tdElements = tr.getElementsByTagName('td');
+            var td = tdElements[2];
+            tr.removeChild(td)
+        }
+    }
+</script>
+<body onload="calls()">
+    <h3>Test for chromium bug : <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=396653">396653</a>. Tables with specific merge cell configuration render improperly when removing table column.</h3>
+    <h4>Second row is rowspan-only-cell and some empty cells present in the row because td node is deleted from the dom tree using script. So Please check that second row height should not be zero in this case.</h4>
+    <table id="mutated-table" style="width: 624px;">
+        <tbody>
+            <tr data-expected-height="32">
+                <td rowspan="2" style="height: 117px;"></td>
+                <td style="height: 32px;"></td>
+                <td style="height: 32px;"></td>
+            </tr>
+            <tr data-expected-height="85">
+                <td style="height: 32px; display: none;"></td>
+                <td rowspan="2" style="height: 117px;"></td>
+                <td style="height: 84px;"></td>
+            </tr>
+            <tr data-expected-height="32">
+                <td style="height: 32px;"></td>
+                <td style="height: 32px; display: none;"></td>
+                <td style="height: 32px;"></td>
+            </tr>
+        </tbody>
+    </table>
+</body>
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped.html b/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped.html
index 1a73681..ba279c3e 100644
--- a/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped.html
+++ b/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped.html
@@ -409,20 +409,20 @@
         <td>row5 col1</td>
         <td>row5 col2</td>
     </tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="74">
         <td rowspan=5 style="height:200px">row6 col0</td>
         <td rowspan=5 style="height:100px">row6 col1</td>
     </tr>
-    <tr data-expected-height="37">
+    <tr data-expected-height="19">
         <td>row7 col1</td>
     </tr>
-    <tr data-expected-height="38">
+    <tr data-expected-height="19">
         <td>row8 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row9 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row10 col1</td>
     </tr>
 </table>
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows.html b/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows.html
index 89b0ea63..2cf038f 100644
--- a/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows.html
+++ b/third_party/WebKit/LayoutTests/fast/table/table-all-rowspans-height-distribution-in-rows.html
@@ -24,13 +24,13 @@
     <tr data-expected-height="19">
 	  <td>row1 col1</td>
 	</tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="261">
       <td rowspan="3" style="height:200px">row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/>row2 col1 rowspan=3 height=200px<br/></td>
     </tr>
-    <tr data-expected-height="165">
+    <tr data-expected-height="34">
       <td>row3 col2</td>
     </tr>
-    <tr data-expected-height="168">
+    <tr data-expected-height="34">
       <td>row4 col2</td>
     </tr>
     <tr data-expected-height="20">
@@ -44,20 +44,20 @@
 <h5>Test 2 - One row spanning cell present under the boundries of other row spanning cell and inner row spanning cell have its own height.</h5>
 <table border="1" width="607">
   <tbody>
-    <tr  data-expected-height="23">
+    <tr  data-expected-height="19">
       <td rowspan="6" style="height:600px">row0 col0 rowspan=6 height=600px</td>
       <td>row0 col1</td>
     </tr>
-    <tr data-expected-height="24">
+    <tr data-expected-height="19">
 	  <td>row1 col1</td>
 	</tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="461">
       <td rowspan="3" style="height:400px">row2 col1 rowspan=3 height=400px</td>
     </tr>
-    <tr data-expected-height="247">
+    <tr data-expected-height="34">
       <td>row3 col2</td>
     </tr>
-    <tr data-expected-height="260">
+    <tr data-expected-height="34">
       <td>row4 col2</td>
     </tr>
     <tr data-expected-height="25">
@@ -71,20 +71,20 @@
 <h5>Test 3 - 2 same row spanning cells with different heights.</h5>
 <table border="1">
   <tbody>
-    <tr  data-expected-height="0">
+    <tr  data-expected-height="308">
       <td rowspan="6" style="height:300px">row0 col0 rowspan=6 height=300px</td>
       <td rowspan="6" style="height:500px">row0 col1 rowspan=6 height=500px</td>
     </tr>
-    <tr data-expected-height="90">
+    <tr data-expected-height="34">
 	  <td>row1 col1</td>
 	</tr>
-    <tr data-expected-height="94">
+    <tr data-expected-height="34">
       <td>row2 col1</td>
     </tr>
-    <tr data-expected-height="95">
+    <tr data-expected-height="34">
       <td>row3 col1</td>
     </tr>
-    <tr data-expected-height="99">
+    <tr data-expected-height="34">
       <td>row4 col1</td>
     </tr>
     <tr data-expected-height="99">
@@ -98,23 +98,23 @@
 <h5>Test 4 - some rows are common between 2 row spanning cells.</h5>
 <table border="1">
   <tbody>
-    <tr data-expected-height="43">
+    <tr data-expected-height="19">
         <td rowspan="6" style="height:400px">row0 col0 rowspan=6 height=400px</td>
         <td>row0 col1</td>
     </tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="623">
         <td rowspan="6" style="height:800px">row1 col1 rowspan=6 height=800px</td>
     </tr>
-    <tr data-expected-height="168">
+    <tr data-expected-height="34">
         <td>row2 col2</td>
     </tr>
-    <tr data-expected-height="177">
+    <tr data-expected-height="34">
         <td>row3 col2</td>
     </tr>
-    <tr data-expected-height="176">
+    <tr data-expected-height="34">
         <td>row4 col2</td>
     </tr>
-    <tr data-expected-height="189">
+    <tr data-expected-height="34">
         <td>row5 col2</td>
     </tr>
     <tr data-expected-height="42">
@@ -128,23 +128,23 @@
 <h5>Test 5 - 2 spanning cells starts at different row index but end at same row index.</h5>
 <table border="1">
   <tbody>
-    <tr data-expected-height="35">
+    <tr data-expected-height="19">
         <td rowspan="6" style="height:600px">row0 col0 rowspan=6 height=400px</td>
         <td>row0 col1</td>
     </tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="423">
         <td rowspan="5" style="height:300px">row1 col1 rowspan=6 height=800px</td>
     </tr>
-    <tr data-expected-height="130">
+    <tr data-expected-height="34">
         <td>row2 col2</td>
     </tr>
-    <tr data-expected-height="132">
+    <tr data-expected-height="34">
         <td>row3 col2</td>
     </tr>
-    <tr data-expected-height="140">
+    <tr data-expected-height="34">
         <td>row4 col2</td>
     </tr>
-    <tr data-expected-height="140">
+    <tr data-expected-height="34">
         <td>row5 col2</td>
     </tr>
     <tr data-expected-height="19">
@@ -279,20 +279,20 @@
         <td>row5 col1</td>
         <td>row5 col2</td>
     </tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="74">
         <td rowspan=5 style="height:200px">row6 col0</td>
         <td rowspan=5 style="height:100px">row6 col1</td>
     </tr>
-    <tr data-expected-height="37">
+    <tr data-expected-height="19">
         <td>row7 col1</td>
     </tr>
-    <tr data-expected-height="38">
+    <tr data-expected-height="19">
         <td>row8 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row9 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row10 col1</td>
     </tr>
 </table>
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1.html b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1.html
index c75ad07..f7e4d98c 100644
--- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1.html
+++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-1.html
@@ -233,20 +233,20 @@
         <td>row5 col1</td>
         <td>row5 col2</td>
     </tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="74">
         <td rowspan=5 style="height:200px">row6 col0</td>
         <td rowspan=5 style="height:100px">row6 col1</td>
     </tr>
-    <tr data-expected-height="37">
+    <tr data-expected-height="19">
         <td>row7 col1</td>
     </tr>
-    <tr data-expected-height="38">
+    <tr data-expected-height="19">
         <td>row8 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row9 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row10 col1</td>
     </tr>
 </table>
diff --git a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2.html b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2.html
index 9f0006a5..d4bc8ae2 100644
--- a/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2.html
+++ b/third_party/WebKit/LayoutTests/fast/table/table-rowspan-height-distribution-in-rows-2.html
@@ -358,20 +358,20 @@
         <td>row5 col1</td>
         <td>row5 col2</td>
     </tr>
-    <tr data-expected-height="0">
+    <tr data-expected-height="74">
         <td rowspan=5 style="height:200px">row6 col0</td>
         <td rowspan=5 style="height:100px">row6 col1</td>
     </tr>
-    <tr data-expected-height="37">
+    <tr data-expected-height="19">
         <td>row7 col1</td>
     </tr>
-    <tr data-expected-height="38">
+    <tr data-expected-height="19">
         <td>row8 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row9 col1</td>
     </tr>
-    <tr data-expected-height="49">
+    <tr data-expected-height="19">
         <td>row10 col1</td>
     </tr>
 </table>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png
deleted file mode 100644
index 4183eecd..0000000
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt
deleted file mode 100644
index 21c72d6..0000000
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-layer at (0,0) size 800x600
-  LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  LayoutBlockFlow {HTML} at (0,0) size 800x600
-    LayoutBlockFlow {BODY} at (23.88,23.88) size 752.25x528.36
-      LayoutBlockFlow {P} at (0,0) size 752.25x171
-        LayoutText {#text} at (0,1) size 708x169
-          text run at (0,1) width 708: "This test ensures that we preserve the"
-          text run at (0,58) width 704: "user-specified zoom level of the page"
-          text run at (0,115) width 187: "on reload."
diff --git a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.png b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.png
index 2407cad..9af9178a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.txt
index 2166894..dd41161 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/tables/mozilla/bugs/bug220536-expected.txt
@@ -3,20 +3,20 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutTable {TABLE} at (0,0) size 118x58 [border: (1px outset #808080)]
-        LayoutTableSection {THEAD} at (1,1) size 116x30
-          LayoutTableRow {TR} at (0,2) size 116x0
-            LayoutTableCell {TH} at (2,3) size 36x24 [border: (1px inset #808080)] [r=0 c=0 rs=2 cs=1]
+      LayoutTable {TABLE} at (0,0) size 118x56 [border: (1px outset #808080)]
+        LayoutTableSection {THEAD} at (1,1) size 116x28
+          LayoutTableRow {TR} at (0,2) size 116x11
+            LayoutTableCell {TH} at (2,2) size 36x24 [border: (1px inset #808080)] [r=0 c=0 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 32x19
                 text run at (2,2) width 32: "aaaa"
-            LayoutTableCell {TH} at (40,3) size 36x24 [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
+            LayoutTableCell {TH} at (40,2) size 36x24 [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 32x19
                 text run at (2,2) width 32: "bbbb"
-            LayoutTableCell {TH} at (78,3) size 36x24 [border: (1px inset #808080)] [r=0 c=2 rs=2 cs=1]
+            LayoutTableCell {TH} at (78,2) size 36x24 [border: (1px inset #808080)] [r=0 c=2 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 32x19
                 text run at (2,2) width 32: "dddd"
-          LayoutTableRow {TR} at (0,4) size 116x24
-        LayoutTableSection {TBODY} at (1,31) size 116x26
+          LayoutTableRow {TR} at (0,15) size 116x11
+        LayoutTableSection {TBODY} at (1,29) size 116x26
           LayoutTableRow {TR} at (0,0) size 116x24
             LayoutTableCell {TD} at (2,0) size 36x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               LayoutText {#text} at (2,2) size 31x19
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png
deleted file mode 100644
index 4a4dcbf7..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt
deleted file mode 100644
index 692c28d..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-layer at (0,0) size 800x600
-  LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  LayoutBlockFlow {HTML} at (0,0) size 800x600
-    LayoutBlockFlow {BODY} at (23.88,23.88) size 752.25x528.36
-      LayoutBlockFlow {P} at (0,0) size 752.25x165
-        LayoutText {#text} at (0,0) size 714x165
-          text run at (0,0) width 714: "This test ensures that we preserve the"
-          text run at (0,55) width 712: "user-specified zoom level of the page"
-          text run at (0,110) width 191: "on reload."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt
index d1d1e50..c69d0c3b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-except-overlapped-expected.txt
@@ -321,7 +321,7 @@
     </tr>
 row1 col1	row1 col2	row1 col3
 FAIL:
-Expected 87 for height, but got 59. 
+Expected 87 for height, but got 52. 
 
 <tr data-expected-height="87">
         <td rowspan="3" style="height:200px">row1 col1</td>
@@ -330,26 +330,46 @@
     </tr>
 row2 col3
 FAIL:
-Expected 96 for height, but got 95. 
+Expected 96 for height, but got 84. 
 
 <tr data-expected-height="96">
         <td>row2 col3</td>
     </tr>
 row3 col2
-PASS
-row4 col1	row4 col2	row4 col3
-PASS
-row5 col0	row5 col1	row5 col2
-PASS
-row6 col0	row6 col1
-PASS
-row7 col1
 FAIL:
-Expected 37 for height, but got 38. 
+Expected 40 for height, but got 35. 
 
-<tr data-expected-height="37">
-        <td>row7 col1</td>
+<tr data-expected-height="40">
+        <td>row3 col2</td>
     </tr>
+row4 col1	row4 col2	row4 col3
+FAIL:
+Expected 24 for height, but got 38. 
+
+<tr data-expected-height="24">
+        <td>row4 col1</td>
+        <td>row4 col2</td>
+        <td>row4 col3</td>
+    </tr>
+row5 col0	row5 col1	row5 col2
+FAIL:
+Expected 19 for height, but got 34. 
+
+<tr data-expected-height="19">
+        <td>row5 col0</td>
+        <td>row5 col1</td>
+        <td>row5 col2</td>
+    </tr>
+row6 col0	row6 col1
+FAIL:
+Expected 74 for height, but got 76. 
+
+<tr data-expected-height="74">
+        <td rowspan="5" style="height:200px">row6 col0</td>
+        <td rowspan="5" style="height:100px">row6 col1</td>
+    </tr>
+row7 col1
+PASS
 row8 col1
 PASS
 row9 col1
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt
index 6a61594..1715ead 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-all-rowspans-height-distribution-in-rows-expected.txt
@@ -19,7 +19,12 @@
 row2 col1 rowspan=3 height=200px
 row2 col1 rowspan=3 height=200px
 row2 col1 rowspan=3 height=200px
-PASS
+FAIL:
+Expected 261 for height, but got 262. 
+
+<tr data-expected-height="261">
+      <td rowspan="3" style="height:200px">row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br>row2 col1 rowspan=3 height=200px<br></td>
+    </tr>
 row3 col2
 PASS
 row4 col2
@@ -31,29 +36,18 @@
 Test 2 - One row spanning cell present under the boundries of other row spanning cell and inner row spanning cell have its own height.
 
 row0 col0 rowspan=6 height=600px	row0 col1
-FAIL:
-Expected 23 for height, but got 20. 
-
-<tr data-expected-height="23">
-      <td rowspan="6" style="height:600px">row0 col0 rowspan=6 height=600px</td>
-      <td>row0 col1</td>
-    </tr>
-row1 col1
-FAIL:
-Expected 24 for height, but got 20. 
-
-<tr data-expected-height="24">
-	  <td>row1 col1</td>
-	</tr>
-row2 col1 rowspan=3 height=400px
 PASS
-row3 col2
+row1 col1
+PASS
+row2 col1 rowspan=3 height=400px
 FAIL:
-Expected 247 for height, but got 248. 
+Expected 461 for height, but got 462. 
 
-<tr data-expected-height="247">
-      <td>row3 col2</td>
+<tr data-expected-height="461">
+      <td rowspan="3" style="height:400px">row2 col1 rowspan=3 height=400px</td>
     </tr>
+row3 col2
+PASS
 row4 col2
 PASS
 row5 col1
@@ -63,21 +57,17 @@
 Test 3 - 2 same row spanning cells with different heights.
 
 row0 col0 rowspan=6 height=300px	row0 col1 rowspan=6 height=500px
-PASS
-row1 col1
 FAIL:
-Expected 90 for height, but got 43. 
+Expected 308 for height, but got 310. 
 
-<tr data-expected-height="90">
-	  <td>row1 col1</td>
-	</tr>
-row2 col1
-FAIL:
-Expected 94 for height, but got 95. 
-
-<tr data-expected-height="94">
-      <td>row2 col1</td>
+<tr data-expected-height="308">
+      <td rowspan="6" style="height:300px">row0 col0 rowspan=6 height=300px</td>
+      <td rowspan="6" style="height:500px">row0 col1 rowspan=6 height=500px</td>
     </tr>
+row1 col1
+PASS
+row2 col1
+PASS
 row3 col1
 PASS
 row4 col1
@@ -89,36 +79,20 @@
 Test 4 - some rows are common between 2 row spanning cells.
 
 row0 col0 rowspan=6 height=400px	row0 col1
-FAIL:
-Expected 43 for height, but got 34. 
-
-<tr data-expected-height="43">
-        <td rowspan="6" style="height:400px">row0 col0 rowspan=6 height=400px</td>
-        <td>row0 col1</td>
-    </tr>
-row1 col1 rowspan=6 height=800px
 PASS
+row1 col1 rowspan=6 height=800px
+FAIL:
+Expected 623 for height, but got 625. 
+
+<tr data-expected-height="623">
+        <td rowspan="6" style="height:800px">row1 col1 rowspan=6 height=800px</td>
+    </tr>
 row2 col2
-FAIL:
-Expected 168 for height, but got 65. 
-
-<tr data-expected-height="168">
-        <td>row2 col2</td>
-    </tr>
+PASS
 row3 col2
-FAIL:
-Expected 177 for height, but got 83. 
-
-<tr data-expected-height="177">
-        <td>row3 col2</td>
-    </tr>
+PASS
 row4 col2
-FAIL:
-Expected 176 for height, but got 177. 
-
-<tr data-expected-height="176">
-        <td>row4 col2</td>
-    </tr>
+PASS
 row5 col2
 PASS
 row6 col2
@@ -130,14 +104,14 @@
 row0 col0 rowspan=6 height=400px	row0 col1
 PASS
 row1 col1 rowspan=6 height=800px
-PASS
-row2 col2
 FAIL:
-Expected 130 for height, but got 132. 
+Expected 423 for height, but got 425. 
 
-<tr data-expected-height="130">
-        <td>row2 col2</td>
+<tr data-expected-height="423">
+        <td rowspan="5" style="height:300px">row1 col1 rowspan=6 height=800px</td>
     </tr>
+row2 col2
+PASS
 row3 col2
 PASS
 row4 col2
@@ -213,7 +187,7 @@
     </tr>
 row1 col1	row1 col2	row1 col3
 FAIL:
-Expected 87 for height, but got 59. 
+Expected 87 for height, but got 52. 
 
 <tr data-expected-height="87">
         <td rowspan="3" style="height:200px">row1 col1</td>
@@ -222,26 +196,46 @@
     </tr>
 row2 col3
 FAIL:
-Expected 96 for height, but got 95. 
+Expected 96 for height, but got 84. 
 
 <tr data-expected-height="96">
         <td>row2 col3</td>
     </tr>
 row3 col2
-PASS
-row4 col1	row4 col2	row4 col3
-PASS
-row5 col0	row5 col1	row5 col2
-PASS
-row6 col0	row6 col1
-PASS
-row7 col1
 FAIL:
-Expected 37 for height, but got 38. 
+Expected 40 for height, but got 35. 
 
-<tr data-expected-height="37">
-        <td>row7 col1</td>
+<tr data-expected-height="40">
+        <td>row3 col2</td>
     </tr>
+row4 col1	row4 col2	row4 col3
+FAIL:
+Expected 24 for height, but got 38. 
+
+<tr data-expected-height="24">
+        <td>row4 col1</td>
+        <td>row4 col2</td>
+        <td>row4 col3</td>
+    </tr>
+row5 col0	row5 col1	row5 col2
+FAIL:
+Expected 19 for height, but got 34. 
+
+<tr data-expected-height="19">
+        <td>row5 col0</td>
+        <td>row5 col1</td>
+        <td>row5 col2</td>
+    </tr>
+row6 col0	row6 col1
+FAIL:
+Expected 74 for height, but got 76. 
+
+<tr data-expected-height="74">
+        <td rowspan="5" style="height:200px">row6 col0</td>
+        <td rowspan="5" style="height:100px">row6 col1</td>
+    </tr>
+row7 col1
+PASS
 row8 col1
 PASS
 row9 col1
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt
index 99963b21..37afdbf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-1-expected.txt
@@ -138,7 +138,7 @@
     </tr>
 row1 col1	row1 col2	row1 col3
 FAIL:
-Expected 87 for height, but got 59. 
+Expected 87 for height, but got 52. 
 
 <tr data-expected-height="87">
         <td rowspan="3" style="height:200px">row1 col1</td>
@@ -147,26 +147,46 @@
     </tr>
 row2 col3
 FAIL:
-Expected 96 for height, but got 95. 
+Expected 96 for height, but got 84. 
 
 <tr data-expected-height="96">
         <td>row2 col3</td>
     </tr>
 row3 col2
-PASS
-row4 col1	row4 col2	row4 col3
-PASS
-row5 col0	row5 col1	row5 col2
-PASS
-row6 col0	row6 col1
-PASS
-row7 col1
 FAIL:
-Expected 37 for height, but got 38. 
+Expected 40 for height, but got 35. 
 
-<tr data-expected-height="37">
-        <td>row7 col1</td>
+<tr data-expected-height="40">
+        <td>row3 col2</td>
     </tr>
+row4 col1	row4 col2	row4 col3
+FAIL:
+Expected 24 for height, but got 38. 
+
+<tr data-expected-height="24">
+        <td>row4 col1</td>
+        <td>row4 col2</td>
+        <td>row4 col3</td>
+    </tr>
+row5 col0	row5 col1	row5 col2
+FAIL:
+Expected 19 for height, but got 34. 
+
+<tr data-expected-height="19">
+        <td>row5 col0</td>
+        <td>row5 col1</td>
+        <td>row5 col2</td>
+    </tr>
+row6 col0	row6 col1
+FAIL:
+Expected 74 for height, but got 76. 
+
+<tr data-expected-height="74">
+        <td rowspan="5" style="height:200px">row6 col0</td>
+        <td rowspan="5" style="height:100px">row6 col1</td>
+    </tr>
+row7 col1
+PASS
 row8 col1
 PASS
 row9 col1
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt
index 5ab0897..98ad95f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/table-rowspan-height-distribution-in-rows-2-expected.txt
@@ -256,7 +256,7 @@
     </tr>
 row1 col1	row1 col2	row1 col3
 FAIL:
-Expected 87 for height, but got 59. 
+Expected 87 for height, but got 52. 
 
 <tr data-expected-height="87">
         <td rowspan="3" style="height:200px">row1 col1</td>
@@ -265,26 +265,46 @@
     </tr>
 row2 col3
 FAIL:
-Expected 96 for height, but got 95. 
+Expected 96 for height, but got 84. 
 
 <tr data-expected-height="96">
         <td>row2 col3</td>
     </tr>
 row3 col2
-PASS
-row4 col1	row4 col2	row4 col3
-PASS
-row5 col0	row5 col1	row5 col2
-PASS
-row6 col0	row6 col1
-PASS
-row7 col1
 FAIL:
-Expected 37 for height, but got 38. 
+Expected 40 for height, but got 35. 
 
-<tr data-expected-height="37">
-        <td>row7 col1</td>
+<tr data-expected-height="40">
+        <td>row3 col2</td>
     </tr>
+row4 col1	row4 col2	row4 col3
+FAIL:
+Expected 24 for height, but got 38. 
+
+<tr data-expected-height="24">
+        <td>row4 col1</td>
+        <td>row4 col2</td>
+        <td>row4 col3</td>
+    </tr>
+row5 col0	row5 col1	row5 col2
+FAIL:
+Expected 19 for height, but got 34. 
+
+<tr data-expected-height="19">
+        <td>row5 col0</td>
+        <td>row5 col1</td>
+        <td>row5 col2</td>
+    </tr>
+row6 col0	row6 col1
+FAIL:
+Expected 74 for height, but got 76. 
+
+<tr data-expected-height="74">
+        <td rowspan="5" style="height:200px">row6 col0</td>
+        <td rowspan="5" style="height:100px">row6 col1</td>
+    </tr>
+row7 col1
+PASS
 row8 col1
 PASS
 row9 col1
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.png
index 14c5d35..ff08cba 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.txt
index 2bb0160d..e4f2bb1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug220536-expected.txt
@@ -3,20 +3,20 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutTable {TABLE} at (0,0) size 126x54 [border: (1px outset #808080)]
-        LayoutTableSection {THEAD} at (1,1) size 124x28
-          LayoutTableRow {TR} at (0,2) size 124x0
-            LayoutTableCell {TH} at (2,3) size 36x22 [border: (1px inset #808080)] [r=0 c=0 rs=2 cs=1]
+      LayoutTable {TABLE} at (0,0) size 126x52 [border: (1px outset #808080)]
+        LayoutTableSection {THEAD} at (1,1) size 124x26
+          LayoutTableRow {TR} at (0,2) size 124x10
+            LayoutTableCell {TH} at (2,2) size 36x22 [border: (1px inset #808080)] [r=0 c=0 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 32x18
                 text run at (2,2) width 32: "aaaa"
-            LayoutTableCell {TH} at (40,3) size 40x22 [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
+            LayoutTableCell {TH} at (40,2) size 40x22 [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 36x18
                 text run at (2,2) width 36: "bbbb"
-            LayoutTableCell {TH} at (82,3) size 40x22 [border: (1px inset #808080)] [r=0 c=2 rs=2 cs=1]
+            LayoutTableCell {TH} at (82,2) size 40x22 [border: (1px inset #808080)] [r=0 c=2 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 36x18
                 text run at (2,2) width 36: "dddd"
-          LayoutTableRow {TR} at (0,4) size 124x22
-        LayoutTableSection {TBODY} at (1,29) size 124x24
+          LayoutTableRow {TR} at (0,14) size 124x10
+        LayoutTableSection {TBODY} at (1,27) size 124x24
           LayoutTableRow {TR} at (0,0) size 124x22
             LayoutTableCell {TD} at (2,0) size 36x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               LayoutText {#text} at (2,2) size 31x18
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png
deleted file mode 100644
index 8f1c1292..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/fast/css/preserve-user-specified-zoom-level-on-reload-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt
deleted file mode 100644
index 4f9dc4f..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/fast/css/preserve-user-specified-zoom-level-on-reload-expected.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-layer at (0,0) size 800x600
-  LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  LayoutBlockFlow {HTML} at (0,0) size 800x600
-    LayoutBlockFlow {BODY} at (23.88,23.88) size 752.25x528.36
-      LayoutBlockFlow {P} at (0,0) size 752.25x165
-        LayoutText {#text} at (0,1) size 714x163
-          text run at (0,1) width 714: "This test ensures that we preserve the"
-          text run at (0,56) width 714: "user-specified zoom level of the page"
-          text run at (0,111) width 191: "on reload."
diff --git a/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.png b/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.png
index cb4fb08..9a18f443 100644
--- a/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.txt b/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.txt
index c55c138..dcc33b89 100644
--- a/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/tables/mozilla/bugs/bug220536-expected.txt
@@ -3,20 +3,20 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutTable {TABLE} at (0,0) size 126x54 [border: (1px outset #808080)]
-        LayoutTableSection {THEAD} at (1,1) size 124x28
-          LayoutTableRow {TR} at (0,2) size 124x0
-            LayoutTableCell {TH} at (2,3) size 36x22 [border: (1px inset #808080)] [r=0 c=0 rs=2 cs=1]
+      LayoutTable {TABLE} at (0,0) size 126x52 [border: (1px outset #808080)]
+        LayoutTableSection {THEAD} at (1,1) size 124x26
+          LayoutTableRow {TR} at (0,2) size 124x10
+            LayoutTableCell {TH} at (2,2) size 36x22 [border: (1px inset #808080)] [r=0 c=0 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 32x17
                 text run at (2,2) width 32: "aaaa"
-            LayoutTableCell {TH} at (40,3) size 40x22 [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
+            LayoutTableCell {TH} at (40,2) size 40x22 [border: (1px inset #808080)] [r=0 c=1 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 36x17
                 text run at (2,2) width 36: "bbbb"
-            LayoutTableCell {TH} at (82,3) size 40x22 [border: (1px inset #808080)] [r=0 c=2 rs=2 cs=1]
+            LayoutTableCell {TH} at (82,2) size 40x22 [border: (1px inset #808080)] [r=0 c=2 rs=2 cs=1]
               LayoutText {#text} at (2,2) size 36x17
                 text run at (2,2) width 36: "dddd"
-          LayoutTableRow {TR} at (0,4) size 124x22
-        LayoutTableSection {TBODY} at (1,29) size 124x24
+          LayoutTableRow {TR} at (0,14) size 124x10
+        LayoutTableSection {TBODY} at (1,27) size 124x24
           LayoutTableRow {TR} at (0,0) size 124x22
             LayoutTableCell {TD} at (2,0) size 36x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               LayoutText {#text} at (2,2) size 31x17
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseProperty.h b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseProperty.h
index 97f3a4f6..e3e17ba 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseProperty.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptPromiseProperty.h
@@ -60,6 +60,8 @@
   template <typename PassResolvedType>
   void resolve(PassResolvedType);
 
+  void resolveWithUndefined();
+
   template <typename PassRejectedType>
   void reject(PassRejectedType);
 
@@ -84,6 +86,7 @@
   HolderType m_holder;
   ResolvedType m_resolved;
   RejectedType m_rejected;
+  bool m_resolvedWithUndefined = false;
 };
 
 template <typename HolderType, typename ResolvedType, typename RejectedType>
@@ -99,7 +102,7 @@
 void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>::resolve(
     PassResolvedType value) {
   if (getState() != Pending) {
-    ASSERT_NOT_REACHED();
+    NOTREACHED();
     return;
   }
   if (!getExecutionContext() || getExecutionContext()->isContextDestroyed())
@@ -109,11 +112,24 @@
 }
 
 template <typename HolderType, typename ResolvedType, typename RejectedType>
+void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>::
+    resolveWithUndefined() {
+  if (getState() != Pending) {
+    NOTREACHED();
+    return;
+  }
+  if (!getExecutionContext() || getExecutionContext()->isContextDestroyed())
+    return;
+  m_resolvedWithUndefined = true;
+  resolveOrReject(Resolved);
+}
+
+template <typename HolderType, typename ResolvedType, typename RejectedType>
 template <typename PassRejectedType>
 void ScriptPromiseProperty<HolderType, ResolvedType, RejectedType>::reject(
     PassRejectedType value) {
   if (getState() != Pending) {
-    ASSERT_NOT_REACHED();
+    NOTREACHED();
     return;
   }
   if (!getExecutionContext() || getExecutionContext()->isContextDestroyed())
@@ -139,7 +155,9 @@
     v8::Isolate* isolate,
     v8::Local<v8::Object> creationContext) {
   ASSERT(getState() == Resolved);
-  return ToV8(m_resolved, creationContext, isolate);
+  if (!m_resolvedWithUndefined)
+    return ToV8(m_resolved, creationContext, isolate);
+  return v8::Undefined(isolate);
 }
 
 template <typename HolderType, typename ResolvedType, typename RejectedType>
@@ -156,6 +174,7 @@
   resetBase();
   m_resolved = ResolvedType();
   m_rejected = RejectedType();
+  m_resolvedWithUndefined = false;
 }
 
 template <typename HolderType, typename ResolvedType, typename RejectedType>
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
index eb96228..f8008b7 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitor.h
@@ -173,6 +173,7 @@
   bool pushToMarkingDeque(
       void (*traceWrappersCallback)(const WrapperVisitor*, const void*),
       HeapObjectHeader* (*heapObjectHeaderCallback)(const void*),
+      void (*missedWriteBarrierCallback)(void),
       const void* object) const override {
     if (!m_tracingInProgress)
       return false;
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h
index 4706b0d..8649e122 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptWrappableVisitorVerifier.h
@@ -39,6 +39,7 @@
   bool pushToMarkingDeque(
       void (*traceWrappersCallback)(const WrapperVisitor*, const void*),
       HeapObjectHeader* (*heapObjectHeaderCallback)(const void*),
+      void (*missedWriteBarrierCallback)(void),
       const void* object) const override {
     if (!heapObjectHeaderCallback(object)->isWrapperHeaderMarked()) {
       // If this branch is hit, it means that a white (not discovered by
@@ -48,9 +49,10 @@
       // therefore its wrapper and all wrappers reachable from it would be
       // collected.
 
-      // Most often this means there is a write barrier missing somewhere.
-      // Check backtrace to see which classes are causing this and review all
-      // the places where white class is set to the black class.
+      // 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.
+      missedWriteBarrierCallback();
       NOTREACHED();
     }
     traceWrappersCallback(this, object);
diff --git a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp
index e51c76d..d73a821 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/WindowProxyManager.cpp
@@ -50,11 +50,8 @@
 
 void WindowProxyManager::updateSecurityOrigin(SecurityOrigin* securityOrigin) {
   m_windowProxy->updateSecurityOrigin(securityOrigin);
-
   for (auto& entry : m_isolatedWorlds) {
     WindowProxy* isolatedWindowProxy = entry.value.get();
-    if (!isolatedWindowProxy->isContextInitialized())
-      continue;
     SecurityOrigin* isolatedSecurityOrigin =
         isolatedWindowProxy->world().isolatedWorldSecurityOrigin();
     isolatedWindowProxy->updateSecurityOrigin(isolatedSecurityOrigin);
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
index ccb0e1d6..0fd4216e 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -1925,8 +1925,11 @@
 
 void StyleResolver::updateMediaType() {
   if (FrameView* view = document().view()) {
+    bool wasPrint = m_printMediaType;
     m_printMediaType =
         equalIgnoringCase(view->mediaType(), MediaTypeNames::print);
+    if (wasPrint != m_printMediaType)
+      m_matchedPropertiesCache.clearViewportDependent();
   }
 }
 
diff --git a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
index 49b16403..5385c8d 100644
--- a/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
+++ b/third_party/WebKit/Source/core/fetch/CrossOriginAccessControl.cpp
@@ -281,9 +281,10 @@
   // Fetch API Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch
   // CORS Spec: http://www.w3.org/TR/cors/#cross-origin-request-with-preflight-0
   // https://crbug.com/452394
-  if (response.httpStatusCode() < 200 || response.httpStatusCode() >= 300) {
+  int statusCode = response.httpStatusCode();
+  if (!FetchUtils::isOkStatus(statusCode)) {
     errorDescription = "Response for preflight has invalid HTTP status code " +
-                       String::number(response.httpStatusCode());
+                       String::number(statusCode);
     return false;
   }
 
diff --git a/third_party/WebKit/Source/core/fetch/FetchUtils.h b/third_party/WebKit/Source/core/fetch/FetchUtils.h
index 31657670..07c272c6 100644
--- a/third_party/WebKit/Source/core/fetch/FetchUtils.h
+++ b/third_party/WebKit/Source/core/fetch/FetchUtils.h
@@ -32,6 +32,11 @@
                                          const HTTPHeaderMap&);
   static AtomicString normalizeMethod(const AtomicString& method);
   static String normalizeHeaderValue(const String& value);
+
+  // https://fetch.spec.whatwg.org/#ok-status aka a successful 2xx status
+  // code, https://tools.ietf.org/html/rfc7231#section-6.3 . We opt to use
+  // the Fetch term in naming the predicate.
+  static bool isOkStatus(int status) { return status >= 200 && status < 300; }
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index a174e715..fbcca36 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -1445,8 +1445,7 @@
   if (section) {
     unsigned effCol =
         absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex());
-    LayoutTableSection::CellStruct& aboveCell = section->cellAt(rAbove, effCol);
-    return aboveCell.primaryCell();
+    return section->primaryCellAt(rAbove, effCol);
   }
   return nullptr;
 }
@@ -1472,8 +1471,7 @@
   if (section) {
     unsigned effCol =
         absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex());
-    LayoutTableSection::CellStruct& belowCell = section->cellAt(rBelow, effCol);
-    return belowCell.primaryCell();
+    return section->primaryCellAt(rBelow, effCol);
   }
   return nullptr;
 }
@@ -1498,8 +1496,6 @@
 
   unsigned effCol = absoluteColumnToEffectiveColumn(
       cell->absoluteColumnIndex() + cell->colSpan());
-  if (effCol >= numEffectiveColumns())
-    return nullptr;
   return cell->section()->primaryCellAt(cell->rowIndex(), effCol);
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
index 743943848..603f7c35 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
@@ -210,18 +210,6 @@
   LayoutTableBoxComponent::addChild(child, beforeChild);
 }
 
-void LayoutTableSection::ensureRows(unsigned numRows) {
-  if (numRows <= m_grid.size())
-    return;
-
-  unsigned oldSize = m_grid.size();
-  m_grid.grow(numRows);
-
-  unsigned effectiveColumnCount = std::max(1u, table()->numEffectiveColumns());
-  for (unsigned row = oldSize; row < m_grid.size(); ++row)
-    m_grid[row].row.grow(effectiveColumnCount);
-}
-
 static inline void checkThatVectorIsDOMOrdered(
     const Vector<LayoutTableCell*, 1>& cells) {
 #ifndef NDEBUG
@@ -261,7 +249,6 @@
   unsigned cSpan = cell->colSpan();
   const Vector<LayoutTable::ColumnStruct>& columns =
       table()->effectiveColumns();
-  unsigned nCols = columns.size();
   unsigned insertionRow = row->rowIndex();
 
   // ### mozilla still seems to do the old HTML way, even for strict DTD
@@ -271,8 +258,9 @@
   // <TR><TD>1 <TD rowspan="2">2 <TD>3 <TD>4
   // <TR><TD colspan="2">5
   // </TABLE>
-  while (m_cCol < nCols && (cellAt(insertionRow, m_cCol).hasCells() ||
-                            cellAt(insertionRow, m_cCol).inColSpan))
+  while (m_cCol < numCols(insertionRow) &&
+         (cellAt(insertionRow, m_cCol).hasCells() ||
+          cellAt(insertionRow, m_cCol).inColSpan))
     m_cCol++;
 
   updateLogicalHeightForCell(m_grid[insertionRow], cell);
@@ -286,7 +274,7 @@
   bool inColSpan = false;
   while (cSpan) {
     unsigned currentSpan;
-    if (m_cCol >= nCols) {
+    if (m_cCol >= columns.size()) {
       table()->appendEffectiveColumn(cSpan);
       currentSpan = cSpan;
     } else {
@@ -295,6 +283,7 @@
       currentSpan = columns[m_cCol].span;
     }
     for (unsigned r = 0; r < rSpan; r++) {
+      ensureCols(insertionRow + r, m_cCol + 1);
       CellStruct& c = cellAt(insertionRow + r, m_cCol);
       ASSERT(cell);
       c.cells.append(cell);
@@ -1139,7 +1128,6 @@
   setLogicalWidth(table()->contentLogicalWidth());
 
   int vspacing = table()->vBorderSpacing();
-  unsigned nEffCols = table()->numEffectiveColumns();
   LayoutState state(*this);
 
   // Set the rows' location and size.
@@ -1164,7 +1152,7 @@
   for (unsigned r = 0; r < totalRows; r++) {
     LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject;
 
-    for (unsigned c = 0; c < nEffCols; c++) {
+    for (unsigned c = 0; c < numCols(r); c++) {
       CellStruct& cs = cellAt(r, c);
       LayoutTableCell* cell = cs.primaryCell();
 
@@ -1228,7 +1216,7 @@
 
   setLogicalHeight(LayoutUnit(m_rowPos[totalRows]));
 
-  computeOverflowFromCells(totalRows, nEffCols);
+  computeOverflowFromCells(totalRows, table()->numEffectiveColumns());
 }
 
 int LayoutTableSection::paginationStrutForRow(LayoutTableRow* row,
@@ -1284,7 +1272,7 @@
 #endif
   // Now that our height has been determined, add in overflow from cells.
   for (unsigned r = 0; r < totalRows; r++) {
-    for (unsigned c = 0; c < nEffCols; c++) {
+    for (unsigned c = 0; c < numCols(r); c++) {
       CellStruct& cs = cellAt(r, c);
       LayoutTableCell* cell = cs.primaryCell();
       if (!cell || cs.inColSpan)
@@ -1317,7 +1305,6 @@
   ASSERT(childNeedsOverflowRecalcAfterStyleChange());
   clearChildNeedsOverflowRecalcAfterStyleChange();
   unsigned totalRows = m_grid.size();
-  unsigned numEffCols = table()->numEffectiveColumns();
   bool childrenOverflowChanged = false;
   for (unsigned r = 0; r < totalRows; r++) {
     LayoutTableRow* rowLayouter = rowLayoutObjectAt(r);
@@ -1326,7 +1313,7 @@
       continue;
     rowLayouter->clearChildNeedsOverflowRecalcAfterStyleChange();
     bool rowChildrenOverflowChanged = false;
-    for (unsigned c = 0; c < numEffCols; c++) {
+    for (unsigned c = 0; c < numCols(r); c++) {
       CellStruct& cs = cellAt(r, c);
       LayoutTableCell* cell = cs.primaryCell();
       if (!cell || cs.inColSpan || !cell->needsOverflowRecalcAfterStyleChange())
@@ -1339,7 +1326,7 @@
   }
   // TODO(crbug.com/604136): Add visual overflow from rows too.
   if (childrenOverflowChanged)
-    computeOverflowFromCells(totalRows, numEffCols);
+    computeOverflowFromCells(totalRows, table()->numEffectiveColumns());
   return childrenOverflowChanged;
 }
 
@@ -1357,8 +1344,7 @@
 
 int LayoutTableSection::calcBlockDirectionOuterBorder(
     BlockBorderSide side) const {
-  unsigned totalCols = table()->numEffectiveColumns();
-  if (!m_grid.size() || !totalCols)
+  if (!m_grid.size() || !table()->numEffectiveColumns())
     return 0;
 
   int borderWidth = 0;
@@ -1379,9 +1365,9 @@
     borderWidth = rb.width();
 
   bool allHidden = true;
-  for (unsigned c = 0; c < totalCols; c++) {
-    const CellStruct& current =
-        cellAt(side == BorderBefore ? 0 : m_grid.size() - 1, c);
+  unsigned r = side == BorderBefore ? 0 : m_grid.size() - 1;
+  for (unsigned c = 0; c < numCols(r); c++) {
+    const CellStruct& current = cellAt(r, c);
     if (current.inColSpan || !current.hasCells())
       continue;
     const ComputedStyle& primaryCellStyle = current.primaryCell()->styleRef();
@@ -1448,6 +1434,8 @@
 
   bool allHidden = true;
   for (unsigned r = 0; r < m_grid.size(); r++) {
+    if (colIndex >= numCols(r))
+      continue;
     const CellStruct& current = cellAt(r, colIndex);
     if (!current.hasCells())
       continue;
@@ -1699,7 +1687,7 @@
   unsigned result = 0;
 
   for (unsigned r = 0; r < m_grid.size(); ++r) {
-    for (unsigned c = result; c < table()->numEffectiveColumns(); ++c) {
+    for (unsigned c = result; c < numCols(r); ++c) {
       const CellStruct& cell = cellAt(r, c);
       if (cell.hasCells() || cell.inColSpan)
         result = c;
@@ -1727,14 +1715,14 @@
     const {
   unsigned adjoiningStartCellColumnIndex =
       hasSameDirectionAs(table()) ? 0 : table()->lastEffectiveColumnIndex();
-  return cellAt(0, adjoiningStartCellColumnIndex).primaryCell();
+  return primaryCellAt(0, adjoiningStartCellColumnIndex);
 }
 
 const LayoutTableCell* LayoutTableSection::firstRowCellAdjoiningTableEnd()
     const {
   unsigned adjoiningEndCellColumnIndex =
       hasSameDirectionAs(table()) ? table()->lastEffectiveColumnIndex() : 0;
-  return cellAt(0, adjoiningEndCellColumnIndex).primaryCell();
+  return primaryCellAt(0, adjoiningEndCellColumnIndex);
 }
 
 void LayoutTableSection::appendEffectiveColumn(unsigned pos) {
@@ -1751,6 +1739,7 @@
     m_cCol++;
   for (unsigned row = 0; row < m_grid.size(); ++row) {
     Row& r = m_grid[row].row;
+    ensureCols(row, pos + 2);
     r.insert(pos + 1, CellStruct());
     if (r[pos].hasCells()) {
       r[pos + 1].cells.appendVector(r[pos].cells);
@@ -1818,6 +1807,9 @@
   for (unsigned hitRow = rowSpan.start(); hitRow < rowSpan.end(); ++hitRow) {
     for (unsigned hitColumn = columnSpan.start(); hitColumn < columnSpan.end();
          ++hitColumn) {
+      if (hitColumn >= numCols(hitRow))
+        break;
+
       CellStruct& current = cellAt(hitRow, hitColumn);
 
       // If the cell is empty, there's nothing to do
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.h b/third_party/WebKit/Source/core/layout/LayoutTableSection.h
index 916aab9..52e5d5d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableSection.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.h
@@ -218,6 +218,8 @@
     return m_grid[row].row[effectiveColumn];
   }
   LayoutTableCell* primaryCellAt(unsigned row, unsigned effectiveColumn) {
+    if (effectiveColumn >= numCols(row))
+      return nullptr;
     CellStruct& c = m_grid[row].row[effectiveColumn];
     return c.primaryCell();
   }
@@ -227,6 +229,8 @@
         row, effectiveColumn);
   }
 
+  unsigned numCols(unsigned row) const { return m_grid[row].row.size(); }
+
   // Returns null for cells with a rowspan that exceed the last row. Possibly
   // others.
   LayoutTableRow* rowLayoutObjectAt(unsigned row) {
@@ -345,7 +349,15 @@
     return m_grid[row].rowLayoutObject ? table()->vBorderSpacing() : 0;
   }
 
-  void ensureRows(unsigned);
+  void ensureRows(unsigned numRows) {
+    if (numRows > m_grid.size())
+      m_grid.grow(numRows);
+  }
+
+  void ensureCols(unsigned rowIndex, unsigned numCols) {
+    if (numCols > this->numCols(rowIndex))
+      m_grid[rowIndex].row.grow(numCols);
+  }
 
   bool rowHasOnlySpanningCells(unsigned);
   unsigned calcRowHeightHavingOnlySpanningCells(unsigned,
diff --git a/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp b/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
index a03ee32..0c4c42d5 100644
--- a/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
+++ b/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
@@ -55,6 +55,8 @@
       LayoutTableSection* section = toLayoutTableSection(child);
       unsigned numRows = section->numRows();
       for (unsigned i = 0; i < numRows; i++) {
+        if (effCol >= section->numCols(i))
+          continue;
         LayoutTableSection::CellStruct current = section->cellAt(i, effCol);
         LayoutTableCell* cell = current.primaryCell();
 
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index ee4a229..b9ad383 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -35,6 +35,7 @@
 #include "core/events/Event.h"
 #include "core/fetch/FetchInitiatorTypeNames.h"
 #include "core/fetch/FetchRequest.h"
+#include "core/fetch/FetchUtils.h"
 #include "core/fetch/MemoryCache.h"
 #include "core/fetch/ResourceFetcher.h"
 #include "core/frame/Deprecation.h"
@@ -504,11 +505,9 @@
     return;
   }
 
-  if (m_response.isHTTP()) {
-    int status = m_response.httpStatusCode();
-    if ((status < 200 || status >= 300) && m_frame->owner())
-      m_frame->owner()->renderFallbackContent();
-  }
+  if (m_frame->owner() && m_response.isHTTP() &&
+      !FetchUtils::isOkStatus(m_response.httpStatusCode()))
+    m_frame->owner()->renderFallbackContent();
 }
 
 void DocumentLoader::ensureWriter(const AtomicString& mimeType,
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
index 4b8f039..f9e7945 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -191,9 +191,8 @@
     unsigned row = r - 1;
     for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) {
       unsigned col = c - 1;
-      const LayoutTableSection::CellStruct& current =
-          m_layoutTableSection.cellAt(row, col);
-      const LayoutTableCell* cell = current.primaryCell();
+      const LayoutTableCell* cell =
+          m_layoutTableSection.primaryCellAt(row, col);
       if (!cell || (row > dirtiedRows.start() &&
                     m_layoutTableSection.primaryCellAt(row - 1, col) == cell) ||
           (col > dirtiedColumns.start() &&
@@ -304,6 +303,8 @@
         TableRowPainter(*row).paintOutline(paintInfoForDescendants,
                                            paintOffset);
       for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
+        if (c >= m_layoutTableSection.numCols(r))
+          break;
         const LayoutTableSection::CellStruct& current =
             m_layoutTableSection.cellAt(r, c);
         for (LayoutTableCell* cell : current.cells) {
diff --git a/third_party/WebKit/Source/core/timing/Performance.cpp b/third_party/WebKit/Source/core/timing/Performance.cpp
index 5e513e62..6837afa 100644
--- a/third_party/WebKit/Source/core/timing/Performance.cpp
+++ b/third_party/WebKit/Source/core/timing/Performance.cpp
@@ -104,9 +104,6 @@
       ContextLifecycleObserver(frame ? frame->document() : nullptr) {}
 
 Performance::~Performance() {
-  // contextDestryoed() should have been called and the performance
-  // monitors should have been unsubscribed.
-  DCHECK(!frame());
 }
 
 void Performance::contextDestroyed() {
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 274b2822..65b3bdc 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -78,6 +78,7 @@
 #include "platform/weborigin/Suborigin.h"
 #include "public/platform/WebURLRequest.h"
 #include "wtf/Assertions.h"
+#include "wtf/AutoReset.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/CString.h"
 #include <memory>
@@ -1604,26 +1605,22 @@
                                                 this, m_method, m_url);
 
   if (m_loader) {
-    const bool hasError = m_error;
     // Set |m_error| in order to suppress the cancel notification (see
     // XMLHttpRequest::didFail).
-    m_error = true;
-    m_loader->cancel();
-    m_error = hasError;
-    m_loader = nullptr;
+    AutoReset<bool> scope(&m_error, true);
+    m_loader.release()->cancel();
   }
 
   m_sendFlag = false;
   changeState(kDone);
 
-  if (!getExecutionContext() || !getExecutionContext()->isDocument() ||
-      !document() || !document()->frame() || !document()->frame()->page())
+  if (!getExecutionContext() || !getExecutionContext()->isDocument())
     return;
 
-  if (status() >= 200 && status() < 300) {
+  if (document() && document()->frame() && document()->frame()->page() &&
+      FetchUtils::isOkStatus(status()))
     document()->frame()->page()->chromeClient().ajaxSucceeded(
         document()->frame());
-  }
 }
 
 void XMLHttpRequest::didSendData(unsigned long long bytesSent,
diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp
index 1b07629..8cf4e8b 100644
--- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp
+++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.cpp
@@ -5,6 +5,7 @@
 #include "modules/beacon/NavigatorBeacon.h"
 
 #include "bindings/core/v8/ExceptionState.h"
+#include "bindings/core/v8/ScriptState.h"
 #include "bindings/modules/v8/ArrayBufferViewOrBlobOrStringOrFormData.h"
 #include "core/dom/DOMArrayBufferView.h"
 #include "core/dom/ExceptionCode.h"
@@ -94,13 +95,14 @@
 }
 
 bool NavigatorBeacon::sendBeacon(
-    ExecutionContext* context,
+    ScriptState* scriptState,
     Navigator& navigator,
     const String& urlstring,
     const ArrayBufferViewOrBlobOrStringOrFormData& data,
     ExceptionState& exceptionState) {
   NavigatorBeacon& impl = NavigatorBeacon::from(navigator);
 
+  ExecutionContext* context = scriptState->getExecutionContext();
   KURL url = context->completeURL(urlstring);
   if (!impl.canSendBeacon(context, url, exceptionState))
     return false;
diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h
index 52b2f9c1..c03d8e7 100644
--- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h
+++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.h
@@ -12,8 +12,8 @@
 
 namespace blink {
 
+class ScriptState;
 class ExceptionState;
-class ExecutionContext;
 class KURL;
 class ArrayBufferViewOrBlobOrStringOrFormData;
 
@@ -26,7 +26,7 @@
   static NavigatorBeacon& from(Navigator&);
   virtual ~NavigatorBeacon();
 
-  static bool sendBeacon(ExecutionContext*,
+  static bool sendBeacon(ScriptState*,
                          Navigator&,
                          const String&,
                          const ArrayBufferViewOrBlobOrStringOrFormData&,
diff --git a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.idl b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.idl
index ca3cb07..8795ec8 100644
--- a/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.idl
+++ b/third_party/WebKit/Source/modules/beacon/NavigatorBeacon.idl
@@ -5,5 +5,5 @@
 // https://w3c.github.io/beacon/#sec-sendBeacon-method
 
 partial interface Navigator {
-    [CallWith=ExecutionContext, MeasureAs=SendBeacon, RaisesException] boolean sendBeacon(DOMString url, optional (ArrayBufferView or Blob or DOMString or FormData)? data = null);
+    [CallWith=ScriptState, MeasureAs=SendBeacon, RaisesException] boolean sendBeacon(DOMString url, optional (ArrayBufferView or Blob or DOMString or FormData)? data = null);
 };
diff --git a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
index 39e8daa..3937edec 100644
--- a/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
+++ b/third_party/WebKit/Source/modules/fetch/FetchManager.cpp
@@ -556,7 +556,7 @@
   m_finished = true;
 
   if (document() && document()->frame() && document()->frame()->page() &&
-      m_responseHttpStatusCode >= 200 && m_responseHttpStatusCode < 300) {
+      FetchUtils::isOkStatus(m_responseHttpStatusCode)) {
     document()->frame()->page()->chromeClient().ajaxSucceeded(
         document()->frame());
   }
diff --git a/third_party/WebKit/Source/modules/fetch/Response.cpp b/third_party/WebKit/Source/modules/fetch/Response.cpp
index 7ce8bc0..6cae459a 100644
--- a/third_party/WebKit/Source/modules/fetch/Response.cpp
+++ b/third_party/WebKit/Source/modules/fetch/Response.cpp
@@ -17,6 +17,7 @@
 #include "core/dom/DOMArrayBuffer.h"
 #include "core/dom/DOMArrayBufferView.h"
 #include "core/dom/URLSearchParams.h"
+#include "core/fetch/FetchUtils.h"
 #include "core/fileapi/Blob.h"
 #include "core/html/FormData.h"
 #include "core/streams/ReadableStreamOperations.h"
@@ -299,19 +300,19 @@
   return new Response(scriptState->getExecutionContext(), responseData);
 }
 
-Response* Response::error(ExecutionContext* context) {
+Response* Response::error(ScriptState* scriptState) {
   FetchResponseData* responseData =
       FetchResponseData::createNetworkErrorResponse();
-  Response* r = new Response(context, responseData);
+  Response* r = new Response(scriptState->getExecutionContext(), responseData);
   r->m_headers->setGuard(Headers::ImmutableGuard);
   return r;
 }
 
-Response* Response::redirect(ExecutionContext* context,
+Response* Response::redirect(ScriptState* scriptState,
                              const String& url,
                              unsigned short status,
                              ExceptionState& exceptionState) {
-  KURL parsedURL = context->completeURL(url);
+  KURL parsedURL = scriptState->getExecutionContext()->completeURL(url);
   if (!parsedURL.isValid()) {
     exceptionState.throwTypeError("Failed to parse URL from " + url);
     return nullptr;
@@ -322,7 +323,7 @@
     return nullptr;
   }
 
-  Response* r = new Response(context);
+  Response* r = new Response(scriptState->getExecutionContext());
   r->m_headers->setGuard(Headers::ImmutableGuard);
   r->m_response->setStatus(status);
   r->m_response->headerList()->set("Location", parsedURL);
@@ -376,7 +377,7 @@
 bool Response::ok() const {
   // "The ok attribute's getter must return true
   // if response's status is in the range 200 to 299, and false otherwise."
-  return 200 <= status() && status() <= 299;
+  return FetchUtils::isOkStatus(status());
 }
 
 String Response::statusText() const {
diff --git a/third_party/WebKit/Source/modules/fetch/Response.h b/third_party/WebKit/Source/modules/fetch/Response.h
index 30258dd..370c168 100644
--- a/third_party/WebKit/Source/modules/fetch/Response.h
+++ b/third_party/WebKit/Source/modules/fetch/Response.h
@@ -49,8 +49,8 @@
 
   static Response* createClone(const Response&);
 
-  static Response* error(ExecutionContext*);
-  static Response* redirect(ExecutionContext*,
+  static Response* error(ScriptState*);
+  static Response* redirect(ScriptState*,
                             const String& url,
                             unsigned short status,
                             ExceptionState&);
diff --git a/third_party/WebKit/Source/modules/fetch/Response.idl b/third_party/WebKit/Source/modules/fetch/Response.idl
index c7d373ec..91db9f7 100644
--- a/third_party/WebKit/Source/modules/fetch/Response.idl
+++ b/third_party/WebKit/Source/modules/fetch/Response.idl
@@ -16,8 +16,8 @@
     Exposed=(Window,Worker),
     RaisesException=Constructor,
 ] interface Response {
-    [CallWith=ExecutionContext] static Response error();
-    [CallWith=ExecutionContext, RaisesException] static Response redirect(USVString url, optional unsigned short status = 302);
+    [CallWith=ScriptState] static Response error();
+    [CallWith=ScriptState, RaisesException] static Response redirect(USVString url, optional unsigned short status = 302);
     readonly attribute ResponseType type;
     readonly attribute USVString url;
     readonly attribute boolean redirected;
diff --git a/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.cpp
index 46b4fec..1b785c1 100644
--- a/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.cpp
@@ -30,10 +30,10 @@
 
 #include "modules/filesystem/DataTransferItemFileSystem.h"
 
+#include "bindings/core/v8/ScriptState.h"
 #include "core/clipboard/DataObject.h"
 #include "core/clipboard/DataTransfer.h"
 #include "core/clipboard/DataTransferItem.h"
-#include "core/dom/ExecutionContext.h"
 #include "core/fileapi/File.h"
 #include "modules/filesystem/DOMFilePath.h"
 #include "modules/filesystem/DOMFileSystem.h"
@@ -47,9 +47,8 @@
 namespace blink {
 
 // static
-Entry* DataTransferItemFileSystem::webkitGetAsEntry(
-    ExecutionContext* executionContext,
-    DataTransferItem& item) {
+Entry* DataTransferItemFileSystem::webkitGetAsEntry(ScriptState* scriptState,
+                                                    DataTransferItem& item) {
   if (!item.getDataObjectItem()->isFilename())
     return 0;
 
@@ -62,8 +61,8 @@
 
   DOMFileSystem* domFileSystem =
       DraggedIsolatedFileSystemImpl::getDOMFileSystem(
-          item.getDataTransfer()->dataObject(), executionContext,
-          *item.getDataObjectItem());
+          item.getDataTransfer()->dataObject(),
+          scriptState->getExecutionContext(), *item.getDataObjectItem());
   if (!domFileSystem) {
     // IsolatedFileSystem may not be enabled.
     return 0;
diff --git a/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.h b/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.h
index 30b97a2a..45b96ad0 100644
--- a/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.h
+++ b/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.h
@@ -38,13 +38,13 @@
 
 class DataTransferItem;
 class Entry;
-class ExecutionContext;
+class ScriptState;
 
 class DataTransferItemFileSystem {
   STATIC_ONLY(DataTransferItemFileSystem);
 
  public:
-  static Entry* webkitGetAsEntry(ExecutionContext*, DataTransferItem&);
+  static Entry* webkitGetAsEntry(ScriptState*, DataTransferItem&);
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.idl b/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.idl
index 09cd3ea..10f5bd56 100644
--- a/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.idl
+++ b/third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.idl
@@ -31,5 +31,5 @@
 // https://wicg.github.io/entries-api/#html-data
 
 partial interface DataTransferItem {
-    [CallWith=ExecutionContext, Measure] Entry? webkitGetAsEntry();
+    [CallWith=ScriptState, Measure] Entry? webkitGetAsEntry();
 };
diff --git a/third_party/WebKit/Source/modules/filesystem/Entry.cpp b/third_party/WebKit/Source/modules/filesystem/Entry.cpp
index 68dc6bf..b3bbbe81 100644
--- a/third_party/WebKit/Source/modules/filesystem/Entry.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/Entry.cpp
@@ -29,7 +29,7 @@
  */
 #include "modules/filesystem/Entry.h"
 
-#include "core/dom/ExecutionContext.h"
+#include "bindings/core/v8/ScriptState.h"
 #include "core/fileapi/FileError.h"
 #include "core/frame/UseCounter.h"
 #include "core/html/VoidCallback.h"
@@ -46,71 +46,71 @@
 Entry::Entry(DOMFileSystemBase* fileSystem, const String& fullPath)
     : EntryBase(fileSystem, fullPath) {}
 
-DOMFileSystem* Entry::filesystem(ExecutionContext* context) const {
+DOMFileSystem* Entry::filesystem(ScriptState* scriptState) const {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
     UseCounter::count(
-        context,
+        scriptState->getExecutionContext(),
         UseCounter::Entry_Filesystem_AttributeGetter_IsolatedFileSystem);
   return filesystem();
 }
 
-void Entry::getMetadata(ExecutionContext* context,
+void Entry::getMetadata(ScriptState* scriptState,
                         MetadataCallback* successCallback,
                         ErrorCallback* errorCallback) {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
-    UseCounter::count(context,
+    UseCounter::count(scriptState->getExecutionContext(),
                       UseCounter::Entry_GetMetadata_Method_IsolatedFileSystem);
   m_fileSystem->getMetadata(this, successCallback,
                             ScriptErrorCallback::wrap(errorCallback));
 }
 
-void Entry::moveTo(ExecutionContext* context,
+void Entry::moveTo(ScriptState* scriptState,
                    DirectoryEntry* parent,
                    const String& name,
                    EntryCallback* successCallback,
                    ErrorCallback* errorCallback) const {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
-    UseCounter::count(context,
+    UseCounter::count(scriptState->getExecutionContext(),
                       UseCounter::Entry_MoveTo_Method_IsolatedFileSystem);
   m_fileSystem->move(this, parent, name, successCallback,
                      ScriptErrorCallback::wrap(errorCallback));
 }
 
-void Entry::copyTo(ExecutionContext* context,
+void Entry::copyTo(ScriptState* scriptState,
                    DirectoryEntry* parent,
                    const String& name,
                    EntryCallback* successCallback,
                    ErrorCallback* errorCallback) const {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
-    UseCounter::count(context,
+    UseCounter::count(scriptState->getExecutionContext(),
                       UseCounter::Entry_CopyTo_Method_IsolatedFileSystem);
   m_fileSystem->copy(this, parent, name, successCallback,
                      ScriptErrorCallback::wrap(errorCallback));
 }
 
-void Entry::remove(ExecutionContext* context,
+void Entry::remove(ScriptState* scriptState,
                    VoidCallback* successCallback,
                    ErrorCallback* errorCallback) const {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
-    UseCounter::count(context,
+    UseCounter::count(scriptState->getExecutionContext(),
                       UseCounter::Entry_Remove_Method_IsolatedFileSystem);
   m_fileSystem->remove(this, successCallback,
                        ScriptErrorCallback::wrap(errorCallback));
 }
 
-void Entry::getParent(ExecutionContext* context,
+void Entry::getParent(ScriptState* scriptState,
                       EntryCallback* successCallback,
                       ErrorCallback* errorCallback) const {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
-    UseCounter::count(context,
+    UseCounter::count(scriptState->getExecutionContext(),
                       UseCounter::Entry_GetParent_Method_IsolatedFileSystem);
   m_fileSystem->getParent(this, successCallback,
                           ScriptErrorCallback::wrap(errorCallback));
 }
 
-String Entry::toURL(ExecutionContext* context) const {
+String Entry::toURL(ScriptState* scriptState) const {
   if (m_fileSystem->type() == FileSystemTypeIsolated)
-    UseCounter::count(context,
+    UseCounter::count(scriptState->getExecutionContext(),
                       UseCounter::Entry_ToURL_Method_IsolatedFileSystem);
   return static_cast<const EntryBase*>(this)->toURL();
 }
diff --git a/third_party/WebKit/Source/modules/filesystem/Entry.h b/third_party/WebKit/Source/modules/filesystem/Entry.h
index 8778a47..04bb051 100644
--- a/third_party/WebKit/Source/modules/filesystem/Entry.h
+++ b/third_party/WebKit/Source/modules/filesystem/Entry.h
@@ -52,28 +52,28 @@
   DOMFileSystem* filesystem() const {
     return static_cast<DOMFileSystem*>(m_fileSystem.get());
   }
-  DOMFileSystem* filesystem(ExecutionContext*) const;
+  DOMFileSystem* filesystem(ScriptState*) const;
 
-  void getMetadata(ExecutionContext*,
+  void getMetadata(ScriptState*,
                    MetadataCallback* successCallback = nullptr,
                    ErrorCallback* = nullptr);
-  void moveTo(ExecutionContext*,
+  void moveTo(ScriptState*,
               DirectoryEntry* parent,
               const String& name = String(),
               EntryCallback* successCallback = nullptr,
               ErrorCallback* = nullptr) const;
-  void copyTo(ExecutionContext*,
+  void copyTo(ScriptState*,
               DirectoryEntry* parent,
               const String& name = String(),
               EntryCallback* successCallback = nullptr,
               ErrorCallback* = nullptr) const;
-  void remove(ExecutionContext*,
+  void remove(ScriptState*,
               VoidCallback* successCallback = nullptr,
               ErrorCallback* = nullptr) const;
-  void getParent(ExecutionContext*,
+  void getParent(ScriptState*,
                  EntryCallback* successCallback = nullptr,
                  ErrorCallback* = nullptr) const;
-  String toURL(ExecutionContext*) const;
+  String toURL(ScriptState*) const;
 
   DECLARE_VIRTUAL_TRACE();
 
diff --git a/third_party/WebKit/Source/modules/filesystem/Entry.idl b/third_party/WebKit/Source/modules/filesystem/Entry.idl
index 312fb89..bf2025d 100644
--- a/third_party/WebKit/Source/modules/filesystem/Entry.idl
+++ b/third_party/WebKit/Source/modules/filesystem/Entry.idl
@@ -35,12 +35,12 @@
     readonly attribute boolean isDirectory;
     readonly attribute DOMString name;
     readonly attribute DOMString fullPath;
-    [CallWith=ExecutionContext] readonly attribute DOMFileSystem filesystem;
+    [CallWith=ScriptState] readonly attribute DOMFileSystem filesystem;
 
-    [CallWith=ExecutionContext] void getMetadata(MetadataCallback successCallback, optional ErrorCallback errorCallback);
-    [CallWith=ExecutionContext] void moveTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
-    [CallWith=ExecutionContext] void copyTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
-    [CallWith=ExecutionContext] DOMString toURL();
-    [CallWith=ExecutionContext] void remove(VoidCallback successCallback, optional ErrorCallback errorCallback);
-    [CallWith=ExecutionContext] void getParent(optional EntryCallback successCallback, optional ErrorCallback errorCallback);
+    [CallWith=ScriptState] void getMetadata(MetadataCallback successCallback, optional ErrorCallback errorCallback);
+    [CallWith=ScriptState] void moveTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
+    [CallWith=ScriptState] void copyTo(DirectoryEntry parent, optional DOMString? name, optional EntryCallback successCallback, optional ErrorCallback errorCallback);
+    [CallWith=ScriptState] DOMString toURL();
+    [CallWith=ScriptState] void remove(VoidCallback successCallback, optional ErrorCallback errorCallback);
+    [CallWith=ScriptState] void getParent(optional EntryCallback successCallback, optional ErrorCallback errorCallback);
 };
diff --git a/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.cpp
index b9d8cab2..ca6255b 100644
--- a/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.cpp
@@ -30,6 +30,7 @@
 
 #include "modules/filesystem/HTMLInputElementFileSystem.h"
 
+#include "bindings/core/v8/ScriptState.h"
 #include "core/fileapi/FileList.h"
 #include "core/html/HTMLInputElement.h"
 #include "modules/filesystem/DOMFilePath.h"
@@ -44,7 +45,7 @@
 
 // static
 EntryHeapVector HTMLInputElementFileSystem::webkitEntries(
-    ExecutionContext* executionContext,
+    ScriptState* scriptState,
     HTMLInputElement& input) {
   EntryHeapVector entries;
   FileList* files = input.files();
@@ -53,7 +54,7 @@
     return entries;
 
   DOMFileSystem* filesystem = DOMFileSystem::createIsolatedFileSystem(
-      executionContext, input.droppedFileSystemId());
+      scriptState->getExecutionContext(), input.droppedFileSystemId());
   if (!filesystem) {
     // Drag-drop isolated filesystem is not available.
     return entries;
diff --git a/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.h b/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.h
index b3baa84..817f617c 100644
--- a/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.h
+++ b/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.h
@@ -37,13 +37,13 @@
 namespace blink {
 
 class HTMLInputElement;
-class ExecutionContext;
+class ScriptState;
 
 class HTMLInputElementFileSystem {
   STATIC_ONLY(HTMLInputElementFileSystem);
 
  public:
-  static EntryHeapVector webkitEntries(ExecutionContext*, HTMLInputElement&);
+  static EntryHeapVector webkitEntries(ScriptState*, HTMLInputElement&);
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.idl b/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.idl
index 2422250..9b76ca4 100644
--- a/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.idl
+++ b/third_party/WebKit/Source/modules/filesystem/HTMLInputElementFileSystem.idl
@@ -34,5 +34,5 @@
     RuntimeEnabled=FileSystem,
 ] partial interface HTMLInputElement {
     // TODO(jsbell): |webkitEntries| should be FrozenArray<Entry>.
-    [CallWith=ExecutionContext, Measure] readonly attribute Entry[] webkitEntries;
+    [CallWith=ScriptState, Measure] readonly attribute Entry[] webkitEntries;
 };
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.cpp
index 2b731dc8..98c6f88 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.cpp
@@ -89,11 +89,11 @@
   return IDBKeyRange::create(key, key, LowerBoundClosed, UpperBoundClosed);
 }
 
-IDBKeyRange* IDBKeyRange::only(ExecutionContext* context,
+IDBKeyRange* IDBKeyRange::only(ScriptState* scriptState,
                                const ScriptValue& keyValue,
                                ExceptionState& exceptionState) {
-  IDBKey* key =
-      ScriptValue::to<IDBKey*>(toIsolate(context), keyValue, exceptionState);
+  IDBKey* key = ScriptValue::to<IDBKey*>(
+      toIsolate(scriptState->getExecutionContext()), keyValue, exceptionState);
   if (exceptionState.hadException())
     return nullptr;
   if (!key || !key->isValid()) {
@@ -105,12 +105,13 @@
   return IDBKeyRange::create(key, key, LowerBoundClosed, UpperBoundClosed);
 }
 
-IDBKeyRange* IDBKeyRange::lowerBound(ExecutionContext* context,
+IDBKeyRange* IDBKeyRange::lowerBound(ScriptState* scriptState,
                                      const ScriptValue& boundValue,
                                      bool open,
                                      ExceptionState& exceptionState) {
   IDBKey* bound =
-      ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exceptionState);
+      ScriptValue::to<IDBKey*>(toIsolate(scriptState->getExecutionContext()),
+                               boundValue, exceptionState);
   if (exceptionState.hadException())
     return nullptr;
   if (!bound || !bound->isValid()) {
@@ -123,12 +124,13 @@
       bound, nullptr, open ? LowerBoundOpen : LowerBoundClosed, UpperBoundOpen);
 }
 
-IDBKeyRange* IDBKeyRange::upperBound(ExecutionContext* context,
+IDBKeyRange* IDBKeyRange::upperBound(ScriptState* scriptState,
                                      const ScriptValue& boundValue,
                                      bool open,
                                      ExceptionState& exceptionState) {
   IDBKey* bound =
-      ScriptValue::to<IDBKey*>(toIsolate(context), boundValue, exceptionState);
+      ScriptValue::to<IDBKey*>(toIsolate(scriptState->getExecutionContext()),
+                               boundValue, exceptionState);
   if (exceptionState.hadException())
     return nullptr;
   if (!bound || !bound->isValid()) {
@@ -141,14 +143,15 @@
                              open ? UpperBoundOpen : UpperBoundClosed);
 }
 
-IDBKeyRange* IDBKeyRange::bound(ExecutionContext* context,
+IDBKeyRange* IDBKeyRange::bound(ScriptState* scriptState,
                                 const ScriptValue& lowerValue,
                                 const ScriptValue& upperValue,
                                 bool lowerOpen,
                                 bool upperOpen,
                                 ExceptionState& exceptionState) {
   IDBKey* lower =
-      ScriptValue::to<IDBKey*>(toIsolate(context), lowerValue, exceptionState);
+      ScriptValue::to<IDBKey*>(toIsolate(scriptState->getExecutionContext()),
+                               lowerValue, exceptionState);
   if (exceptionState.hadException())
     return nullptr;
   if (!lower || !lower->isValid()) {
@@ -158,7 +161,8 @@
   }
 
   IDBKey* upper =
-      ScriptValue::to<IDBKey*>(toIsolate(context), upperValue, exceptionState);
+      ScriptValue::to<IDBKey*>(toIsolate(scriptState->getExecutionContext()),
+                               upperValue, exceptionState);
   if (exceptionState.hadException())
     return nullptr;
   if (!upper || !upper->isValid()) {
@@ -184,11 +188,11 @@
                              upperOpen ? UpperBoundOpen : UpperBoundClosed);
 }
 
-bool IDBKeyRange::includes(ExecutionContext* context,
+bool IDBKeyRange::includes(ScriptState* scriptState,
                            const ScriptValue& keyValue,
                            ExceptionState& exceptionState) {
-  IDBKey* key =
-      ScriptValue::to<IDBKey*>(toIsolate(context), keyValue, exceptionState);
+  IDBKey* key = ScriptValue::to<IDBKey*>(
+      toIsolate(scriptState->getExecutionContext()), keyValue, exceptionState);
   if (exceptionState.hadException())
     return false;
   if (!key || !key->isValid()) {
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.h b/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.h
index 70f5c89..982bcef7 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.h
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.h
@@ -68,18 +68,18 @@
   bool lowerOpen() const { return m_lowerType == LowerBoundOpen; }
   bool upperOpen() const { return m_upperType == UpperBoundOpen; }
 
-  static IDBKeyRange* only(ExecutionContext*,
+  static IDBKeyRange* only(ScriptState*,
                            const ScriptValue& key,
                            ExceptionState&);
-  static IDBKeyRange* lowerBound(ExecutionContext*,
+  static IDBKeyRange* lowerBound(ScriptState*,
                                  const ScriptValue& bound,
                                  bool open,
                                  ExceptionState&);
-  static IDBKeyRange* upperBound(ExecutionContext*,
+  static IDBKeyRange* upperBound(ScriptState*,
                                  const ScriptValue& bound,
                                  bool open,
                                  ExceptionState&);
-  static IDBKeyRange* bound(ExecutionContext*,
+  static IDBKeyRange* bound(ScriptState*,
                             const ScriptValue& lower,
                             const ScriptValue& upper,
                             bool lowerOpen,
@@ -88,7 +88,7 @@
 
   static IDBKeyRange* only(IDBKey* value, ExceptionState&);
 
-  bool includes(ExecutionContext*, const ScriptValue& key, ExceptionState&);
+  bool includes(ScriptState*, const ScriptValue& key, ExceptionState&);
 
  private:
   IDBKeyRange(IDBKey* lower,
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.idl b/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.idl
index 0fbc7e14..aae8b02 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.idl
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBKeyRange.idl
@@ -33,10 +33,10 @@
     readonly attribute boolean lowerOpen;
     readonly attribute boolean upperOpen;
 
-    [CallWith=ExecutionContext, RaisesException] static IDBKeyRange only(any value);
-    [CallWith=ExecutionContext, RaisesException] static IDBKeyRange lowerBound(any bound, optional boolean open = false);
-    [CallWith=ExecutionContext, RaisesException] static IDBKeyRange upperBound(any bound, optional boolean open = false);
-    [CallWith=ExecutionContext, RaisesException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange only(any value);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange lowerBound(any bound, optional boolean open = false);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange upperBound(any bound, optional boolean open = false);
+    [CallWith=ScriptState, RaisesException] static IDBKeyRange bound(any lower, any upper, optional boolean lowerOpen = false, optional boolean upperOpen = false);
 
-    [CallWith=ExecutionContext, RaisesException] boolean includes(any key);
+    [CallWith=ScriptState, RaisesException] boolean includes(any key);
 };
diff --git a/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.cpp b/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.cpp
index 9424e32..8806925 100644
--- a/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.cpp
+++ b/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.cpp
@@ -38,8 +38,9 @@
 }
 
 NetworkInformation* WorkerNavigatorNetworkInformation::connection(
-    ExecutionContext* context,
+    ScriptState* scriptState,
     WorkerNavigator& navigator) {
+  ExecutionContext* context = scriptState->getExecutionContext();
   return WorkerNavigatorNetworkInformation::from(navigator, context)
       .connection(context);
 }
diff --git a/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.h b/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.h
index e118ee6e..17063485 100644
--- a/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.h
+++ b/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.h
@@ -10,8 +10,8 @@
 
 namespace blink {
 
-class ExecutionContext;
 class NetworkInformation;
+class ScriptState;
 class WorkerNavigator;
 
 class WorkerNavigatorNetworkInformation final
@@ -27,7 +27,7 @@
       ExecutionContext*);
   static const char* supplementName();
 
-  static NetworkInformation* connection(ExecutionContext*, WorkerNavigator&);
+  static NetworkInformation* connection(ScriptState*, WorkerNavigator&);
 
   DECLARE_VIRTUAL_TRACE();
 
diff --git a/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.idl b/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.idl
index b47c770..b66fc4e7 100644
--- a/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.idl
+++ b/third_party/WebKit/Source/modules/netinfo/WorkerNavigatorNetworkInformation.idl
@@ -6,5 +6,5 @@
     RuntimeEnabled=NetworkInformation,
     Exposed=Worker
 ] partial interface WorkerNavigator {
-    [CallWith=ExecutionContext, MeasureAs=NetInfo] readonly attribute NetworkInformation connection;
+    [CallWith=ScriptState, MeasureAs=NetInfo] readonly attribute NetworkInformation connection;
 };
diff --git a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp
index 76dff73..e5ed5d5 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.cpp
@@ -76,11 +76,8 @@
           scriptState->getExecutionContext(),
           this,
           PreloadResponseProperty::PreloadResponse)) {
-  if (!navigationPreloadSent) {
-    // TODO(horo): This behavior is still under the spec discussion.
-    // https://github.com/w3c/ServiceWorker/issues/920#issuecomment-255874864
-    m_preloadResponseProperty->resolve(nullptr);
-  }
+  if (!navigationPreloadSent)
+    m_preloadResponseProperty->resolveWithUndefined();
 
   m_clientId = initializer.clientId();
   m_isReload = initializer.isReload();
diff --git a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.idl b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.idl
index ef052c75..3d76d24 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.idl
+++ b/third_party/WebKit/Source/modules/serviceworkers/FetchEvent.idl
@@ -13,5 +13,5 @@
     readonly attribute boolean isReload;
 
     [CallWith=ScriptState, RaisesException] void respondWith(Promise<Response> r);
-    [RuntimeEnabled=ServiceWorkerNavigationPreload, CallWith=ScriptState] readonly attribute Promise<Response> preloadResponse;
+    [RuntimeEnabled=ServiceWorkerNavigationPreload, CallWith=ScriptState] readonly attribute Promise<any> preloadResponse;
 };
diff --git a/third_party/WebKit/Source/modules/speech/SpeechGrammarList.cpp b/third_party/WebKit/Source/modules/speech/SpeechGrammarList.cpp
index bcd4ee3b..efc49cae 100644
--- a/third_party/WebKit/Source/modules/speech/SpeechGrammarList.cpp
+++ b/third_party/WebKit/Source/modules/speech/SpeechGrammarList.cpp
@@ -25,6 +25,7 @@
 
 #include "modules/speech/SpeechGrammarList.h"
 
+#include "bindings/core/v8/ScriptState.h"
 #include "core/dom/Document.h"
 
 namespace blink {
@@ -40,10 +41,10 @@
   return m_grammars[index];
 }
 
-void SpeechGrammarList::addFromUri(ExecutionContext* executionContext,
+void SpeechGrammarList::addFromUri(ScriptState* scriptState,
                                    const String& src,
                                    double weight) {
-  Document* document = toDocument(executionContext);
+  Document* document = toDocument(scriptState->getExecutionContext());
   m_grammars.append(SpeechGrammar::create(document->completeURL(src), weight));
 }
 
diff --git a/third_party/WebKit/Source/modules/speech/SpeechGrammarList.h b/third_party/WebKit/Source/modules/speech/SpeechGrammarList.h
index 91ece05f..99f0498 100644
--- a/third_party/WebKit/Source/modules/speech/SpeechGrammarList.h
+++ b/third_party/WebKit/Source/modules/speech/SpeechGrammarList.h
@@ -33,7 +33,7 @@
 
 namespace blink {
 
-class ExecutionContext;
+class ScriptState;
 
 class MODULES_EXPORT SpeechGrammarList final
     : public GarbageCollected<SpeechGrammarList>,
@@ -46,7 +46,7 @@
   unsigned length() const { return m_grammars.size(); }
   SpeechGrammar* item(unsigned) const;
 
-  void addFromUri(ExecutionContext*, const String& src, double weight = 1.0);
+  void addFromUri(ScriptState*, const String& src, double weight = 1.0);
   void addFromString(const String&, double weight = 1.0);
 
   DECLARE_TRACE();
diff --git a/third_party/WebKit/Source/modules/speech/SpeechGrammarList.idl b/third_party/WebKit/Source/modules/speech/SpeechGrammarList.idl
index 59388b2..d5db1044 100644
--- a/third_party/WebKit/Source/modules/speech/SpeechGrammarList.idl
+++ b/third_party/WebKit/Source/modules/speech/SpeechGrammarList.idl
@@ -31,6 +31,6 @@
 ] interface SpeechGrammarList {
     readonly attribute unsigned long length;
     getter SpeechGrammar item(unsigned long index);
-    [CallWith=ExecutionContext] void addFromUri(DOMString src, optional float weight);
+    [CallWith=ScriptState] void addFromUri(DOMString src, optional float weight);
     void addFromString(DOMString string, optional float weight);
 };
diff --git a/third_party/WebKit/Source/platform/heap/WrapperVisitor.h b/third_party/WebKit/Source/platform/heap/WrapperVisitor.h
index d93767a..13de57b 100644
--- a/third_party/WebKit/Source/platform/heap/WrapperVisitor.h
+++ b/third_party/WebKit/Source/platform/heap/WrapperVisitor.h
@@ -91,6 +91,11 @@
 
  public:
   template <typename T>
+  static NEVER_INLINE void missedWriteBarrier() {
+    NOTREACHED();
+  }
+
+  template <typename T>
   void traceWrappers(const T* traceable) const {
     static_assert(sizeof(T), "T must be fully defined");
     static_assert(CanTraceWrappers<T>::value,
@@ -164,7 +169,8 @@
   template <typename T>
   void markAndPushToMarkingDeque(const T* traceable) const {
     if (pushToMarkingDeque(TraceTrait<T>::traceMarkedWrapper,
-                           TraceTrait<T>::heapObjectHeader, traceable)) {
+                           TraceTrait<T>::heapObjectHeader,
+                           WrapperVisitor::missedWriteBarrier<T>, traceable)) {
       TraceTrait<T>::markWrapperNoTracing(this, traceable);
     }
   }
@@ -174,6 +180,7 @@
   virtual bool pushToMarkingDeque(
       void (*traceWrappersCallback)(const WrapperVisitor*, const void*),
       HeapObjectHeader* (*heapObjectHeaderCallback)(const void*),
+      void (*missedWriteBarrierCallback)(void),
       const void*) const = 0;
 };
 
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index f190ac91..45e41f1 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -89,6 +89,7 @@
 #include "public/web/WebFrameContentDumper.h"
 #include "public/web/WebHitTestResult.h"
 #include "public/web/WebInputMethodController.h"
+#include "public/web/WebPrintParams.h"
 #include "public/web/WebScriptSource.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebTreeScopeType.h"
@@ -4299,4 +4300,33 @@
             *devToolsEmulator->visibleContentRectForPainting());
 }
 
+TEST_P(WebViewTest, ResizeForPrintingViewportUnits) {
+  WebViewImpl* webView = m_webViewHelper.initialize();
+  webView->resize(WebSize(800, 600));
+
+  WebURL baseURL = URLTestHelpers::toKURL("http://example.com/");
+  FrameTestHelpers::loadHTMLString(webView->mainFrame(),
+                                   "<style>#vw { width: 100vw }</style>"
+                                   "<div id=vw></div>",
+                                   baseURL);
+
+  WebLocalFrameImpl* frame = webView->mainFrameImpl();
+  Document* document = frame->frame()->document();
+  Element* vwElement = document->getElementById("vw");
+
+  EXPECT_EQ(800, vwElement->offsetWidth());
+
+  WebPrintParams printParams;
+  printParams.printContentArea.width = 500;
+  printParams.printContentArea.height = 500;
+
+  frame->printBegin(printParams, WebNode());
+  webView->resize(WebSize(500, 500));
+  EXPECT_EQ(500, vwElement->offsetWidth());
+
+  webView->resize(WebSize(800, 600));
+  frame->printEnd();
+  EXPECT_EQ(800, vwElement->offsetWidth());
+}
+
 }  // namespace blink
diff --git a/tools/perf/page_sets/system_health/browsing_stories.py b/tools/perf/page_sets/system_health/browsing_stories.py
index d4c691c7..fcc725a 100644
--- a/tools/perf/page_sets/system_health/browsing_stories.py
+++ b/tools/perf/page_sets/system_health/browsing_stories.py
@@ -392,8 +392,6 @@
   ITEM_SELECTOR_INDEX = 3
 
 
-# Failing during CQ runs. crbug.com/661775
-@decorators.Disabled('linux', 'win')
 class YouTubeDesktopStory(_MediaBrowsingStory):
   NAME = 'browse:media:youtube'
   URL = 'https://www.youtube.com/watch?v=QGfhS1hfTWw&autoplay=false'
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index 115dcb4..a3fd6ce 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -20,6 +20,7 @@
 #include "ui/views/controls/button/menu_button.h"
 #include "ui/views/controls/button/radio_button.h"
 #include "ui/views/controls/button/toggle_button.h"
+#include "ui/views/style/platform_style.h"
 #include "ui/views/widget/widget.h"
 
 #if defined(USE_AURA)
@@ -34,6 +35,16 @@
 // How long the hover animation takes if uninterrupted.
 const int kHoverFadeDurationMs = 150;
 
+CustomButton::KeyClickAction GetKeyClickActionForEvent(
+    const ui::KeyEvent& event) {
+  if (event.key_code() == ui::VKEY_SPACE)
+    return PlatformStyle::kKeyClickActionOnSpace;
+  if (event.key_code() == ui::VKEY_RETURN &&
+      PlatformStyle::kReturnClicksFocusedControl)
+    return CustomButton::CLICK_ON_KEY_PRESS;
+  return CustomButton::CLICK_NONE;
+}
+
 }  // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -238,31 +249,36 @@
   if (state_ == STATE_DISABLED)
     return false;
 
-  // Space sets button state to pushed. Enter clicks the button. This matches
-  // the Windows native behavior of buttons, where Space clicks the button on
-  // KeyRelease and Enter clicks the button on KeyPressed.
-  if (event.key_code() == ui::VKEY_SPACE) {
-    SetState(STATE_PRESSED);
-    if (GetInkDrop()->GetTargetInkDropState() !=
-        views::InkDropState::ACTION_PENDING) {
-      AnimateInkDrop(views::InkDropState::ACTION_PENDING, nullptr /* event */);
-    }
-  } else if (event.key_code() == ui::VKEY_RETURN) {
-    SetState(STATE_NORMAL);
-    NotifyClick(event);
-  } else {
-    return false;
+  switch (GetKeyClickActionForEvent(event)) {
+    case KeyClickAction::CLICK_ON_KEY_RELEASE:
+      SetState(STATE_PRESSED);
+      if (GetInkDrop()->GetTargetInkDropState() !=
+          InkDropState::ACTION_PENDING) {
+        AnimateInkDrop(InkDropState::ACTION_PENDING, nullptr /* event */);
+      }
+      return true;
+    case KeyClickAction::CLICK_ON_KEY_PRESS:
+      SetState(STATE_NORMAL);
+      NotifyClick(event);
+      return true;
+    case KeyClickAction::CLICK_NONE:
+      return false;
   }
-  return true;
+
+  NOTREACHED();
+  return false;
 }
 
 bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) {
-  if ((state_ == STATE_PRESSED) && (event.key_code() == ui::VKEY_SPACE)) {
-    SetState(STATE_NORMAL);
-    NotifyClick(event);
-    return true;
-  }
-  return false;
+  const bool click_button =
+      state_ == STATE_PRESSED &&
+      GetKeyClickActionForEvent(event) == KeyClickAction::CLICK_ON_KEY_RELEASE;
+  if (!click_button)
+    return false;
+
+  SetState(STATE_NORMAL);
+  NotifyClick(event);
+  return true;
 }
 
 void CustomButton::OnGestureEvent(ui::GestureEvent* event) {
@@ -306,9 +322,9 @@
 
 bool CustomButton::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
   // If this button is focused and the user presses space or enter, don't let
-  // that be treated as an accelerator.
-  return (event.key_code() == ui::VKEY_SPACE) ||
-         (event.key_code() == ui::VKEY_RETURN);
+  // that be treated as an accelerator if there is a key click action
+  // corresponding to it.
+  return GetKeyClickActionForEvent(event) != KeyClickAction::CLICK_NONE;
 }
 
 void CustomButton::ShowContextMenu(const gfx::Point& p,
diff --git a/ui/views/controls/button/custom_button.h b/ui/views/controls/button/custom_button.h
index 03a8b16..5717762 100644
--- a/ui/views/controls/button/custom_button.h
+++ b/ui/views/controls/button/custom_button.h
@@ -29,6 +29,14 @@
     NOTIFY_ON_RELEASE,
   };
 
+  // An enum describing the events on which a button should be clicked for a
+  // given key event.
+  enum KeyClickAction {
+    CLICK_ON_KEY_PRESS,
+    CLICK_ON_KEY_RELEASE,
+    CLICK_NONE,
+  };
+
   // The menu button's class name.
   static const char kViewClassName[];
 
diff --git a/ui/views/controls/button/custom_button_unittest.cc b/ui/views/controls/button/custom_button_unittest.cc
index 7fca6911..b9406604 100644
--- a/ui/views/controls/button/custom_button_unittest.cc
+++ b/ui/views/controls/button/custom_button_unittest.cc
@@ -27,6 +27,7 @@
 #include "ui/views/controls/button/toggle_button.h"
 #include "ui/views/controls/link.h"
 #include "ui/views/controls/textfield/textfield.h"
+#include "ui/views/style/platform_style.h"
 #include "ui/views/test/views_test_base.h"
 
 #if defined(USE_AURA)
@@ -158,8 +159,6 @@
     widget_->dragged_view_ = dragged_view;
   }
 
-  void SimulateKeyEvent(ui::KeyEvent* event) { widget()->OnKeyEvent(event); }
-
  private:
   std::unique_ptr<Widget> widget_;
   TestCustomButton* button_ = nullptr;
@@ -639,24 +638,61 @@
   delete button();
 }
 
-// Todo(karandeepb): On Mac, a button should get clicked on a Space key press
-// (and not release). Modify this test after fixing crbug.com/607429.
-// Test that Space Key behaves correctly on a focused button.
-TEST_F(CustomButtonTest, ClickOnSpace) {
+// Verify that the Space key clicks the button on key-press on Mac, and
+// key-release on other platforms.
+TEST_F(CustomButtonTest, ActionOnSpace) {
   // Give focus to the button.
   button()->SetFocusForPlatform();
   button()->RequestFocus();
-  EXPECT_EQ(button(), widget()->GetFocusManager()->GetFocusedView());
+  EXPECT_TRUE(button()->HasFocus());
 
   ui::KeyEvent space_press(ui::ET_KEY_PRESSED, ui::VKEY_SPACE, ui::EF_NONE);
-  SimulateKeyEvent(&space_press);
-  EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state());
-  EXPECT_FALSE(button()->pressed());
+  EXPECT_TRUE(button()->OnKeyPressed(space_press));
 
-  ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE);
-  SimulateKeyEvent(&space_release);
+#if defined(OS_MACOSX)
   EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state());
   EXPECT_TRUE(button()->pressed());
+#else
+  EXPECT_EQ(CustomButton::STATE_PRESSED, button()->state());
+  EXPECT_FALSE(button()->pressed());
+#endif
+
+  ui::KeyEvent space_release(ui::ET_KEY_RELEASED, ui::VKEY_SPACE, ui::EF_NONE);
+
+#if defined(OS_MACOSX)
+  EXPECT_FALSE(button()->OnKeyReleased(space_release));
+#else
+  EXPECT_TRUE(button()->OnKeyReleased(space_release));
+#endif
+
+  EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state());
+  EXPECT_TRUE(button()->pressed());
+}
+
+// Verify that the Return key clicks the button on key-press on all platforms
+// except Mac. On Mac, the Return key performs the default action associated
+// with a dialog, even if a button has focus.
+TEST_F(CustomButtonTest, ActionOnReturn) {
+  // Give focus to the button.
+  button()->SetFocusForPlatform();
+  button()->RequestFocus();
+  EXPECT_TRUE(button()->HasFocus());
+
+  ui::KeyEvent return_press(ui::ET_KEY_PRESSED, ui::VKEY_RETURN, ui::EF_NONE);
+
+#if defined(OS_MACOSX)
+  EXPECT_FALSE(button()->OnKeyPressed(return_press));
+  EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state());
+  EXPECT_FALSE(button()->pressed());
+#else
+  EXPECT_TRUE(button()->OnKeyPressed(return_press));
+  EXPECT_EQ(CustomButton::STATE_NORMAL, button()->state());
+  EXPECT_TRUE(button()->pressed());
+#endif
+
+  ui::KeyEvent return_release(ui::ET_KEY_RELEASED, ui::VKEY_RETURN,
+                              ui::EF_NONE);
+  EXPECT_FALSE(button()->OnKeyReleased(return_release));
 }
 
 }  // namespace views
diff --git a/ui/views/controls/link.cc b/ui/views/controls/link.cc
index e61140f0..bd8e65f1 100644
--- a/ui/views/controls/link.cc
+++ b/ui/views/controls/link.cc
@@ -20,6 +20,7 @@
 #include "ui/native_theme/native_theme.h"
 #include "ui/views/controls/link_listener.h"
 #include "ui/views/native_cursor.h"
+#include "ui/views/style/platform_style.h"
 
 namespace views {
 
@@ -90,7 +91,8 @@
 bool Link::OnKeyPressed(const ui::KeyEvent& event) {
   bool activate = (((event.key_code() == ui::VKEY_SPACE) &&
                     (event.flags() & ui::EF_ALT_DOWN) == 0) ||
-                   (event.key_code() == ui::VKEY_RETURN));
+                   (event.key_code() == ui::VKEY_RETURN &&
+                    PlatformStyle::kReturnClicksFocusedControl));
   if (!activate)
     return false;
 
@@ -123,9 +125,11 @@
 }
 
 bool Link::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
-  // Make sure we don't process space or enter as accelerators.
-  return (event.key_code() == ui::VKEY_SPACE) ||
-      (event.key_code() == ui::VKEY_RETURN);
+  // Don't process Space and Return (depending on the platform) as an
+  // accelerator.
+  return event.key_code() == ui::VKEY_SPACE ||
+         (event.key_code() == ui::VKEY_RETURN &&
+          PlatformStyle::kReturnClicksFocusedControl);
 }
 
 void Link::GetAccessibleNodeData(ui::AXNodeData* node_data) {
diff --git a/ui/views/style/platform_style.cc b/ui/views/style/platform_style.cc
index 46ffecf..d2188c9 100644
--- a/ui/views/style/platform_style.cc
+++ b/ui/views/style/platform_style.cc
@@ -44,6 +44,9 @@
 const bool PlatformStyle::kSelectWordOnRightClick = false;
 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction =
     CustomButton::NOTIFY_ON_RELEASE;
+const CustomButton::KeyClickAction PlatformStyle::kKeyClickActionOnSpace =
+    CustomButton::CLICK_ON_KEY_RELEASE;
+const bool PlatformStyle::kReturnClicksFocusedControl = true;
 const bool PlatformStyle::kTreeViewHasFocusRing = false;
 const bool PlatformStyle::kTreeViewSelectionPaintsEntireRow = false;
 const bool PlatformStyle::kUseRipples = true;
diff --git a/ui/views/style/platform_style.h b/ui/views/style/platform_style.h
index e71720fbc..5f945147 100644
--- a/ui/views/style/platform_style.h
+++ b/ui/views/style/platform_style.h
@@ -46,6 +46,13 @@
   // The menu button's action to show the menu.
   static const CustomButton::NotifyAction kMenuNotifyActivationAction;
 
+  // Whether the Space key clicks a button on key press or key release.
+  static const CustomButton::KeyClickAction kKeyClickActionOnSpace;
+
+  // Whether the Return key clicks the focused control (on key press).
+  // Otherwise, Return does nothing unless it is handled by an accelerator.
+  static const bool kReturnClicksFocusedControl;
+
   // Whether TreeViews get a focus ring on the entire TreeView when focused.
   static const bool kTreeViewHasFocusRing;
 
diff --git a/ui/views/style/platform_style_mac.mm b/ui/views/style/platform_style_mac.mm
index 4e07484..be553d3 100644
--- a/ui/views/style/platform_style_mac.mm
+++ b/ui/views/style/platform_style_mac.mm
@@ -37,6 +37,13 @@
 const CustomButton::NotifyAction PlatformStyle::kMenuNotifyActivationAction =
     CustomButton::NOTIFY_ON_PRESS;
 
+const CustomButton::KeyClickAction PlatformStyle::kKeyClickActionOnSpace =
+    CustomButton::CLICK_ON_KEY_PRESS;
+
+// On Mac, the Return key is used to perform the default action even when a
+// control is focused.
+const bool PlatformStyle::kReturnClicksFocusedControl = false;
+
 // static
 gfx::ImageSkia PlatformStyle::CreateComboboxArrow(bool is_enabled,
                                                   Combobox::Style style) {
diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc
index cf50c1c6..8281751 100644
--- a/ui/views/window/dialog_client_view.cc
+++ b/ui/views/window/dialog_client_view.cc
@@ -15,6 +15,7 @@
 #include "ui/views/controls/button/label_button.h"
 #include "ui/views/controls/button/md_text_button.h"
 #include "ui/views/layout/layout_constants.h"
+#include "ui/views/style/platform_style.h"
 #include "ui/views/views_delegate.h"
 #include "ui/views/widget/widget.h"
 #include "ui/views/window/dialog_delegate.h"
@@ -322,10 +323,15 @@
 LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
   const base::string16 title = GetDialogDelegate()->GetDialogButtonLabel(type);
   LabelButton* button = nullptr;
+
+  const bool is_default =
+      GetDialogDelegate()->GetDefaultDialogButton() == type &&
+      (type != ui::DIALOG_BUTTON_CANCEL ||
+       PlatformStyle::kDialogDefaultButtonCanBeCancel);
+
   // The default button is always blue in Harmony.
-  if (GetDialogDelegate()->GetDefaultDialogButton() == type &&
-      (ui::MaterialDesignController::IsSecondaryUiMaterial() ||
-       GetDialogDelegate()->ShouldDefaultButtonBeBlue())) {
+  if (is_default && (ui::MaterialDesignController::IsSecondaryUiMaterial() ||
+                     GetDialogDelegate()->ShouldDefaultButtonBeBlue())) {
     button = MdTextButton::CreateSecondaryUiBlueButton(this, title);
   } else {
     button = MdTextButton::CreateSecondaryUiButton(this, title);
diff --git a/ui/views/window/dialog_delegate_unittest.cc b/ui/views/window/dialog_delegate_unittest.cc
index 771d201..10e45c0 100644
--- a/ui/views/window/dialog_delegate_unittest.cc
+++ b/ui/views/window/dialog_delegate_unittest.cc
@@ -156,17 +156,31 @@
   SimulateKeyEvent(escape_event);
   dialog()->CheckAndResetStates(false, false, true);
 
-  // Check ok and cancel button behavior on a directed return key events.
-  ok_button->OnKeyPressed(return_event);
+// Check ok and cancel button behavior on a directed return key event. Buttons
+// won't respond to a return key event on Mac, since it performs the default
+// action.
+#if defined(OS_MACOSX)
+  EXPECT_FALSE(ok_button->OnKeyPressed(return_event));
+  dialog()->CheckAndResetStates(false, false, false);
+  EXPECT_FALSE(cancel_button->OnKeyPressed(return_event));
+  dialog()->CheckAndResetStates(false, false, false);
+#else
+  EXPECT_TRUE(ok_button->OnKeyPressed(return_event));
   dialog()->CheckAndResetStates(false, true, false);
-  cancel_button->OnKeyPressed(return_event);
+  EXPECT_TRUE(cancel_button->OnKeyPressed(return_event));
   dialog()->CheckAndResetStates(true, false, false);
+#endif
 
-  // Check that return accelerators cancel dialogs if cancel is focused.
+  // Check that return accelerators cancel dialogs if cancel is focused, except
+  // on Mac where return should perform the default action.
   cancel_button->RequestFocus();
   EXPECT_EQ(cancel_button, dialog()->GetFocusManager()->GetFocusedView());
   SimulateKeyEvent(return_event);
+#if defined(OS_MACOSX)
+  dialog()->CheckAndResetStates(false, true, false);
+#else
   dialog()->CheckAndResetStates(true, false, false);
+#endif
 
   // Check that escape can be overridden.
   dialog()->set_should_handle_escape(true);