diff --git a/chrome/android/java/res/layout/clear_browsing_data_tab_content.xml b/chrome/android/java/res/layout/clear_browsing_data_tab_content.xml
index 97c1170..4da49fd 100644
--- a/chrome/android/java/res/layout/clear_browsing_data_tab_content.xml
+++ b/chrome/android/java/res/layout/clear_browsing_data_tab_content.xml
@@ -21,9 +21,13 @@
 
     <Button
         android:id="@+id/clear_button"
+        android:layout_gravity="end"
         style="?android:attr/buttonBarButtonStyle"
-        android:layout_width="match_parent"
+        android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:padding="8dp"
+        android:minHeight="48dp"
+        android:layout_marginEnd="8dp"
         android:focusable="true"
         android:text="@string/clear_data_delete" />
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmImportSyncDataDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmImportSyncDataDialog.java
index 5d558daa..3f93053 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmImportSyncDataDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmImportSyncDataDialog.java
@@ -7,6 +7,7 @@
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.content.DialogInterface;
 import android.os.Bundle;
 import android.support.v7.app.AlertDialog;
@@ -101,7 +102,9 @@
                 newInstance(oldAccountName, newAccountName, importSyncType);
 
         confirmSync.setListener(callback);
-        confirmSync.show(fragmentManager, CONFIRM_IMPORT_SYNC_DATA_DIALOG_TAG);
+        FragmentTransaction transaction = fragmentManager.beginTransaction();
+        transaction.add(confirmSync, CONFIRM_IMPORT_SYNC_DATA_DIALOG_TAG);
+        transaction.commitAllowingStateLoss();
     }
 
     @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmManagedSyncDataDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmManagedSyncDataDialog.java
index 79f45ae..9f780fd2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmManagedSyncDataDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/ConfirmManagedSyncDataDialog.java
@@ -7,6 +7,7 @@
 import android.app.Dialog;
 import android.app.DialogFragment;
 import android.app.FragmentManager;
+import android.app.FragmentTransaction;
 import android.content.DialogInterface;
 import android.content.res.Resources;
 import android.os.Bundle;
@@ -108,7 +109,9 @@
                 newInstance(title, description, positiveButton, negativeButton);
 
         confirmSync.setListener(callback);
-        confirmSync.show(fragmentManager, CONFIRM_IMPORT_SYNC_DATA_DIALOG_TAG);
+        FragmentTransaction transaction = fragmentManager.beginTransaction();
+        transaction.add(confirmSync, CONFIRM_IMPORT_SYNC_DATA_DIALOG_TAG);
+        transaction.commitAllowingStateLoss();
     }
 
     private static ConfirmManagedSyncDataDialog newInstance(String title, String description,
diff --git a/chrome/browser/resources/local_ntp/most_visited_single.js b/chrome/browser/resources/local_ntp/most_visited_single.js
index 703ab1164..5529abf 100644
--- a/chrome/browser/resources/local_ntp/most_visited_single.js
+++ b/chrome/browser/resources/local_ntp/most_visited_single.js
@@ -28,11 +28,11 @@
 
 /**
  * The different sources that an NTP tile can have.
- * Note: Keep in sync with components/ntp_tiles/ntp_tile_source.h
+ * Note: Keep in sync with components/ntp_tiles/tile_source.h
  * @enum {number}
  * @const
  */
-var NTPTileSource = {
+var TileSource = {
   TOP_SITES: 0,
   SUGGESTIONS_SERVICE: 1,
   POPULAR: 3,
@@ -41,6 +41,22 @@
 
 
 /**
+ * The different (visual) types that an NTP tile can have.
+ * Note: Keep in sync with components/ntp_tiles/tile_visual_type.h
+ * @enum {number}
+ * @const
+ */
+var TileVisualType = {
+  NONE: 0,
+  ICON_REAL: 1,
+  ICON_COLOR: 2,
+  ICON_DEFAULT: 3,
+  THUMBNAIL: 4,
+  THUMBNAIL_FAILED: 5,
+};
+
+
+/**
  * Total number of tiles to show at any time. If the host page doesn't send
  * enough tiles, we fill them blank.
  * @const {number}
@@ -96,21 +112,25 @@
 /**
  * Log impression of an NTP tile.
  * @param {number} tileIndex Position of the tile, >= 0 and < NUMBER_OF_TILES.
- * @param {number} tileSource The source from NTPTileSource.
+ * @param {number} tileSource The source from TileSource.
+ * @param {number} tileType The type from TileVisualType.
  */
-function logMostVisitedImpression(tileIndex, tileSource) {
+function logMostVisitedImpression(tileIndex, tileSource, tileType) {
   chrome.embeddedSearch.newTabPage.logMostVisitedImpression(tileIndex,
-                                                            tileSource);
+                                                            tileSource,
+                                                            tileType);
 }
 
 /**
  * Log click on an NTP tile.
  * @param {number} tileIndex Position of the tile, >= 0 and < NUMBER_OF_TILES.
- * @param {number} tileSource The source from NTPTileSource.
+ * @param {number} tileSource The source from TileSource.
+ * @param {number} tileType The type from TileVisualType.
  */
-function logMostVisitedNavigation(tileIndex, tileSource) {
+function logMostVisitedNavigation(tileIndex, tileSource, tileType) {
   chrome.embeddedSearch.newTabPage.logMostVisitedNavigation(tileIndex,
-                                                            tileSource);
+                                                            tileSource,
+                                                            tileType);
 }
 
 /**
@@ -317,7 +337,7 @@
     tiles.appendChild(renderTile(data));
   } else if (args.url) {
     // If a URL is passed: a server-side suggestion.
-    args.tileSource = NTPTileSource.SUGGESTIONS_SERVICE;
+    args.tileSource = TileSource.SUGGESTIONS_SERVICE;
     // check sanity of the arguments
     if (/^javascript:/i.test(args.url) ||
         /^javascript:/i.test(args.thumbnailUrl))
@@ -371,7 +391,9 @@
 
   // The tile will be appended to tiles.
   var position = tiles.children.length;
-  logMostVisitedImpression(position, data.tileSource);
+
+  // This is set in the load/error event for the thumbnail image.
+  var tileType = TileVisualType.NONE;
 
   tile.className = 'mv-tile';
   tile.setAttribute('data-tid', data.tid);
@@ -389,7 +411,7 @@
   tile.title = data.title;
 
   tile.addEventListener('click', function(ev) {
-    logMostVisitedNavigation(position, data.tileSource);
+    logMostVisitedNavigation(position, data.tileSource, tileType);
   });
 
   tile.addEventListener('keydown', function(event) {
@@ -446,11 +468,23 @@
   img.title = data.title;
   img.src = data.thumbnailUrl;
   loadedCounter += 1;
-  img.addEventListener('load', countLoad);
-  img.addEventListener('error', countLoad);
+  img.addEventListener('load', function(ev) {
+    // Store the type for a potential later navigation.
+    tileType = TileVisualType.THUMBNAIL;
+    logMostVisitedImpression(position, data.tileSource, tileType);
+    // Note: It's important to call countLoad last, because that might emit the
+    // NTP_ALL_TILES_LOADED event, which must happen after the impression log.
+    countLoad();
+  });
   img.addEventListener('error', function(ev) {
     thumb.classList.add('failed-img');
     thumb.removeChild(img);
+    // Store the type for a potential later navigation.
+    tileType = TileVisualType.THUMBNAIL_FAILED;
+    logMostVisitedImpression(position, data.tileSource, tileType);
+    // Note: It's important to call countLoad last, because that might emit the
+    // NTP_ALL_TILES_LOADED event, which must happen after the impression log.
+    countLoad();
   });
   thumb.appendChild(img);
 
diff --git a/chrome/browser/ui/search/search_ipc_router.cc b/chrome/browser/ui/search/search_ipc_router.cc
index 9144935..613021b8 100644
--- a/chrome/browser/ui/search/search_ipc_router.cc
+++ b/chrome/browser/ui/search/search_ipc_router.cc
@@ -251,7 +251,8 @@
 void SearchIPCRouter::LogMostVisitedImpression(
     int page_seq_no,
     int position,
-    ntp_tiles::TileSource tile_source) {
+    ntp_tiles::TileSource tile_source,
+    ntp_tiles::TileVisualType tile_type) {
   if (page_seq_no != commit_counter_)
     return;
 
@@ -260,13 +261,14 @@
   if (!policy_->ShouldProcessLogEvent())
     return;
 
-  delegate_->OnLogMostVisitedImpression(position, tile_source);
+  delegate_->OnLogMostVisitedImpression(position, tile_source, tile_type);
 }
 
 void SearchIPCRouter::LogMostVisitedNavigation(
     int page_seq_no,
     int position,
-    ntp_tiles::TileSource tile_source) {
+    ntp_tiles::TileSource tile_source,
+    ntp_tiles::TileVisualType tile_type) {
   if (page_seq_no != commit_counter_)
     return;
 
@@ -275,7 +277,7 @@
   if (!policy_->ShouldProcessLogEvent())
     return;
 
-  delegate_->OnLogMostVisitedNavigation(position, tile_source);
+  delegate_->OnLogMostVisitedNavigation(position, tile_source, tile_type);
 }
 
 void SearchIPCRouter::PasteAndOpenDropdown(int page_seq_no,
diff --git a/chrome/browser/ui/search/search_ipc_router.h b/chrome/browser/ui/search/search_ipc_router.h
index fdd09be..541e277 100644
--- a/chrome/browser/ui/search/search_ipc_router.h
+++ b/chrome/browser/ui/search/search_ipc_router.h
@@ -15,6 +15,7 @@
 #include "chrome/common/search/instant_types.h"
 #include "chrome/common/search/ntp_logging_events.h"
 #include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
 #include "components/omnibox/common/omnibox_focus_state.h"
 #include "content/public/browser/web_contents_binding_set.h"
 #include "content/public/browser/web_contents_observer.h"
@@ -62,12 +63,14 @@
     // Called to log an impression from a given provider on the New Tab Page.
     virtual void OnLogMostVisitedImpression(
         int position,
-        ntp_tiles::TileSource tile_source) = 0;
+        ntp_tiles::TileSource tile_source,
+        ntp_tiles::TileVisualType tile_type) = 0;
 
     // Called to log a navigation from a given provider on the New Tab Page.
     virtual void OnLogMostVisitedNavigation(
         int position,
-        ntp_tiles::TileSource tile_source) = 0;
+        ntp_tiles::TileSource tile_source,
+        ntp_tiles::TileVisualType tile_type) = 0;
 
     // Called when the page wants to paste the |text| (or the clipboard contents
     // if the |text| is empty) into the omnibox.
@@ -183,10 +186,12 @@
                 base::TimeDelta time) override;
   void LogMostVisitedImpression(int page_seq_no,
                                 int position,
-                                ntp_tiles::TileSource tile_source) override;
+                                ntp_tiles::TileSource tile_source,
+                                ntp_tiles::TileVisualType tile_type) override;
   void LogMostVisitedNavigation(int page_seq_no,
                                 int position,
-                                ntp_tiles::TileSource tile_source) override;
+                                ntp_tiles::TileSource tile_source,
+                                ntp_tiles::TileVisualType tile_type) override;
   void PasteAndOpenDropdown(int page_seq_no,
                             const base::string16& text) override;
   void ChromeIdentityCheck(int page_seq_no,
diff --git a/chrome/browser/ui/search/search_ipc_router_unittest.cc b/chrome/browser/ui/search/search_ipc_router_unittest.cc
index b247b42..7afefc3 100644
--- a/chrome/browser/ui/search/search_ipc_router_unittest.cc
+++ b/chrome/browser/ui/search/search_ipc_router_unittest.cc
@@ -59,10 +59,14 @@
   MOCK_METHOD0(OnUndoAllMostVisitedDeletions, void());
   MOCK_METHOD2(OnLogEvent, void(NTPLoggingEventType event,
                                 base::TimeDelta time));
-  MOCK_METHOD2(OnLogMostVisitedImpression,
-               void(int position, ntp_tiles::TileSource tile_source));
-  MOCK_METHOD2(OnLogMostVisitedNavigation,
-               void(int position, ntp_tiles::TileSource tile_source));
+  MOCK_METHOD3(OnLogMostVisitedImpression,
+               void(int position,
+                    ntp_tiles::TileSource tile_source,
+                    ntp_tiles::TileVisualType tile_type));
+  MOCK_METHOD3(OnLogMostVisitedNavigation,
+               void(int position,
+                    ntp_tiles::TileSource tile_source,
+                    ntp_tiles::TileVisualType tile_type));
   MOCK_METHOD1(PasteIntoOmnibox, void(const base::string16&));
   MOCK_METHOD1(OnChromeIdentityCheck, void(const base::string16& identity));
   MOCK_METHOD0(OnHistorySyncCheck, void());
@@ -192,8 +196,9 @@
   content::WebContents* contents = web_contents();
   bool is_active_tab = IsActiveTab(contents);
   EXPECT_TRUE(is_active_tab);
-  EXPECT_CALL(*policy, ShouldProcessFocusOmnibox(is_active_tab)).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessFocusOmnibox(is_active_tab))
+      .Times(1)
+      .WillOnce(Return(true));
 
   GetSearchIPCRouter().FocusOmnibox(GetSearchIPCRouterSeqNo(),
                                     OMNIBOX_FOCUS_VISIBLE);
@@ -208,8 +213,9 @@
   content::WebContents* contents = web_contents();
   bool is_active_tab = IsActiveTab(contents);
   EXPECT_TRUE(is_active_tab);
-  EXPECT_CALL(*policy, ShouldProcessFocusOmnibox(is_active_tab)).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessFocusOmnibox(is_active_tab))
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().FocusOmnibox(GetSearchIPCRouterSeqNo(),
                                     OMNIBOX_FOCUS_VISIBLE);
@@ -242,8 +248,7 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(*mock_delegate(), OnLogEvent(NTP_ALL_TILES_LOADED, delta))
       .Times(1);
-  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1).WillOnce(Return(true));
 
   GetSearchIPCRouter().LogEvent(GetSearchIPCRouterSeqNo(), NTP_ALL_TILES_LOADED,
                                 delta);
@@ -256,8 +261,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(*mock_delegate(), OnLogEvent(NTP_ALL_TILES_LOADED, delta))
       .Times(0);
-  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessLogEvent())
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().LogEvent(GetSearchIPCRouterSeqNo(), NTP_ALL_TILES_LOADED,
                                 delta);
@@ -269,13 +275,14 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(
       *mock_delegate(),
-      OnLogMostVisitedImpression(3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE))
+      OnLogMostVisitedImpression(3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE,
+                                 ntp_tiles::TileVisualType::THUMBNAIL))
       .Times(1);
-  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1).WillOnce(Return(true));
 
   GetSearchIPCRouter().LogMostVisitedImpression(
-      GetSearchIPCRouterSeqNo(), 3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE);
+      GetSearchIPCRouterSeqNo(), 3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE,
+      ntp_tiles::TileVisualType::THUMBNAIL);
 }
 
 TEST_F(SearchIPCRouterTest, ProcessLogMostVisitedNavigationMsg) {
@@ -284,13 +291,14 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(
       *mock_delegate(),
-      OnLogMostVisitedNavigation(3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE))
+      OnLogMostVisitedNavigation(3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE,
+                                 ntp_tiles::TileVisualType::THUMBNAIL))
       .Times(1);
-  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessLogEvent()).Times(1).WillOnce(Return(true));
 
   GetSearchIPCRouter().LogMostVisitedNavigation(
-      GetSearchIPCRouterSeqNo(), 3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE);
+      GetSearchIPCRouterSeqNo(), 3, ntp_tiles::TileSource::SUGGESTIONS_SERVICE,
+      ntp_tiles::TileVisualType::THUMBNAIL);
 }
 
 TEST_F(SearchIPCRouterTest, ProcessChromeIdentityCheckMsg) {
@@ -299,8 +307,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   const base::string16 test_identity = base::ASCIIToUTF16("foo@bar.com");
   EXPECT_CALL(*mock_delegate(), OnChromeIdentityCheck(test_identity)).Times(1);
-  EXPECT_CALL(*policy, ShouldProcessChromeIdentityCheck()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessChromeIdentityCheck())
+      .Times(1)
+      .WillOnce(Return(true));
 
   GetSearchIPCRouter().ChromeIdentityCheck(GetSearchIPCRouterSeqNo(),
                                            test_identity);
@@ -313,8 +322,9 @@
 
   const base::string16 test_identity = base::ASCIIToUTF16("foo@bar.com");
   EXPECT_CALL(*mock_delegate(), OnChromeIdentityCheck(test_identity)).Times(0);
-  EXPECT_CALL(*policy, ShouldProcessChromeIdentityCheck()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessChromeIdentityCheck())
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().ChromeIdentityCheck(GetSearchIPCRouterSeqNo(),
                                            test_identity);
@@ -325,8 +335,9 @@
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(*mock_delegate(), OnHistorySyncCheck()).Times(1);
-  EXPECT_CALL(*policy, ShouldProcessHistorySyncCheck()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessHistorySyncCheck())
+      .Times(1)
+      .WillOnce(Return(true));
 
   GetSearchIPCRouter().HistorySyncCheck(GetSearchIPCRouterSeqNo());
 }
@@ -337,8 +348,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
 
   EXPECT_CALL(*mock_delegate(), OnHistorySyncCheck()).Times(0);
-  EXPECT_CALL(*policy, ShouldProcessHistorySyncCheck()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessHistorySyncCheck())
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().HistorySyncCheck(GetSearchIPCRouterSeqNo());
 }
@@ -349,8 +361,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   GURL item_url("www.foo.com");
   EXPECT_CALL(*mock_delegate(), OnDeleteMostVisitedItem(item_url)).Times(1);
-  EXPECT_CALL(*policy, ShouldProcessDeleteMostVisitedItem()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessDeleteMostVisitedItem())
+      .Times(1)
+      .WillOnce(Return(true));
 
   GetSearchIPCRouter().DeleteMostVisitedItem(GetSearchIPCRouterSeqNo(),
                                              item_url);
@@ -362,8 +375,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   GURL item_url("www.foo.com");
   EXPECT_CALL(*mock_delegate(), OnDeleteMostVisitedItem(item_url)).Times(0);
-  EXPECT_CALL(*policy, ShouldProcessDeleteMostVisitedItem()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessDeleteMostVisitedItem())
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().DeleteMostVisitedItem(GetSearchIPCRouterSeqNo(),
                                              item_url);
@@ -375,8 +389,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   GURL item_url("www.foo.com");
   EXPECT_CALL(*mock_delegate(), OnUndoMostVisitedDeletion(item_url)).Times(1);
-  EXPECT_CALL(*policy, ShouldProcessUndoMostVisitedDeletion()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessUndoMostVisitedDeletion())
+      .Times(1)
+      .WillOnce(Return(true));
 
   GetSearchIPCRouter().UndoMostVisitedDeletion(GetSearchIPCRouterSeqNo(),
                                                item_url);
@@ -388,8 +403,9 @@
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   GURL item_url("www.foo.com");
   EXPECT_CALL(*mock_delegate(), OnUndoMostVisitedDeletion(item_url)).Times(0);
-  EXPECT_CALL(*policy, ShouldProcessUndoMostVisitedDeletion()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessUndoMostVisitedDeletion())
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().UndoMostVisitedDeletion(GetSearchIPCRouterSeqNo(),
                                                item_url);
@@ -400,8 +416,9 @@
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(*mock_delegate(), OnUndoAllMostVisitedDeletions()).Times(1);
-  EXPECT_CALL(*policy, ShouldProcessUndoAllMostVisitedDeletions()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessUndoAllMostVisitedDeletions())
+      .Times(1)
+      .WillOnce(Return(true));
 
   GetSearchIPCRouter().UndoAllMostVisitedDeletions(GetSearchIPCRouterSeqNo());
 }
@@ -411,8 +428,9 @@
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
   EXPECT_CALL(*mock_delegate(), OnUndoAllMostVisitedDeletions()).Times(0);
-  EXPECT_CALL(*policy, ShouldProcessUndoAllMostVisitedDeletions()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessUndoAllMostVisitedDeletions())
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().UndoAllMostVisitedDeletions(GetSearchIPCRouterSeqNo());
 }
@@ -428,8 +446,9 @@
 
   base::string16 text;
   EXPECT_CALL(*mock_delegate(), PasteIntoOmnibox(text)).Times(1);
-  EXPECT_CALL(*policy, ShouldProcessPasteIntoOmnibox(is_active_tab)).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldProcessPasteIntoOmnibox(is_active_tab))
+      .Times(1)
+      .WillOnce(Return(true));
   GetSearchIPCRouter().PasteAndOpenDropdown(GetSearchIPCRouterSeqNo(), text);
 }
 
@@ -444,8 +463,9 @@
   EXPECT_TRUE(is_active_tab);
 
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldProcessPasteIntoOmnibox(is_active_tab)).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldProcessPasteIntoOmnibox(is_active_tab))
+      .Times(1)
+      .WillOnce(Return(false));
 
   GetSearchIPCRouter().PasteAndOpenDropdown(GetSearchIPCRouterSeqNo(), text);
 }
@@ -454,8 +474,9 @@
   NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar"));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendSetSuggestionToPrefetch()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldSendSetSuggestionToPrefetch())
+      .Times(1)
+      .WillOnce(Return(true));
 
   content::WebContents* contents = web_contents();
   EXPECT_CALL(*mock_search_box(), SetSuggestionToPrefetch(_));
@@ -466,8 +487,9 @@
   NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar"));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendSetSuggestionToPrefetch()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldSendSetSuggestionToPrefetch())
+      .Times(1)
+      .WillOnce(Return(false));
 
   content::WebContents* contents = web_contents();
   EXPECT_CALL(*mock_search_box(), SetSuggestionToPrefetch(_)).Times(0);
@@ -478,8 +500,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendOmniboxFocusChanged()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldSendOmniboxFocusChanged())
+      .Times(1)
+      .WillOnce(Return(true));
 
   EXPECT_CALL(*mock_search_box(), FocusChanged(_, _));
   GetSearchIPCRouter().OmniboxFocusChanged(OMNIBOX_FOCUS_NONE,
@@ -490,8 +513,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendOmniboxFocusChanged()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldSendOmniboxFocusChanged())
+      .Times(1)
+      .WillOnce(Return(false));
 
   EXPECT_CALL(*mock_search_box(), FocusChanged(_, _)).Times(0);
   GetSearchIPCRouter().OmniboxFocusChanged(OMNIBOX_FOCUS_NONE,
@@ -502,8 +526,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendSetInputInProgress(true)).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldSendSetInputInProgress(true))
+      .Times(1)
+      .WillOnce(Return(true));
 
   EXPECT_CALL(*mock_search_box(), SetInputInProgress(_));
   GetSearchIPCRouter().SetInputInProgress(true);
@@ -513,8 +538,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendSetInputInProgress(true)).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldSendSetInputInProgress(true))
+      .Times(1)
+      .WillOnce(Return(false));
 
   EXPECT_CALL(*mock_search_box(), SetInputInProgress(_)).Times(0);
   GetSearchIPCRouter().SetInputInProgress(true);
@@ -524,8 +550,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendMostVisitedItems()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldSendMostVisitedItems())
+      .Times(1)
+      .WillOnce(Return(true));
 
   EXPECT_CALL(*mock_search_box(), MostVisitedChanged(_));
   GetSearchIPCRouter().SendMostVisitedItems(
@@ -536,8 +563,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendMostVisitedItems()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldSendMostVisitedItems())
+      .Times(1)
+      .WillOnce(Return(false));
 
   EXPECT_CALL(*mock_search_box(), MostVisitedChanged(_)).Times(0);
   GetSearchIPCRouter().SendMostVisitedItems(
@@ -548,8 +576,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendThemeBackgroundInfo()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldSendThemeBackgroundInfo())
+      .Times(1)
+      .WillOnce(Return(true));
 
   EXPECT_CALL(*mock_search_box(), ThemeChanged(_));
   GetSearchIPCRouter().SendThemeBackgroundInfo(ThemeBackgroundInfo());
@@ -559,8 +588,9 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSendThemeBackgroundInfo()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldSendThemeBackgroundInfo())
+      .Times(1)
+      .WillOnce(Return(false));
 
   EXPECT_CALL(*mock_search_box(), ThemeChanged(_)).Times(0);
   GetSearchIPCRouter().SendThemeBackgroundInfo(ThemeBackgroundInfo());
@@ -570,8 +600,7 @@
   NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar"));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSubmitQuery()).Times(1)
-      .WillOnce(testing::Return(true));
+  EXPECT_CALL(*policy, ShouldSubmitQuery()).Times(1).WillOnce(Return(true));
 
   EXPECT_CALL(*mock_search_box(), Submit(_, _));
   GetSearchIPCRouter().Submit(base::string16(), EmbeddedSearchRequestParams());
@@ -581,8 +610,7 @@
   NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
   SetupMockDelegateAndPolicy();
   MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
-  EXPECT_CALL(*policy, ShouldSubmitQuery()).Times(1)
-      .WillOnce(testing::Return(false));
+  EXPECT_CALL(*policy, ShouldSubmitQuery()).Times(1).WillOnce(Return(false));
 
   EXPECT_CALL(*mock_search_box(), Submit(_, _)).Times(0);
   GetSearchIPCRouter().Submit(base::string16(), EmbeddedSearchRequestParams());
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index ca18125..1037cb53 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -405,21 +405,23 @@
 
 void SearchTabHelper::OnLogMostVisitedImpression(
     int position,
-    ntp_tiles::TileSource tile_source) {
+    ntp_tiles::TileSource tile_source,
+    ntp_tiles::TileVisualType tile_type) {
 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
 #if !defined(OS_ANDROID)
-  NTPUserDataLogger::GetOrCreateFromWebContents(
-      web_contents())->LogMostVisitedImpression(position, tile_source);
+  NTPUserDataLogger::GetOrCreateFromWebContents(web_contents())
+      ->LogMostVisitedImpression(position, tile_source, tile_type);
 #endif
 }
 
 void SearchTabHelper::OnLogMostVisitedNavigation(
     int position,
-    ntp_tiles::TileSource tile_source) {
+    ntp_tiles::TileSource tile_source,
+    ntp_tiles::TileVisualType tile_type) {
 // TODO(kmadhusu): Move platform specific code from here and get rid of #ifdef.
 #if !defined(OS_ANDROID)
-  NTPUserDataLogger::GetOrCreateFromWebContents(
-      web_contents())->LogMostVisitedNavigation(position, tile_source);
+  NTPUserDataLogger::GetOrCreateFromWebContents(web_contents())
+      ->LogMostVisitedNavigation(position, tile_source, tile_type);
 #endif
 }
 
diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h
index 6c2587a..caef0e5 100644
--- a/chrome/browser/ui/search/search_tab_helper.h
+++ b/chrome/browser/ui/search/search_tab_helper.h
@@ -17,6 +17,7 @@
 #include "chrome/common/search/instant_types.h"
 #include "chrome/common/search/ntp_logging_events.h"
 #include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
 #include "components/omnibox/common/omnibox_focus_state.h"
 #include "content/public/browser/reload_type.h"
 #include "content/public/browser/web_contents_observer.h"
@@ -140,9 +141,11 @@
   void OnUndoAllMostVisitedDeletions() override;
   void OnLogEvent(NTPLoggingEventType event, base::TimeDelta time) override;
   void OnLogMostVisitedImpression(int position,
-                                  ntp_tiles::TileSource tile_source) override;
+                                  ntp_tiles::TileSource tile_source,
+                                  ntp_tiles::TileVisualType tile_type) override;
   void OnLogMostVisitedNavigation(int position,
-                                  ntp_tiles::TileSource tile_source) override;
+                                  ntp_tiles::TileSource tile_source,
+                                  ntp_tiles::TileVisualType tile_type) override;
   void PasteIntoOmnibox(const base::string16& text) override;
   void OnChromeIdentityCheck(const base::string16& identity) override;
   void OnHistorySyncCheck() override;
diff --git a/chrome/browser/ui/search/search_tab_helper_unittest.cc b/chrome/browser/ui/search/search_tab_helper_unittest.cc
index e7e61cb..dee6663a 100644
--- a/chrome/browser/ui/search/search_tab_helper_unittest.cc
+++ b/chrome/browser/ui/search/search_tab_helper_unittest.cc
@@ -60,10 +60,14 @@
   MOCK_METHOD0(OnUndoAllMostVisitedDeletions, void());
   MOCK_METHOD2(OnLogEvent, void(NTPLoggingEventType event,
                                 base::TimeDelta time));
-  MOCK_METHOD2(OnLogMostVisitedImpression,
-               void(int position, ntp_tiles::TileSource tile_source));
-  MOCK_METHOD2(OnLogMostVisitedNavigation,
-               void(int position, ntp_tiles::TileSource tile_source));
+  MOCK_METHOD3(OnLogMostVisitedImpression,
+               void(int position,
+                    ntp_tiles::TileSource tile_source,
+                    ntp_tiles::TileVisualType tile_type));
+  MOCK_METHOD3(OnLogMostVisitedNavigation,
+               void(int position,
+                    ntp_tiles::TileSource tile_source,
+                    ntp_tiles::TileVisualType tile_type));
   MOCK_METHOD1(PasteIntoOmnibox, void(const base::string16&));
   MOCK_METHOD1(OnChromeIdentityCheck, void(const base::string16& identity));
   MOCK_METHOD0(OnHistorySyncCheck, void());
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
index 3ca9c84..b792884 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc
@@ -98,19 +98,21 @@
 
 void NTPUserDataLogger::LogMostVisitedImpression(
     int position,
-    ntp_tiles::TileSource tile_source) {
+    ntp_tiles::TileSource tile_source,
+    ntp_tiles::TileVisualType tile_type) {
   if ((position >= kNumMostVisited) || impression_was_logged_[position]) {
     return;
   }
   impression_was_logged_[position] = true;
   impression_tile_source_[position] = tile_source;
+  impression_tile_type_[position] = tile_type;
 }
 
 void NTPUserDataLogger::LogMostVisitedNavigation(
     int position,
-    ntp_tiles::TileSource tile_source) {
-  ntp_tiles::metrics::RecordTileClick(position, tile_source,
-                                      ntp_tiles::TileVisualType::THUMBNAIL);
+    ntp_tiles::TileSource tile_source,
+    ntp_tiles::TileVisualType tile_type) {
+  ntp_tiles::metrics::RecordTileClick(position, tile_source, tile_type);
 
   // Records the action. This will be available as a time-stamped stream
   // server-side and can be used to compute time-to-long-dwell.
@@ -120,6 +122,7 @@
 NTPUserDataLogger::NTPUserDataLogger(content::WebContents* contents)
     : content::WebContentsObserver(contents),
       impression_tile_source_(kNumMostVisited),
+      impression_tile_type_(kNumMostVisited),
       has_emitted_(false),
       during_startup_(!AfterStartupTaskUtils::IsBrowserStartupComplete()) {
   // We record metrics about session data here because when this class typically
@@ -168,8 +171,8 @@
     }
     // No URL passed since we're not interested in favicon-related Rappor
     // metrics.
-    tiles.emplace_back(impression_tile_source_[i],
-                       ntp_tiles::TileVisualType::THUMBNAIL, GURL());
+    tiles.emplace_back(impression_tile_source_[i], impression_tile_type_[i],
+                       GURL());
   }
 
   // Not interested in Rappor metrics.
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h
index 0e1ecd6..7b6fa35 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.h
@@ -14,6 +14,7 @@
 #include "base/time/time.h"
 #include "chrome/common/search/ntp_logging_events.h"
 #include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
 
@@ -41,11 +42,13 @@
 
   // Logs an impression on one of the NTP tiles by a given source.
   void LogMostVisitedImpression(int position,
-                                ntp_tiles::TileSource tile_source);
+                                ntp_tiles::TileSource tile_source,
+                                ntp_tiles::TileVisualType tile_type);
 
   // Logs a navigation on one of the NTP tiles by a given source.
   void LogMostVisitedNavigation(int position,
-                                ntp_tiles::TileSource tile_source);
+                                ntp_tiles::TileSource tile_source,
+                                ntp_tiles::TileVisualType tile_type);
 
  protected:
   explicit NTPUserDataLogger(content::WebContents* contents);
@@ -86,6 +89,10 @@
   // corresponding entry in |impression_was_logged_| is true.
   std::vector<ntp_tiles::TileSource> impression_tile_source_;
 
+  // Stores the tile type for each impression. Entries are only valid if the
+  // corresponding entry in |impression_was_logged_| is true.
+  std::vector<ntp_tiles::TileVisualType> impression_tile_type_;
+
   // The time we received the NTP_ALL_TILES_RECEIVED event.
   base::TimeDelta tiles_received_time_;
 
diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc b/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc
index b2bc5c5..f6502eb 100644
--- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc
@@ -17,6 +17,7 @@
 
 using base::Bucket;
 using ntp_tiles::TileSource;
+using ntp_tiles::TileVisualType;
 using testing::ElementsAre;
 using testing::IsEmpty;
 using testing::SizeIs;
@@ -45,8 +46,10 @@
 
   base::TimeDelta delta = base::TimeDelta::FromMilliseconds(0);
 
-  for (int i = 0; i < 8; ++i)
-    logger.LogMostVisitedImpression(i, TileSource::SUGGESTIONS_SERVICE);
+  for (int i = 0; i < 8; ++i) {
+    logger.LogMostVisitedImpression(i, TileSource::SUGGESTIONS_SERVICE,
+                                    TileVisualType::THUMBNAIL);
+  }
   logger.LogEvent(NTP_ALL_TILES_LOADED, delta);
   EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.NumberOfTiles"),
               ElementsAre(Bucket(8, 1)));
@@ -77,24 +80,38 @@
   base::TimeDelta delta = base::TimeDelta::FromMilliseconds(0);
 
   // Impressions increment the associated bins.
-  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(1, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(2, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(3, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(4, TileSource::TOP_SITES);
-  logger.LogMostVisitedImpression(5, TileSource::TOP_SITES);
-  logger.LogMostVisitedImpression(6, TileSource::TOP_SITES);
-  logger.LogMostVisitedImpression(7, TileSource::TOP_SITES);
+  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(1, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL_FAILED);
+  logger.LogMostVisitedImpression(2, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(3, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(4, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(5, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(6, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(7, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
 
   // Repeated impressions for the same bins are ignored.
-  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(1, TileSource::TOP_SITES);
-  logger.LogMostVisitedImpression(2, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(3, TileSource::TOP_SITES);
+  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL_FAILED);
+  logger.LogMostVisitedImpression(1, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL_FAILED);
+  logger.LogMostVisitedImpression(2, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(3, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
 
   // Impressions are silently ignored for tiles >= 8.
-  logger.LogMostVisitedImpression(8, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(9, TileSource::TOP_SITES);
+  logger.LogMostVisitedImpression(8, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(9, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
 
   // The actual histograms are emitted only after the ALL_TILES_LOADED event, so
   // at this point everything should still be empty.
@@ -107,6 +124,11 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.SuggestionsImpression.client"),
       IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType"), IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.client"),
+              IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.server"),
+              IsEmpty());
 
   // Send the ALL_TILES_LOADED event, this should trigger emitting histograms.
   logger.LogEvent(NTP_ALL_TILES_LOADED, delta);
@@ -121,16 +143,30 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.SuggestionsImpression.client"),
       ElementsAre(Bucket(4, 1), Bucket(5, 1), Bucket(6, 1), Bucket(7, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileType"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 7),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileType.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 3),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.client"),
+              ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 4)));
 
   // After navigating away from the NTP and back, we record again.
   logger.NavigatedFromURLToURL(GURL("chrome://newtab/"),
                                GURL("http://chromium.org"));
   logger.NavigatedFromURLToURL(GURL("http://chromium.org"),
                                GURL("chrome://newtab/"));
-  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(1, TileSource::TOP_SITES);
-  logger.LogMostVisitedImpression(2, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedImpression(3, TileSource::TOP_SITES);
+  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(1, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(2, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedImpression(3, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL_FAILED);
   logger.LogEvent(NTP_ALL_TILES_LOADED, delta);
 
   EXPECT_THAT(
@@ -144,6 +180,18 @@
       histogram_tester.GetAllSamples("NewTabPage.SuggestionsImpression.client"),
       ElementsAre(Bucket(1, 1), Bucket(3, 1), Bucket(4, 1), Bucket(5, 1),
                   Bucket(6, 1), Bucket(7, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileType"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 10),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 2)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileType.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 5),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileType.client"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 5),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
 }
 
 TEST(NTPUserDataLoggerTest, TestLogMostVisitedNavigation) {
@@ -153,7 +201,8 @@
 
   TestNTPUserDataLogger logger;
 
-  logger.LogMostVisitedNavigation(0, TileSource::SUGGESTIONS_SERVICE);
+  logger.LogMostVisitedNavigation(0, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
       ElementsAre(Bucket(0, 1)));
@@ -163,8 +212,17 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
       IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked"),
+              ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.client"),
+      IsEmpty());
 
-  logger.LogMostVisitedNavigation(1, TileSource::SUGGESTIONS_SERVICE);
+  logger.LogMostVisitedNavigation(1, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL_FAILED);
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
       ElementsAre(Bucket(0, 1), Bucket(1, 1)));
@@ -174,8 +232,20 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
       IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.client"),
+      IsEmpty());
 
-  logger.LogMostVisitedNavigation(2, TileSource::TOP_SITES);
+  logger.LogMostVisitedNavigation(2, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
       ElementsAre(Bucket(0, 1), Bucket(1, 1), Bucket(2, 1)));
@@ -185,8 +255,20 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
       ElementsAre(Bucket(2, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 2),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.client"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1)));
 
-  logger.LogMostVisitedNavigation(3, TileSource::TOP_SITES);
+  logger.LogMostVisitedNavigation(3, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL_FAILED);
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
       ElementsAre(Bucket(0, 1), Bucket(1, 1), Bucket(2, 1), Bucket(3, 1)));
@@ -196,12 +278,28 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
       ElementsAre(Bucket(2, 1), Bucket(3, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 2),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 2)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.client"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 1),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
 
   // Navigations always increase.
-  logger.LogMostVisitedNavigation(0, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedNavigation(1, TileSource::TOP_SITES);
-  logger.LogMostVisitedNavigation(2, TileSource::SUGGESTIONS_SERVICE);
-  logger.LogMostVisitedNavigation(3, TileSource::TOP_SITES);
+  logger.LogMostVisitedNavigation(0, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedNavigation(1, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedNavigation(2, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
+  logger.LogMostVisitedNavigation(3, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
       ElementsAre(Bucket(0, 2), Bucket(1, 2), Bucket(2, 2), Bucket(3, 2)));
@@ -211,6 +309,18 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
       ElementsAre(Bucket(1, 1), Bucket(2, 1), Bucket(3, 2)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 6),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 2)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.server"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 3),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.TileTypeClicked.client"),
+      ElementsAre(Bucket(ntp_tiles::TileVisualType::THUMBNAIL, 3),
+                  Bucket(ntp_tiles::TileVisualType::THUMBNAIL_FAILED, 1)));
 }
 
 TEST(NTPUserDataLoggerTest, TestLoadTime) {
@@ -229,7 +339,8 @@
 
   // Log a TOP_SITES impression (for the .MostVisited vs .MostLikely split in
   // the time histograms).
-  logger.LogMostVisitedImpression(0, TileSource::TOP_SITES);
+  logger.LogMostVisitedImpression(0, TileSource::TOP_SITES,
+                                  TileVisualType::THUMBNAIL);
 
   // Send the ALL_TILES_LOADED event, this should trigger emitting histograms.
   logger.LogEvent(NTP_ALL_TILES_LOADED, delta_tiles_loaded);
@@ -273,7 +384,8 @@
 
   // This time, log a SUGGESTIONS_SERVICE impression, so the times will end up
   // in .MostLikely.
-  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE);
+  logger.LogMostVisitedImpression(0, TileSource::SUGGESTIONS_SERVICE,
+                                  TileVisualType::THUMBNAIL);
 
   base::TimeDelta delta_tiles_received2 = base::TimeDelta::FromMilliseconds(50);
   base::TimeDelta delta_tiles_loaded2 = base::TimeDelta::FromMilliseconds(500);
diff --git a/chrome/common/instant.mojom b/chrome/common/instant.mojom
index 581a8b5c..45c9da1 100644
--- a/chrome/common/instant.mojom
+++ b/chrome/common/instant.mojom
@@ -17,6 +17,9 @@
 [Native]
 enum TileSource;
 
+[Native]
+enum TileVisualType;
+
 // Interface used to connect to the embedded search interface. This is a
 // separate interface such that a reverse connection (|client| below) can be
 // passed when connecting.
@@ -57,12 +60,14 @@
   // Logs an impression on one of the Most Visited tile on the InstantExtended
   // New Tab Page.
   LogMostVisitedImpression(int32 page_seq_no, int32 position,
-                           TileSource tile_source);
+                           TileSource tile_source,
+                           TileVisualType tile_type);
 
   // Logs a navigation on one of the Most Visited tile on the InstantExtended
   // New Tab Page.
   LogMostVisitedNavigation(int32 page_seq_no, int32 position,
-                           TileSource tile_source);
+                           TileSource tile_source,
+                           TileVisualType tile_type);
 
   // Tells InstantExtended to paste text into the omnibox.  If text is empty,
   // the clipboard contents will be pasted. This causes the omnibox dropdown to
diff --git a/chrome/common/instant.typemap b/chrome/common/instant.typemap
index 1a34ac7..74a6bf2 100644
--- a/chrome/common/instant.typemap
+++ b/chrome/common/instant.typemap
@@ -7,6 +7,7 @@
   "//chrome/common/search/instant_types.h",
   "//chrome/common/search/ntp_logging_events.h",
   "//components/ntp_tiles/tile_source.h",
+  "//components/ntp_tiles/tile_visual_type.h",
   "//components/omnibox/common/omnibox_focus_state.h",
 ]
 traits_headers = [ "//chrome/common/instant_struct_traits.h" ]
@@ -17,6 +18,7 @@
 type_mappings = [
   "chrome.mojom.NTPLoggingEventType=::NTPLoggingEventType",
   "chrome.mojom.TileSource=::ntp_tiles::TileSource",
+  "chrome.mojom.TileVisualType=::ntp_tiles::TileVisualType",
   "chrome.mojom.OmniboxFocusState=::OmniboxFocusState",
   "chrome.mojom.OmniboxFocusChangeReason=::OmniboxFocusChangeReason",
   "chrome.mojom.InstantMostVisitedItem=::InstantMostVisitedItem",
diff --git a/chrome/common/instant_struct_traits.h b/chrome/common/instant_struct_traits.h
index a203197..2ff8ab2e 100644
--- a/chrome/common/instant_struct_traits.h
+++ b/chrome/common/instant_struct_traits.h
@@ -5,6 +5,8 @@
 // Multiply-included file, no traditional include guard.
 #include "chrome/common/search/instant_types.h"
 #include "chrome/common/search/ntp_logging_events.h"
+#include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
 #include "components/omnibox/common/omnibox_focus_state.h"
 #include "ipc/ipc_message_macros.h"
 
@@ -17,6 +19,8 @@
 
 IPC_ENUM_TRAITS_MAX_VALUE(ntp_tiles::TileSource, ntp_tiles::TileSource::LAST)
 
+IPC_ENUM_TRAITS_MAX_VALUE(ntp_tiles::TileVisualType, ntp_tiles::TILE_TYPE_MAX)
+
 IPC_STRUCT_TRAITS_BEGIN(InstantMostVisitedItem)
   IPC_STRUCT_TRAITS_MEMBER(url)
   IPC_STRUCT_TRAITS_MEMBER(title)
diff --git a/chrome/renderer/resources/extensions/searchbox_api.js b/chrome/renderer/resources/extensions/searchbox_api.js
index 36f23dac..899016f 100644
--- a/chrome/renderer/resources/extensions/searchbox_api.js
+++ b/chrome/renderer/resources/extensions/searchbox_api.js
@@ -125,14 +125,14 @@
 
       // This method is restricted to chrome-search://most-visited pages by
       // checking the invoking context's origin in searchbox_extension.cc.
-      this.logMostVisitedImpression = function(position, provider) {
-        LogMostVisitedImpression(position, provider);
+      this.logMostVisitedImpression = function(position, tileSource, tileType) {
+        LogMostVisitedImpression(position, tileSource, tileType);
       };
 
       // This method is restricted to chrome-search://most-visited pages by
       // checking the invoking context's origin in searchbox_extension.cc.
-      this.logMostVisitedNavigation = function(position, provider) {
-        LogMostVisitedNavigation(position, provider);
+      this.logMostVisitedNavigation = function(position, tileSource, tileType) {
+        LogMostVisitedNavigation(position, tileSource, tileType);
       };
 
       this.undoAllMostVisitedDeletions = function() {
diff --git a/chrome/renderer/searchbox/searchbox.cc b/chrome/renderer/searchbox/searchbox.cc
index 186fd02..aefd7f8 100644
--- a/chrome/renderer/searchbox/searchbox.cc
+++ b/chrome/renderer/searchbox/searchbox.cc
@@ -267,15 +267,17 @@
 }
 
 void SearchBox::LogMostVisitedImpression(int position,
-                                         ntp_tiles::TileSource tile_source) {
+                                         ntp_tiles::TileSource tile_source,
+                                         ntp_tiles::TileVisualType tile_type) {
   instant_service_->LogMostVisitedImpression(page_seq_no_, position,
-                                             tile_source);
+                                             tile_source, tile_type);
 }
 
 void SearchBox::LogMostVisitedNavigation(int position,
-                                         ntp_tiles::TileSource tile_source) {
+                                         ntp_tiles::TileSource tile_source,
+                                         ntp_tiles::TileVisualType tile_type) {
   instant_service_->LogMostVisitedNavigation(page_seq_no_, position,
-                                             tile_source);
+                                             tile_source, tile_type);
 }
 
 void SearchBox::CheckIsUserSignedInToChromeAs(const base::string16& identity) {
diff --git a/chrome/renderer/searchbox/searchbox.h b/chrome/renderer/searchbox/searchbox.h
index 1b36acba..611ae708 100644
--- a/chrome/renderer/searchbox/searchbox.h
+++ b/chrome/renderer/searchbox/searchbox.h
@@ -15,6 +15,7 @@
 #include "chrome/common/search/ntp_logging_events.h"
 #include "chrome/renderer/instant_restricted_id_cache.h"
 #include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
 #include "components/omnibox/common/omnibox_focus_state.h"
 #include "content/public/renderer/render_frame_observer.h"
 #include "content/public/renderer/render_frame_observer_tracker.h"
@@ -55,11 +56,13 @@
 
   // Sends LogMostVisitedImpression to the browser.
   void LogMostVisitedImpression(int position,
-                                ntp_tiles::TileSource tile_source);
+                                ntp_tiles::TileSource tile_source,
+                                ntp_tiles::TileVisualType tile_type);
 
   // Sends LogMostVisitedNavigation to the browser.
   void LogMostVisitedNavigation(int position,
-                                ntp_tiles::TileSource tile_source);
+                                ntp_tiles::TileSource tile_source,
+                                ntp_tiles::TileVisualType tile_type);
 
   // Sends ChromeIdentityCheck to the browser.
   void CheckIsUserSignedInToChromeAs(const base::string16& identity);
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc
index c213440..d22db03 100644
--- a/chrome/renderer/searchbox/searchbox_extension.cc
+++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -23,6 +23,7 @@
 #include "chrome/renderer/searchbox/searchbox.h"
 #include "components/crx_file/id_util.h"
 #include "components/ntp_tiles/tile_source.h"
+#include "components/ntp_tiles/tile_visual_type.h"
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "third_party/WebKit/public/platform/WebURLRequest.h"
@@ -994,18 +995,23 @@
   if (!render_frame)
     return;
 
-  if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsNumber()) {
+  if (args.Length() < 3 || !args[0]->IsNumber() || !args[1]->IsNumber() ||
+      !args[2]->IsNumber()) {
     ThrowInvalidParameters(args);
     return;
   }
 
   DVLOG(1) << render_frame << " LogMostVisitedImpression";
 
-  if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST)) {
-    ntp_tiles::TileSource tile_source =
+  if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST) &&
+      args[2]->Uint32Value() <= ntp_tiles::TileVisualType::TILE_TYPE_MAX) {
+    auto tile_source =
         static_cast<ntp_tiles::TileSource>(args[1]->Uint32Value());
+    auto tile_type =
+        static_cast<ntp_tiles::TileVisualType>(args[2]->Uint32Value());
     SearchBox::Get(render_frame)
-        ->LogMostVisitedImpression(args[0]->IntegerValue(), tile_source);
+        ->LogMostVisitedImpression(args[0]->IntegerValue(), tile_source,
+                                   tile_type);
   }
 }
 
@@ -1024,11 +1030,15 @@
 
   DVLOG(1) << render_frame << " LogMostVisitedNavigation";
 
-  if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST)) {
-    ntp_tiles::TileSource tile_source =
+  if (args[1]->Uint32Value() <= static_cast<int>(ntp_tiles::TileSource::LAST) &&
+      args[2]->Uint32Value() <= ntp_tiles::TileVisualType::TILE_TYPE_MAX) {
+    auto tile_source =
         static_cast<ntp_tiles::TileSource>(args[1]->Uint32Value());
+    auto tile_type =
+        static_cast<ntp_tiles::TileVisualType>(args[2]->Uint32Value());
     SearchBox::Get(render_frame)
-        ->LogMostVisitedNavigation(args[0]->IntegerValue(), tile_source);
+        ->LogMostVisitedNavigation(args[0]->IntegerValue(), tile_source,
+                                   tile_type);
   }
 }
 
diff --git a/components/ntp_tiles/metrics.cc b/components/ntp_tiles/metrics.cc
index 0a2f207..819a6ae 100644
--- a/components/ntp_tiles/metrics.cc
+++ b/components/ntp_tiles/metrics.cc
@@ -27,9 +27,11 @@
 const char kHistogramWhitelistName[] = "whitelist";
 
 // Suffixes for the various icon types.
-const char kIconTypeSuffixColor[] = "IconsColor";
-const char kIconTypeSuffixGray[] = "IconsGray";
-const char kIconTypeSuffixReal[] = "IconsReal";
+const char kTileTypeSuffixIconColor[] = "IconsColor";
+const char kTileTypeSuffixIconGray[] = "IconsGray";
+const char kTileTypeSuffixIconReal[] = "IconsReal";
+const char kTileTypeSuffixThumbnail[] = "Thumbnail";
+const char kTileTypeSuffixThumbnailFailed[] = "ThumbnailFailed";
 
 // Log an event for a given |histogram| at a given element |position|. This
 // routine exists because regular histogram macros are cached thus can't be used
@@ -59,17 +61,19 @@
   return std::string();
 }
 
-const char* GetIconTypeSuffix(TileVisualType type) {
+const char* GetTileTypeSuffix(TileVisualType type) {
   switch (type) {
     case TileVisualType::ICON_COLOR:
-      return kIconTypeSuffixColor;
+      return kTileTypeSuffixIconColor;
     case TileVisualType::ICON_DEFAULT:
-      return kIconTypeSuffixGray;
+      return kTileTypeSuffixIconGray;
     case TileVisualType::ICON_REAL:
-      return kIconTypeSuffixReal;
+      return kTileTypeSuffixIconReal;
+    case THUMBNAIL:
+      return kTileTypeSuffixThumbnail;
+    case THUMBNAIL_FAILED:
+      return kTileTypeSuffixThumbnailFailed;
     case TileVisualType::NONE:                     // Fall through.
-    case TileVisualType::NUM_RECORDED_TILE_TYPES:  // Fall through.
-    case TileVisualType::THUMBNAIL:                // Fall through.
     case TileVisualType::UNKNOWN_TILE_TYPE:
       break;
   }
@@ -85,7 +89,6 @@
   for (int index = 0; index < static_cast<int>(tiles.size()); index++) {
     TileSource source = tiles[index].source;
     TileVisualType tile_type = tiles[index].type;
-    const GURL& url = tiles[index].url;
 
     UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestionsImpression", index,
                               kMaxNumTiles);
@@ -95,26 +98,28 @@
         "NewTabPage.SuggestionsImpression.%s", source_name.c_str());
     LogHistogramEvent(impression_histogram, index, kMaxNumTiles);
 
-    if (tile_type >= NUM_RECORDED_TILE_TYPES) {
+    if (tile_type > LAST_RECORDED_TILE_TYPE) {
       continue;
     }
 
     UMA_HISTOGRAM_ENUMERATION("NewTabPage.TileType", tile_type,
-                              NUM_RECORDED_TILE_TYPES);
+                              LAST_RECORDED_TILE_TYPE + 1);
 
     std::string tile_type_histogram =
         base::StringPrintf("NewTabPage.TileType.%s", source_name.c_str());
-    LogHistogramEvent(tile_type_histogram, tile_type, NUM_RECORDED_TILE_TYPES);
+    LogHistogramEvent(tile_type_histogram, tile_type,
+                      LAST_RECORDED_TILE_TYPE + 1);
 
-    const char* icon_type_suffix = GetIconTypeSuffix(tile_type);
-    if (icon_type_suffix) {
+    const char* tile_type_suffix = GetTileTypeSuffix(tile_type);
+    if (tile_type_suffix) {
+      // Note: This handles a null |rappor_service|.
       rappor::SampleDomainAndRegistryFromGURL(
           rappor_service,
-          base::StringPrintf("NTP.SuggestionsImpressions.%s", icon_type_suffix),
-          url);
+          base::StringPrintf("NTP.SuggestionsImpressions.%s", tile_type_suffix),
+          tiles[index].url);
 
       std::string icon_impression_histogram = base::StringPrintf(
-          "NewTabPage.SuggestionsImpression.%s", icon_type_suffix);
+          "NewTabPage.SuggestionsImpression.%s", tile_type_suffix);
       LogHistogramEvent(icon_impression_histogram, index, kMaxNumTiles);
     }
   }
@@ -127,21 +132,21 @@
       "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str());
   LogHistogramEvent(histogram, index, kMaxNumTiles);
 
-  const char* icon_type_suffix = GetIconTypeSuffix(tile_type);
-  if (icon_type_suffix) {
-    std::string icon_histogram =
-        base::StringPrintf("NewTabPage.MostVisited.%s", icon_type_suffix);
-    LogHistogramEvent(icon_histogram, index, kMaxNumTiles);
+  const char* tile_type_suffix = GetTileTypeSuffix(tile_type);
+  if (tile_type_suffix) {
+    std::string tile_type_histogram =
+        base::StringPrintf("NewTabPage.MostVisited.%s", tile_type_suffix);
+    LogHistogramEvent(tile_type_histogram, index, kMaxNumTiles);
   }
 
-  if (tile_type < NUM_RECORDED_TILE_TYPES) {
+  if (tile_type <= LAST_RECORDED_TILE_TYPE) {
     UMA_HISTOGRAM_ENUMERATION("NewTabPage.TileTypeClicked", tile_type,
-                              NUM_RECORDED_TILE_TYPES);
+                              LAST_RECORDED_TILE_TYPE + 1);
 
     std::string histogram =
         base::StringPrintf("NewTabPage.TileTypeClicked.%s",
                            GetSourceHistogramName(source).c_str());
-    LogHistogramEvent(histogram, tile_type, NUM_RECORDED_TILE_TYPES);
+    LogHistogramEvent(histogram, tile_type, LAST_RECORDED_TILE_TYPE + 1);
   }
 }
 
diff --git a/components/ntp_tiles/metrics_unittest.cc b/components/ntp_tiles/metrics_unittest.cc
index f5d5126e..4b5eac9a 100644
--- a/components/ntp_tiles/metrics_unittest.cc
+++ b/components/ntp_tiles/metrics_unittest.cc
@@ -90,7 +90,7 @@
 
 TEST(RecordPageImpressionTest, ShouldRecordUmaForThumbnails) {
   base::HistogramTester histogram_tester;
-  RecordPageImpression({{TileSource::TOP_SITES, THUMBNAIL, GURL()},
+  RecordPageImpression({{TileSource::TOP_SITES, THUMBNAIL_FAILED, GURL()},
                         {TileSource::SUGGESTIONS_SERVICE, THUMBNAIL, GURL()},
                         {TileSource::POPULAR, THUMBNAIL, GURL()}},
                        /*rappor_service=*/nullptr);
@@ -110,13 +110,15 @@
   EXPECT_THAT(histogram_tester.GetAllSamples(
                   "NewTabPage.SuggestionsImpression.popular"),
               ElementsAre(base::Bucket(/*min=*/2, /*count=*/1)));
-  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType"), IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType"),
+              ElementsAre(base::Bucket(/*min=*/THUMBNAIL, /*count=*/2),
+                          base::Bucket(/*min=*/THUMBNAIL_FAILED, /*count=*/1)));
   EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.server"),
-              IsEmpty());
+              ElementsAre(base::Bucket(/*min=*/THUMBNAIL, /*count=*/1)));
   EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.client"),
-              IsEmpty());
+              ElementsAre(base::Bucket(/*min=*/THUMBNAIL_FAILED, /*count=*/1)));
   EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.TileType.popular"),
-              IsEmpty());
+              ElementsAre(base::Bucket(/*min=*/THUMBNAIL, /*count=*/1)));
   EXPECT_THAT(histogram_tester.GetAllSamples(
                   "NewTabPage.SuggestionsImpression.IconsReal"),
               IsEmpty());
@@ -128,9 +130,11 @@
               IsEmpty());
 }
 
-TEST(RecordTileClickTest, ShouldRecordUma) {
+TEST(RecordTileClickTest, ShouldRecordUmaForIcon) {
   base::HistogramTester histogram_tester;
   RecordTileClick(3, TileSource::TOP_SITES, ICON_REAL);
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
+              ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
   EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
               ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
   EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.server"),
@@ -146,11 +150,25 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"),
       IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.Thumbnail"),
+      IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.ThumbnailFailed"),
+      IsEmpty());
 }
 
-TEST(RecordTileClickTest, ShouldIgnoreThumbnails) {
+TEST(RecordTileClickTest, ShouldRecordUmaForThumbnail) {
   base::HistogramTester histogram_tester;
   RecordTileClick(3, TileSource::TOP_SITES, THUMBNAIL);
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
+              ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
+              ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.server"),
+              IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.popular"),
+              IsEmpty());
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsReal"),
       IsEmpty());
@@ -160,6 +178,42 @@
   EXPECT_THAT(
       histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"),
       IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.Thumbnail"),
+      ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.ThumbnailFailed"),
+      IsEmpty());
+}
+
+TEST(RecordTileClickTest, ShouldNotRecordUnknownTileType) {
+  base::HistogramTester histogram_tester;
+  RecordTileClick(3, TileSource::TOP_SITES, UNKNOWN_TILE_TYPE);
+  // The click should still get recorded.
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited"),
+              ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.client"),
+              ElementsAre(base::Bucket(/*min=*/3, /*count=*/1)));
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.server"),
+              IsEmpty());
+  EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.MostVisited.popular"),
+              IsEmpty());
+  // But all of the tile type histograms should be empty.
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsReal"),
+      IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsColor"),
+      IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.IconsGray"),
+      IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.Thumbnail"),
+      IsEmpty());
+  EXPECT_THAT(
+      histogram_tester.GetAllSamples("NewTabPage.MostVisited.ThumbnailFailed"),
+      IsEmpty());
 }
 
 TEST(RecordPageImpressionTest, ShouldRecordRappor) {
@@ -168,11 +222,9 @@
   RecordPageImpression(
       {{TileSource::TOP_SITES, ICON_REAL, GURL("http://www.site1.com/")},
        {TileSource::TOP_SITES, ICON_COLOR, GURL("http://www.site2.com/")},
-       {TileSource::TOP_SITES, ICON_DEFAULT, GURL("http://www.site3.com/")},
-       {TileSource::TOP_SITES, THUMBNAIL, GURL("http://www.site4.com/")}},
+       {TileSource::TOP_SITES, ICON_DEFAULT, GURL("http://www.site3.com/")}},
       &rappor_service);
 
-  // Thumbnail shouldn't get reported.
   EXPECT_EQ(3, rappor_service.GetReportsCount());
 
   {
@@ -203,6 +255,18 @@
   }
 }
 
+TEST(RecordPageImpressionTest, ShouldNotRecordRapporForUnknownTileType) {
+  rappor::TestRapporServiceImpl rappor_service;
+
+  RecordPageImpression(
+      {{TileSource::TOP_SITES, ICON_REAL, GURL("http://www.s1.com/")},
+       {TileSource::TOP_SITES, UNKNOWN_TILE_TYPE, GURL("http://www.s2.com/")}},
+      &rappor_service);
+
+  // Unknown tile type shouldn't get reported.
+  EXPECT_EQ(1, rappor_service.GetReportsCount());
+}
+
 }  // namespace
 }  // namespace metrics
 }  // namespace ntp_tiles
diff --git a/components/ntp_tiles/tile_visual_type.h b/components/ntp_tiles/tile_visual_type.h
index e1bfea1..05318d4 100644
--- a/components/ntp_tiles/tile_visual_type.h
+++ b/components/ntp_tiles/tile_visual_type.h
@@ -23,19 +23,22 @@
   ICON_COLOR = 2,
   // The item displays a default gray box in place of an icon.
   ICON_DEFAULT = 3,
-  // The number of different tile types that get recorded. Entries below this
-  // are not recorded in UMA.
-  NUM_RECORDED_TILE_TYPES,
-
   // Deleted: THUMBNAIL_LOCAL = 4
   // Deleted: THUMBNAIL_SERVER = 5
   // Deleted: THUMBNAIL_DEFAULT = 6
-
   // The item displays a thumbnail of the page. Used on desktop.
-  THUMBNAIL,
+  THUMBNAIL = 7,
+  // The item wants to display a thumbnail of the page, but it failed to load.
+  // Used on desktop.
+  THUMBNAIL_FAILED = 8,
+  // The maximum tile type value that gets recorded in UMA.
+  LAST_RECORDED_TILE_TYPE = THUMBNAIL_FAILED,
+
   // The tile type has not been determined yet. Used on iOS, until we can detect
   // when all tiles have loaded.
   UNKNOWN_TILE_TYPE,
+
+  TILE_TYPE_MAX = UNKNOWN_TILE_TYPE
 };
 
 }  // namespace ntp_tiles
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index c591e851..4a33acd 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -56,6 +56,7 @@
       next_surface_sequence_(1u),
       current_surface_scale_factor_(1.f),
       frame_connector_(nullptr),
+      background_color_(SK_ColorWHITE),
       weak_factory_(this) {
   GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
   CreateCompositorFrameSinkSupport();
@@ -211,9 +212,15 @@
 }
 
 void RenderWidgetHostViewChildFrame::SetBackgroundColor(SkColor color) {
-  RenderWidgetHostViewBase::SetBackgroundColor(color);
-  bool opaque = GetBackgroundOpaque();
-  host_->SetBackgroundOpaque(opaque);
+  background_color_ = color;
+
+  DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
+         SkColorGetA(color) == SK_AlphaTRANSPARENT);
+  host_->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE);
+}
+
+SkColor RenderWidgetHostViewChildFrame::background_color() const {
+  return background_color_;
 }
 
 gfx::Size RenderWidgetHostViewChildFrame::GetPhysicalBackingSize() const {
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h
index c0eb3fa3..ea42f24d 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.h
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.h
@@ -89,6 +89,7 @@
   gfx::NativeView GetNativeView() const override;
   gfx::NativeViewAccessible GetNativeViewAccessible() override;
   void SetBackgroundColor(SkColor color) override;
+  SkColor background_color() const override;
   gfx::Size GetPhysicalBackingSize() const override;
   bool IsMouseLocked() override;
   void SetNeedsBeginFrames(bool needs_begin_frames) override;
@@ -255,6 +256,9 @@
 
   bool has_frame_ = false;
 
+  // The background color of the widget.
+  SkColor background_color_;
+
   base::WeakPtrFactory<RenderWidgetHostViewChildFrame> weak_factory_;
   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewChildFrame);
 };
diff --git a/content/browser/media/url_provision_fetcher.cc b/content/browser/media/url_provision_fetcher.cc
index 2892152f..6a0c896 100644
--- a/content/browser/media/url_provision_fetcher.cc
+++ b/content/browser/media/url_provision_fetcher.cc
@@ -8,6 +8,7 @@
 #include "content/public/browser/provision_fetcher_factory.h"
 #include "media/base/bind_to_current_loop.h"
 #include "net/base/load_flags.h"
+#include "net/traffic_annotation/network_traffic_annotation.h"
 #include "net/url_request/url_fetcher.h"
 
 using net::URLFetcher;
@@ -33,7 +34,37 @@
   DVLOG(1) << __func__ << ": request:" << request_string;
 
   DCHECK(!request_);
-  request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this);
+  net::NetworkTrafficAnnotationTag traffic_annotation =
+      net::DefineNetworkTrafficAnnotation("url_prevision_fetcher", R"(
+        semantics {
+          sender: "Content Decryption Module"
+          description:
+            "For a Content Decryption Module (CDM) to obtain origin-specific "
+            "identifiers from an individualization or provisioning server. See "
+            "https://w3c.github.io/encrypted-media/#direct-individualization."
+          trigger:
+            "During protected content playback, if the CDM hasn’t been "
+            "provisioned yet, it may trigger a provision request which will be "
+            "sent to a provisioning server."
+          data:
+            "Opaque provision request generated by the CDM. It may contain "
+            "distinctive identifiers (see "
+            "https://w3c.github.io/encrypted-media/#distinctive-identifier) "
+            "and/or distinctive permanent identifiers (see "
+            "https://w3c.github.io/encrypted-media/#distinctive-permanent-"
+            "identifier), which must be encrypted. It does NOT contain origin "
+            "information, even in encrypted form."
+          destination: OTHER
+        }
+        policy {
+          cookies_allowed: false
+          setting:
+            "On Android, users can disable this feature by disabling Protected "
+            "Media Identifier permissions."
+          policy_exception_justification: "Not implemented."
+        })");
+  request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this,
+                                traffic_annotation);
 
   // SetUploadData is mandatory even if we are not uploading anything.
   request_->SetUploadData("", "");
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 75e2280..f6cc46c 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -952,9 +952,11 @@
 #endif
   host_->SetView(view.get());
 
-  EXPECT_TRUE(view->GetBackgroundOpaque());
+  EXPECT_NE(static_cast<unsigned>(SK_ColorTRANSPARENT),
+            view->background_color());
   view->SetBackgroundColor(SK_ColorTRANSPARENT);
-  EXPECT_FALSE(view->GetBackgroundOpaque());
+  EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT),
+            view->background_color());
 
   const IPC::Message* set_background =
       process_->sink().GetUniqueMessageMatching(
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc
index 007cbf6..a2a4fd1 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -451,6 +451,7 @@
       is_in_vr_(false),
       content_view_core_(nullptr),
       ime_adapter_android_(nullptr),
+      background_color_(SK_ColorWHITE),
       cached_background_color_(SK_ColorWHITE),
       view_(this),
       gesture_provider_(ui::GetGestureProviderConfig(
@@ -1028,11 +1029,18 @@
 }
 
 void RenderWidgetHostViewAndroid::SetBackgroundColor(SkColor color) {
-  RenderWidgetHostViewBase::SetBackgroundColor(color);
-  host_->SetBackgroundOpaque(GetBackgroundOpaque());
+  background_color_ = color;
+
+  DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
+         SkColorGetA(color) == SK_AlphaTRANSPARENT);
+  host_->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE);
   UpdateBackgroundColor(color);
 }
 
+SkColor RenderWidgetHostViewAndroid::background_color() const {
+  return background_color_;
+}
+
 void RenderWidgetHostViewAndroid::CopyFromSurface(
     const gfx::Rect& src_subrect,
     const gfx::Size& dst_size,
diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h
index af1f00a5d..0c69b818 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.h
+++ b/content/browser/renderer_host/render_widget_host_view_android.h
@@ -116,6 +116,7 @@
   void SetTooltipText(const base::string16& tooltip_text) override;
   bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
   void SetBackgroundColor(SkColor color) override;
+  SkColor background_color() const override;
   gfx::Rect GetBoundsInRootWindow() override;
   void ProcessAckedTouchEvent(const TouchEventWithLatencyInfo& touch,
                               InputEventAckState ack_result) override;
@@ -348,6 +349,9 @@
 
   ImeAdapterAndroid* ime_adapter_android_;
 
+  // The background color of the widget.
+  SkColor background_color_;
+
   // Body background color of the underlying document.
   SkColor cached_background_color_;
 
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index fd03a2b..2c8d5b5 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -382,6 +382,7 @@
       popup_child_host_view_(nullptr),
       is_loading_(false),
       has_composition_text_(false),
+      background_color_(SK_ColorWHITE),
       needs_begin_frames_(false),
       needs_flush_input_(false),
       added_frame_observer_(false),
@@ -719,11 +720,26 @@
 }
 
 void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) {
+  // The renderer will feed its color back to us with the first CompositorFrame.
+  // We short-cut here to show a sensible color before that happens.
+  UpdateBackgroundColorFromRenderer(color);
+
+  DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
+         SkColorGetA(color) == SK_AlphaTRANSPARENT);
+  host_->SetBackgroundOpaque(SkColorGetA(color) == SK_AlphaOPAQUE);
+}
+
+SkColor RenderWidgetHostViewAura::background_color() const {
+  return background_color_;
+}
+
+void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer(
+    SkColor color) {
   if (color == background_color())
     return;
-  RenderWidgetHostViewBase::SetBackgroundColor(color);
-  bool opaque = GetBackgroundOpaque();
-  host_->SetBackgroundOpaque(opaque);
+  background_color_ = color;
+
+  bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
   window_->layer()->SetFillsBoundsOpaquely(opaque);
   window_->layer()->SetColor(color);
 }
@@ -888,7 +904,7 @@
   // This allows us to, when navigating to a new page, transfer this color to
   // that page. This allows us to pass this background color to new views on
   // navigation.
-  SetBackgroundColor(frame.metadata.root_background_color);
+  UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color);
 
   last_scroll_offset_ = frame.metadata.root_scroll_offset;
 
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h
index 543ca061..4c613be4 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.h
+++ b/content/browser/renderer_host/render_widget_host_view_aura.h
@@ -112,6 +112,7 @@
   bool IsShowing() override;
   gfx::Rect GetViewBounds() const override;
   void SetBackgroundColor(SkColor color) override;
+  SkColor background_color() const override;
   bool IsMouseLocked() override;
   gfx::Size GetVisibleViewportSize() const override;
   void SetInsets(const gfx::Insets& insets) override;
@@ -463,6 +464,10 @@
   // Tells DelegatedFrameHost whether we need to receive BeginFrames.
   void UpdateNeedsBeginFramesInternal();
 
+  // Applies background color without notifying the RenderWidget about
+  // opaqueness changes.
+  void UpdateBackgroundColorFromRenderer(SkColor color);
+
   // The model object.
   RenderWidgetHostImpl* const host_;
 
@@ -507,6 +512,9 @@
   // Current tooltip text.
   base::string16 tooltip_;
 
+  // The background color of the web content.
+  SkColor background_color_;
+
   // Whether a request for begin frames has been issued.
   bool needs_begin_frames_;
 
diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc
index 1c1972b6..760ad49e 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.cc
+++ b/content/browser/renderer_host/render_widget_host_view_base.cc
@@ -35,7 +35,6 @@
 RenderWidgetHostViewBase::RenderWidgetHostViewBase()
     : is_fullscreen_(false),
       popup_type_(blink::WebPopupTypeNone),
-      background_color_(SK_ColorWHITE),
       mouse_locked_(false),
       showing_context_menu_(false),
       current_device_scale_factor_(0),
@@ -87,22 +86,10 @@
   return false;
 }
 
-void RenderWidgetHostViewBase::SetBackgroundColor(SkColor color) {
-  background_color_ = color;
-}
-
-SkColor RenderWidgetHostViewBase::background_color() {
-  return background_color_;
-}
-
 void RenderWidgetHostViewBase::SetBackgroundColorToDefault() {
   SetBackgroundColor(SK_ColorWHITE);
 }
 
-bool RenderWidgetHostViewBase::GetBackgroundOpaque() {
-  return SkColorGetA(background_color_) == SK_AlphaOPAQUE;
-}
-
 gfx::Size RenderWidgetHostViewBase::GetPhysicalBackingSize() const {
   return gfx::ScaleToCeiledSize(
       GetRequestedRendererSize(),
diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h
index 40ff13c..40b1161 100644
--- a/content/browser/renderer_host/render_widget_host_view_base.h
+++ b/content/browser/renderer_host/render_widget_host_view_base.h
@@ -92,10 +92,7 @@
 
   // RenderWidgetHostView implementation.
   RenderWidgetHost* GetRenderWidgetHost() const override;
-  void SetBackgroundColor(SkColor color) override;
-  SkColor background_color() override;
   void SetBackgroundColorToDefault() final;
-  bool GetBackgroundOpaque() override;
   ui::TextInputClient* GetTextInputClient() override;
   void WasUnOccluded() override {}
   void WasOccluded() override {}
@@ -430,9 +427,6 @@
   // autofill...).
   blink::WebPopupType popup_type_;
 
-  // The background color of the web content.
-  SkColor background_color_;
-
   // While the mouse is locked, the cursor is hidden from the user. Mouse events
   // are still generated. However, the position they report is the last known
   // mouse position just as mouse lock was entered; the movement they report
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h
index 97e927f..d72039d 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.h
+++ b/content/browser/renderer_host/render_widget_host_view_mac.h
@@ -277,6 +277,7 @@
   bool IsSpeaking() const override;
   void StopSpeaking() override;
   void SetBackgroundColor(SkColor color) override;
+  SkColor background_color() const override;
   void SetNeedsBeginFrames(bool needs_begin_frames) override;
 
   // Implementation of RenderWidgetHostViewBase.
@@ -405,6 +406,10 @@
 
   WebContents* GetWebContents();
 
+  // Applies background color without notifying the RenderWidget about
+  // opaqueness changes.
+  void UpdateBackgroundColorFromRenderer(SkColor color);
+
   // These member variables should be private, but the associated ObjC class
   // needs access to them and can't be made a friend.
 
@@ -552,6 +557,9 @@
   // Whether a request to flush input has been issued.
   bool needs_flush_input_;
 
+  // The background color of the web content.
+  SkColor background_color_;
+
   // Factory used to safely scope delayed calls to ShutdownHost().
   base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_;
 
diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm
index 2b0a11d..0ff01ca 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac.mm
@@ -449,6 +449,7 @@
       is_guest_view_hack_(is_guest_view_hack),
       fullscreen_parent_host_view_(nullptr),
       needs_flush_input_(false),
+      background_color_(SK_ColorWHITE),
       weak_factory_(this) {
   // |cocoa_view_| owns us and we will be deleted when |cocoa_view_|
   // goes away.  Since we autorelease it, our caller must put
@@ -1434,7 +1435,7 @@
 
   // Override the compositor background color. See RenderWidgetHostViewAura
   // for more details.
-  SetBackgroundColor(frame.metadata.root_background_color);
+  UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color);
 
   last_scroll_offset_ = frame.metadata.root_scroll_offset;
 
@@ -1642,14 +1643,27 @@
 }
 
 void RenderWidgetHostViewMac::SetBackgroundColor(SkColor color) {
-  if (color == background_color_)
-    return;
+  // The renderer will feed its color back to us with the first CompositorFrame.
+  // We short-cut here to show a sensible color before that happens.
+  UpdateBackgroundColorFromRenderer(color);
 
-  RenderWidgetHostViewBase::SetBackgroundColor(color);
-  bool opaque = GetBackgroundOpaque();
-
+  DCHECK(SkColorGetA(color) == SK_AlphaOPAQUE ||
+         SkColorGetA(color) == SK_AlphaTRANSPARENT);
+  bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
   if (render_widget_host_)
     render_widget_host_->SetBackgroundOpaque(opaque);
+}
+
+SkColor RenderWidgetHostViewMac::background_color() const {
+  return background_color_;
+}
+
+void RenderWidgetHostViewMac::UpdateBackgroundColorFromRenderer(SkColor color) {
+  if (color == background_color())
+    return;
+  background_color_ = color;
+
+  bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE;
 
   [cocoa_view_ setOpaque:opaque];
 
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
index 578e7a2..7502ed5 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -1270,11 +1270,13 @@
       new MockRenderWidgetHostImpl(&delegate, process_host, routing_id);
   RenderWidgetHostViewMac* view = new RenderWidgetHostViewMac(host, false);
 
-  EXPECT_TRUE(view->GetBackgroundOpaque());
+  EXPECT_NE(static_cast<unsigned>(SK_ColorTRANSPARENT),
+            view->background_color());
   EXPECT_TRUE([view->cocoa_view() isOpaque]);
 
   view->SetBackgroundColor(SK_ColorTRANSPARENT);
-  EXPECT_FALSE(view->GetBackgroundOpaque());
+  EXPECT_EQ(static_cast<unsigned>(SK_ColorTRANSPARENT),
+            view->background_color());
   EXPECT_FALSE([view->cocoa_view() isOpaque]);
 
   const IPC::Message* set_background;
@@ -1288,7 +1290,7 @@
   // Try setting it back.
   process_host->sink().ClearMessages();
   view->SetBackgroundColor(SK_ColorWHITE);
-  EXPECT_TRUE(view->GetBackgroundOpaque());
+  EXPECT_EQ(static_cast<unsigned>(SK_ColorWHITE), view->background_color());
   EXPECT_TRUE([view->cocoa_view() isOpaque]);
   set_background = process_host->sink().GetUniqueMessageMatching(
       ViewMsg_SetBackgroundOpaque::ID);
diff --git a/content/public/browser/render_widget_host_view.h b/content/public/browser/render_widget_host_view.h
index 8d52b0f..e295ef25 100644
--- a/content/public/browser/render_widget_host_view.h
+++ b/content/public/browser/render_widget_host_view.h
@@ -132,13 +132,14 @@
   virtual base::string16 GetSelectedText() = 0;
 
   // Subclasses should override this method to set the background color. |color|
-  // could be transparent or opaque.
+  // has to be either SK_ColorTRANSPARENT or opaque. If set to
+  // SK_ColorTRANSPARENT, the renderer's background color will be overridden to
+  // be fully transparent.
   virtual void SetBackgroundColor(SkColor color) = 0;
+  virtual SkColor background_color() const = 0;
   // Convenience method to fill the background layer with the default color by
   // calling |SetBackgroundColor|.
-  virtual SkColor background_color() = 0;
   virtual void SetBackgroundColorToDefault() = 0;
-  virtual bool GetBackgroundOpaque() = 0;
 
   // Return value indicates whether the mouse is locked successfully or not.
   virtual bool LockMouse() = 0;
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc
index 0d82ed0..4a1d40e 100644
--- a/content/public/common/content_features.cc
+++ b/content/public/common/content_features.cc
@@ -140,6 +140,10 @@
 const base::Feature kMainThreadBusyScrollIntervention{
     "MainThreadBusyScrollIntervention", base::FEATURE_DISABLED_BY_DEFAULT};
 
+// Experimental resource fetch optimizations for workers. See crbug.com/443374
+const base::Feature kOffMainThreadFetch{"OffMainThreadFetch",
+                                        base::FEATURE_DISABLED_BY_DEFAULT};
+
 // Origin Trials for controlling access to feature/API experiments.
 const base::Feature kOriginTrials{"OriginTrials",
                                   base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h
index 7ce44ea..337220a7 100644
--- a/content/public/common/content_features.h
+++ b/content/public/common/content_features.h
@@ -43,6 +43,7 @@
 CONTENT_EXPORT extern const base::Feature kMemoryCoordinator;
 CONTENT_EXPORT extern const base::Feature kNotificationContentImage;
 CONTENT_EXPORT extern const base::Feature kMainThreadBusyScrollIntervention;
+CONTENT_EXPORT extern const base::Feature kOffMainThreadFetch;
 CONTENT_EXPORT extern const base::Feature kOriginTrials;
 CONTENT_EXPORT extern const base::Feature kParallelDownloading;
 CONTENT_EXPORT extern const base::Feature kPassiveDocumentEventListeners;
diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc
index 40c6fdd9..691b57b 100644
--- a/content/test/test_render_view_host.cc
+++ b/content/test/test_render_view_host.cc
@@ -58,7 +58,8 @@
     : rwh_(RenderWidgetHostImpl::From(rwh)),
       is_showing_(false),
       is_occluded_(false),
-      did_swap_compositor_frame_(false) {
+      did_swap_compositor_frame_(false),
+      background_color_(SK_ColorWHITE) {
 #if defined(OS_ANDROID)
   frame_sink_id_ = AllocateFrameSinkId();
   GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
@@ -136,6 +137,14 @@
   return gfx::Rect();
 }
 
+void TestRenderWidgetHostView::SetBackgroundColor(SkColor color) {
+  background_color_ = color;
+}
+
+SkColor TestRenderWidgetHostView::background_color() const {
+  return background_color_;
+}
+
 bool TestRenderWidgetHostView::HasAcceleratedSurface(
       const gfx::Size& desired_size) {
   return false;
diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h
index 3b6a0c9..577b141 100644
--- a/content/test/test_render_view_host.h
+++ b/content/test/test_render_view_host.h
@@ -77,6 +77,8 @@
   void WasUnOccluded() override;
   void WasOccluded() override;
   gfx::Rect GetViewBounds() const override;
+  void SetBackgroundColor(SkColor color) override;
+  SkColor background_color() const override;
 #if defined(OS_MACOSX)
   ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
   void SetActive(bool active) override;
@@ -129,6 +131,7 @@
   bool is_occluded_;
   bool did_swap_compositor_frame_;
   bool did_change_compositor_frame_sink_ = false;
+  SkColor background_color_;
   ui::DummyTextInputClient text_input_client_;
 };
 
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index 63b014c..27084ed 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -7,7 +7,6 @@
 crbug.com/706118 external/wpt/css/CSS2 [ Skip ]
 crbug.com/706118 external/wpt/css/css-align-3 [ Skip ]
 crbug.com/706118 external/wpt/css/css-flexbox-1 [ Skip ]
-crbug.com/706118 external/wpt/css/css-grid-1 [ Skip ]
 crbug.com/706118 external/wpt/css/css-scoping-1 [ Skip ]
 crbug.com/706118 external/wpt/css/css-shapes-1 [ Skip ]
 crbug.com/706118 external/wpt/css/css-text-3 [ Skip ]
@@ -1801,6 +1800,7 @@
 crbug.com/694525 external/wpt/content-security-policy/embedded-enforcement [ Pass ]
 crbug.com/694525 external/wpt/content-security-policy/embedded-enforcement/embedding_csp-header-invalid-format.html [ Skip ]
 crbug.com/694525 external/wpt/content-security-policy/font-src [ Pass ]
+crbug.com/694525 external/wpt/content-security-policy/generic [ Pass ]
 crbug.com/694525 external/wpt/content-security-policy/img-src [ Pass ]
 crbug.com/694525 external/wpt/content-security-policy/inside-worker [ Pass ]
 crbug.com/694525 external/wpt/content-security-policy/media-src [ Pass ]
@@ -2404,7 +2404,7 @@
 # [css-grid]
 crbug.com/659610 fast/css-grid-layout/grid-baseline.html [ Failure ]
 crbug.com/659610 fast/css-grid-layout/grid-baseline-margins.html [ Failure ]
-#crbug.com/511177 external/wpt/css/css-grid-1/grid-layout-properties.html [ Failure ]
+crbug.com/511177 external/wpt/css/css-grid-1/grid-layout-properties.html [ Failure ]
 crbug.com/707359 [ Mac ] fast/css-grid-layout/grid-align-baseline-vertical.html [ Failure ]
 crbug.com/707359 [ Mac ] fast/css-grid-layout/grid-self-baseline-03.html [ Failure ]
 crbug.com/707359 [ Mac ] fast/css-grid-layout/grid-self-baseline-04.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-img-src.html b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-img-src.html
index c3778f8..0c10215 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-img-src.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-img-src.html
@@ -29,7 +29,7 @@
       }
     </script>
 
-    <script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=default-src%20%27self%27%20%27unsafe-inline%27'></script>
+    <script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=img-src%20%27self%27%20%27unsafe-inline%27'></script>
 
 </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-script-src.html b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-script-src.html
index 740b2a5..e4f0d1d5 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-script-src.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/generic/generic-0_1-script-src.html
@@ -29,7 +29,7 @@
       }
     </script>
 
-    <script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=default-src%20%27self%27%20%27unsafe-inline%27'></script>
+    <script async defer src='../support/checkReport.sub.js?reportField=violated-directive&reportValue=script-src%20%27self%27%20%27unsafe-inline%27'></script>
 
 </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub-expected.txt
index 1d1d4dd..0553de7 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub-expected.txt
@@ -1,7 +1,7 @@
 This is a testharness.js-based test.
 FAIL Check request values when initialized from Request assert_equals: Check cache attribute expected (string) "no-cache" but got (undefined) undefined
 FAIL Check request values when initialized from Request and init values assert_equals: Check cache attribute expected (string) "no-cache" but got (undefined) undefined
-FAIL Check request values when initialized from url string assert_equals: Check referrer attribute expected "http://web-platform.test:8001/" but got "about:client"
+FAIL Check request values when initialized from url string assert_equals: Check cache attribute expected (string) "default" but got (undefined) undefined
 FAIL Check request values when initialized from url and init values assert_equals: Check cache attribute expected (string) "no-cache" but got (undefined) undefined
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub.html b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub.html
index 8860d607..507007f1 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/fetch/api/request/request-init-003.sub.html
@@ -41,7 +41,7 @@
 
       var expectedDefault = {"method" : "GET",
                              "url" : location.href,
-                             "referrer" : "http://{{host}}:{{ports[http][0]}}/",
+                             "referrer" : "about:client",
                              "referrerPolicy" : "",
                              "mode" : "cors",
                              "credentials" : "omit",
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-1-no-change-expected.txt b/third_party/WebKit/LayoutTests/plugins/focus-change-1-no-change-expected.txt
new file mode 100644
index 0000000..c81159e9e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-1-no-change-expected.txt
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+CONSOLE MESSAGE: Blink Test Plugin: DidChangeFocus(true)
+CONSOLE MESSAGE: Blink Test Plugin: DidChangeFocus(false)
+i1focus
+i1blur
+pfocus
+pblur
+i2focus
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test no change of focus inside plugin onfocus and onblur events
+
+  
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-1-no-change.html b/third_party/WebKit/LayoutTests/plugins/focus-change-1-no-change.html
new file mode 100644
index 0000000..d4008fc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-1-no-change.html
@@ -0,0 +1,27 @@
+<script src="../resources/js-test.js"></script>
+<p>Test no change of focus inside plugin onfocus and onblur events</p>
+<input id="input1" type="text" onfocus="i1Focus()" onblur="i1Blur()"></input>
+<input id="input2" type="text" onfocus="i2Focus()" onblur="i2Blur()"></input>
+<embed id="plugin" type="application/x-blink-test-plugin" onfocus="pFocus()" onblur="pBlur()"></embed>
+<script>
+function i1Focus() { debug('i1focus'); }
+function i1Blur() { debug('i1blur'); }
+function i2Focus() { debug('i2focus'); }
+function i2Blur() { debug('i2blur'); }
+function pFocus() { debug('pfocus'); }
+function pBlur() { debug('pblur'); }
+
+if (testRunner)
+  testRunner.waitUntilDone();
+
+document.getElementById('input1').focus();
+document.getElementById('plugin').focus();
+document.getElementById('input2').focus();
+
+setTimeout(
+    function() {
+      if (testRunner)
+        testRunner.notifyDone();
+    },
+    0);
+</script>
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-2-change-focus-expected.txt b/third_party/WebKit/LayoutTests/plugins/focus-change-2-change-focus-expected.txt
new file mode 100644
index 0000000..2d12191
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-2-change-focus-expected.txt
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+i1focus
+i1blur
+pfocus-change-2
+pblur
+i2focus
+i2blur
+i3focus
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test changing focus inside plugin onfocus event
+
+   
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-2-change-focus.html b/third_party/WebKit/LayoutTests/plugins/focus-change-2-change-focus.html
new file mode 100644
index 0000000..398ca383
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-2-change-focus.html
@@ -0,0 +1,33 @@
+<script src="../resources/js-test.js"></script>
+<p>Test changing focus inside plugin onfocus event</p>
+<input id="input1" type="text" onfocus="i1Focus()" onblur="i1Blur()"></input>
+<input id="input2" type="text" onfocus="i2Focus()" onblur="i2Blur()"></input>
+<input id="input3" type="text" onfocus="i3Focus()" onblur="i3Blur()"></input>
+<embed id="plugin" type="application/x-blink-test-plugin" onfocus="pFocus()" onblur="pBlur()"></embed>
+<script>
+function i1Focus() { debug('i1focus'); }
+function i1Blur() { debug('i1blur'); }
+function i2Focus() { debug('i2focus'); }
+function i2Blur() { debug('i2blur'); }
+function i3Focus() { debug('i3focus'); } 
+function i3Blur() { debug('i3blur'); }
+function pFocus() {
+  debug('pfocus-change-2');
+  document.getElementById('input2').focus();
+}
+function pBlur() { debug('pblur'); }
+
+if (testRunner)
+  testRunner.waitUntilDone();
+
+document.getElementById('input1').focus();
+document.getElementById('plugin').focus();
+document.getElementById('input3').focus();
+
+setTimeout(
+    function() {
+      if (testRunner)
+        testRunner.notifyDone();
+    },
+    0);
+</script>
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-3-change-blur-expected.txt b/third_party/WebKit/LayoutTests/plugins/focus-change-3-change-blur-expected.txt
new file mode 100644
index 0000000..14f5ccc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-3-change-blur-expected.txt
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+CONSOLE MESSAGE: Blink Test Plugin: DidChangeFocus(true)
+CONSOLE MESSAGE: Blink Test Plugin: DidChangeFocus(false)
+i1focus
+i1blur
+pfocus
+pblur-change-2
+i2focus
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test changing focus inside plugin onblur event
+
+   
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-3-change-blur.html b/third_party/WebKit/LayoutTests/plugins/focus-change-3-change-blur.html
new file mode 100644
index 0000000..4d67f70
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-3-change-blur.html
@@ -0,0 +1,33 @@
+<script src="../resources/js-test.js"></script>
+<p>Test changing focus inside plugin onblur event</p>
+<input id="input1" type="text" onfocus="i1Focus()" onblur="i1Blur()"></input>
+<input id="input2" type="text" onfocus="i2Focus()" onblur="i2Blur()"></input>
+<input id="input3" type="text" onfocus="i3Focus()" onblur="i3Blur()"></input>
+<embed id="plugin" type="application/x-blink-test-plugin" onfocus="pFocus()" onblur="pBlur()"></embed>
+<script>
+function i1Focus() { debug('i1focus'); }
+function i1Blur() { debug('i1blur'); }
+function i2Focus() { debug('i2focus'); }
+function i2Blur() { debug('i2blur'); }
+function i3Focus() { debug('i3focus'); } 
+function i3Blur() { debug('i3blur'); }
+function pFocus() { debug('pfocus'); }
+function pBlur() {
+  debug('pblur-change-2');
+  document.getElementById('input2').focus();
+}
+
+if (testRunner)
+  testRunner.waitUntilDone();
+
+document.getElementById('input1').focus();
+document.getElementById('plugin').focus();
+document.getElementById('input3').focus();
+
+setTimeout(
+    function() {
+      if (testRunner)
+        testRunner.notifyDone();
+    },
+    0);
+</script>
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-4-change-focus-and-blur-expected.txt b/third_party/WebKit/LayoutTests/plugins/focus-change-4-change-focus-and-blur-expected.txt
new file mode 100644
index 0000000..8c0f22a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-4-change-focus-and-blur-expected.txt
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: Blink Test Plugin: initializing
+i1focus
+i1blur
+pfocus-change-2
+pblur-change-4
+i4focus
+i4blur
+i3focus
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test changing focus inside plugin onfocus and onblur events
+
+    
diff --git a/third_party/WebKit/LayoutTests/plugins/focus-change-4-change-focus-and-blur.html b/third_party/WebKit/LayoutTests/plugins/focus-change-4-change-focus-and-blur.html
new file mode 100644
index 0000000..bb41ab98
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/plugins/focus-change-4-change-focus-and-blur.html
@@ -0,0 +1,39 @@
+<script src="../resources/js-test.js"></script>
+<p>Test changing focus inside plugin onfocus and onblur events</p>
+<input id="input1" type="text" onfocus="i1Focus()" onblur="i1Blur()"></input>
+<input id="input2" type="text" onfocus="i2Focus()" onblur="i2Blur()"></input>
+<input id="input3" type="text" onfocus="i3Focus()" onblur="i3Blur()"></input>
+<input id="input4" type="text" onfocus="i4Focus()" onblur="i4Blur()"></input>
+<embed id="plugin" type="application/x-blink-test-plugin" onfocus="pFocus()" onblur="pBlur()"></embed>
+<script>
+function i1Focus() { debug('i1focus'); }
+function i1Blur() { debug('i1blur'); }
+function i2Focus() { debug('i2focus'); }
+function i2Blur() { debug('i2blur'); }
+function i3Focus() { debug('i3focus'); } 
+function i3Blur() { debug('i3blur'); }
+function i4Focus() { debug('i4focus'); } 
+function i4Blur() { debug('i4blur'); }
+function pFocus() {
+  debug('pfocus-change-2');
+  document.getElementById('input2').focus();
+}
+function pBlur() {
+  debug('pblur-change-4');
+  document.getElementById('input4').focus();
+}
+
+if (testRunner)
+  testRunner.waitUntilDone();
+
+document.getElementById('input1').focus();
+document.getElementById('plugin').focus();
+document.getElementById('input3').focus();
+
+setTimeout(
+    function() {
+      if (testRunner)
+        testRunner.notifyDone();
+    },
+    0);
+</script>
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5
index 2a01c35..f4156ceb9 100644
--- a/third_party/WebKit/Source/core/css/CSSProperties.json5
+++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -923,6 +923,7 @@
     {
       name: "counter-reset",
       api_class: true,
+      api_methods: ["parseSingleValue"],
       custom_all: true,
     },
     {
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index d2657f8..92489f32 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -43,7 +43,6 @@
 #include "core/css/properties/CSSPropertyAPI.h"
 #include "core/css/properties/CSSPropertyAlignmentUtils.h"
 #include "core/css/properties/CSSPropertyColumnUtils.h"
-#include "core/css/properties/CSSPropertyCounterUtils.h"
 #include "core/css/properties/CSSPropertyDescriptor.h"
 #include "core/css/properties/CSSPropertyFontUtils.h"
 #include "core/css/properties/CSSPropertyLengthUtils.h"
@@ -552,15 +551,14 @@
 
 static CSSShadowValue* parseSingleShadow(CSSParserTokenRange& range,
                                          CSSParserMode cssParserMode,
-                                         bool allowInset,
-                                         bool allowSpread) {
+                                         bool allowInsetAndSpread) {
   CSSIdentifierValue* style = nullptr;
   CSSValue* color = nullptr;
 
   if (range.atEnd())
     return nullptr;
   if (range.peek().id() == CSSValueInset) {
-    if (!allowInset)
+    if (!allowInsetAndSpread)
       return nullptr;
     style = consumeIdent(range);
   }
@@ -583,7 +581,7 @@
     // Blur radius must be non-negative.
     if (blurRadius->getDoubleValue() < 0)
       return nullptr;
-    if (allowSpread)
+    if (allowInsetAndSpread)
       spreadDistance = consumeLength(range, cssParserMode, ValueRangeAll);
   }
 
@@ -591,7 +589,7 @@
     if (!color)
       color = consumeColor(range, cssParserMode);
     if (range.peek().id() == CSSValueInset) {
-      if (!allowInset || style)
+      if (!allowInsetAndSpread || style)
         return nullptr;
       style = consumeIdent(range);
     }
@@ -602,14 +600,14 @@
 
 static CSSValue* consumeShadow(CSSParserTokenRange& range,
                                CSSParserMode cssParserMode,
-                               bool isBoxShadowProperty) {
+                               bool allowInsetAndSpread) {
   if (range.peek().id() == CSSValueNone)
     return consumeIdent(range);
 
   CSSValueList* shadowValueList = CSSValueList::createCommaSeparated();
   do {
-    if (CSSShadowValue* shadowValue = parseSingleShadow(
-            range, cssParserMode, isBoxShadowProperty, isBoxShadowProperty))
+    if (CSSShadowValue* shadowValue =
+            parseSingleShadow(range, cssParserMode, allowInsetAndSpread))
       shadowValueList->append(*shadowValue);
     else
       return nullptr;
@@ -628,7 +626,7 @@
   CSSValue* parsedValue = nullptr;
 
   if (filterType == CSSValueDropShadow) {
-    parsedValue = parseSingleShadow(args, context->mode(), false, false);
+    parsedValue = parseSingleShadow(args, context->mode(), false);
   } else {
     if (args.atEnd()) {
       context->count(UseCounter::CSSFilterFunctionNoArguments);
@@ -1847,9 +1845,6 @@
       return CSSPropertyFontUtils::consumeFontFeatureSettings(m_range);
     case CSSPropertyFontWeight:
       return CSSPropertyFontUtils::consumeFontWeight(m_range);
-    case CSSPropertyCounterReset:
-      return CSSPropertyCounterUtils::consumeCounter(
-          m_range, CSSPropertyCounterUtils::kResetDefaultValue);
     case CSSPropertyMaxWidth:
     case CSSPropertyMaxHeight:
       return CSSPropertyLengthUtils::consumeMaxWidthOrHeight(
@@ -1925,9 +1920,9 @@
       return consumeBorderWidth(m_range, m_context->mode(), unitless);
     }
     case CSSPropertyTextShadow:
+      return consumeShadow(m_range, m_context->mode(), false);
     case CSSPropertyBoxShadow:
-      return consumeShadow(m_range, m_context->mode(),
-                           property == CSSPropertyBoxShadow);
+      return consumeShadow(m_range, m_context->mode(), true);
     case CSSPropertyFilter:
     case CSSPropertyBackdropFilter:
       return consumeFilter(m_range, m_context);
diff --git a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp
index 8492f68..9cd670d 100644
--- a/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp
+++ b/third_party/WebKit/Source/core/css/properties/CSSPropertyAPICounterReset.cpp
@@ -4,4 +4,15 @@
 
 #include "core/css/properties/CSSPropertyAPICounterReset.h"
 
-namespace blink {}  // namespace blink
+#include "core/css/properties/CSSPropertyCounterUtils.h"
+
+namespace blink {
+
+const CSSValue* CSSPropertyAPICounterReset::parseSingleValue(
+    CSSParserTokenRange& range,
+    const CSSParserContext&) {
+  return CSSPropertyCounterUtils::consumeCounter(
+      range, CSSPropertyCounterUtils::kResetDefaultValue);
+}
+
+}  // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 2f26115..2d23e78 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -375,20 +375,6 @@
   return true;
 }
 
-static FrameViewBase* frameViewBaseForElement(const Element& focusedElement) {
-  // Return either plugin or frame.
-  // TODO(joelhockey): FrameViewBase class will soon be removed.  It will be
-  // replaced with Focusable ABC that FrameView and PluginView will implement
-  // and this method will return Focusable.
-  if (isHTMLPlugInElement(focusedElement))
-    return toHTMLPlugInElement(focusedElement).plugin();
-
-  LayoutObject* layoutObject = focusedElement.layoutObject();
-  if (!layoutObject || !layoutObject->isLayoutPart())
-    return 0;
-  return toLayoutPart(layoutObject)->frameViewBase();
-}
-
 static bool acceptsEditingFocus(const Element& element) {
   DCHECK(hasEditableStyle(element));
 
@@ -4053,7 +4039,6 @@
     if (page() && (page()->focusController().isFocused())) {
       oldFocusedElement->dispatchBlurEvent(newFocusedElement, params.type,
                                            params.sourceCapabilities);
-
       if (m_focusedElement) {
         // handler shifted focus
         focusChangeBlocked = true;
@@ -4079,13 +4064,9 @@
       }
     }
 
-    if (view()) {
-      FrameViewBase* oldFrameViewBase =
-          frameViewBaseForElement(*oldFocusedElement);
-      if (oldFrameViewBase)
-        oldFrameViewBase->setFocused(false, params.type);
-      else
-        view()->setFocused(false, params.type);
+    if (isHTMLPlugInElement(oldFocusedElement)) {
+      if (PluginView* plugin = toHTMLPlugInElement(oldFocusedElement)->plugin())
+        plugin->setFocused(false, params.type);
     }
   }
 
@@ -4152,23 +4133,9 @@
     if (isRootEditableElement(*m_focusedElement))
       frame()->spellChecker().didBeginEditing(m_focusedElement.get());
 
-    // eww, I suck. set the qt focus correctly
-    // ### find a better place in the code for this
-    if (view()) {
-      FrameViewBase* focusFrameViewBase =
-          frameViewBaseForElement(*m_focusedElement);
-      if (focusFrameViewBase) {
-        // Make sure a FrameViewBase has the right size before giving it focus.
-        // Otherwise, we are testing edge cases of the FrameViewBase code.
-        // Specifically, in WebCore this does not work well for text fields.
-        updateStyleAndLayout();
-        // Re-get the FrameViewBase in case updating the layout changed things.
-        focusFrameViewBase = frameViewBaseForElement(*m_focusedElement);
-      }
-      if (focusFrameViewBase)
-        focusFrameViewBase->setFocused(true, params.type);
-      else
-        view()->setFocused(true, params.type);
+    if (isHTMLPlugInElement(m_focusedElement)) {
+      if (PluginView* plugin = toHTMLPlugInElement(m_focusedElement)->plugin())
+        plugin->setFocused(true, params.type);
     }
   }
 
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.cpp b/third_party/WebKit/Source/core/loader/LinkLoader.cpp
index e1ba30d..a04a8b3 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoader.cpp
@@ -209,6 +209,11 @@
   return WTF::nullopt;
 }
 
+Resource* LinkLoader::linkPreloadedResourceForTesting() {
+  return m_linkPreloadResourceClient ? m_linkPreloadResourceClient->resource()
+                                     : nullptr;
+}
+
 void LinkLoader::createLinkPreloadResourceClient(Resource* resource) {
   if (!resource)
     return;
diff --git a/third_party/WebKit/Source/core/loader/LinkLoader.h b/third_party/WebKit/Source/core/loader/LinkLoader.h
index 35472ce..0160a21 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoader.h
+++ b/third_party/WebKit/Source/core/loader/LinkLoader.h
@@ -103,6 +103,8 @@
   static WTF::Optional<Resource::Type> getResourceTypeFromAsAttribute(
       const String& as);
 
+  Resource* linkPreloadedResourceForTesting();
+
   DECLARE_TRACE();
 
  private:
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
index 24018a1..2d8f8c5 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -22,6 +22,8 @@
 
 namespace blink {
 
+namespace {
+
 class MockLinkLoaderClient final
     : public GarbageCollectedFinalized<MockLinkLoaderClient>,
       public LinkLoaderClient {
@@ -81,182 +83,176 @@
   mutable bool m_isCrossOrigin = false;
 };
 
-TEST(LinkLoaderTest, Preload) {
-  struct TestCase {
-    const char* href;
-    const char* as;
-    const char* type;
-    const char* media;
-    const ReferrerPolicy referrerPolicy;
-    const ResourceLoadPriority priority;
-    const WebURLRequest::RequestContext context;
-    const bool linkLoaderShouldLoadValue;
-    const bool expectingLoad;
-    const ReferrerPolicy expectedReferrerPolicy;
-  } cases[] = {
-      {"http://example.test/cat.jpg", "image", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityLow, WebURLRequest::RequestContextImage, true, true,
-       ReferrerPolicyDefault},
-      {"http://example.test/cat.js", "script", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityHigh, WebURLRequest::RequestContextScript, true,
-       true, ReferrerPolicyDefault},
-      {"http://example.test/cat.css", "style", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityVeryHigh, WebURLRequest::RequestContextStyle, true,
-       true, ReferrerPolicyDefault},
-      // TODO(yoav): It doesn't seem like the audio context is ever used. That
-      // should probably be fixed (or we can consolidate audio and video).
-      {"http://example.test/cat.wav", "audio", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true,
-       ReferrerPolicyDefault},
-      {"http://example.test/cat.mp4", "video", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true,
-       ReferrerPolicyDefault},
-      {"http://example.test/cat.vtt", "track", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityLow, WebURLRequest::RequestContextTrack, true, true,
-       ReferrerPolicyDefault},
-      {"http://example.test/cat.woff", "font", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityHigh, WebURLRequest::RequestContextFont, true, true,
-       ReferrerPolicyDefault},
-      // TODO(yoav): subresource should be *very* low priority (rather than
-      // low).
-      {"http://example.test/cat.empty", "", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityHigh, WebURLRequest::RequestContextSubresource, true,
-       true, ReferrerPolicyDefault},
-      {"http://example.test/cat.blob", "blabla", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false,
-       false, ReferrerPolicyDefault},
-      {"bla://example.test/cat.gif", "image", "", "", ReferrerPolicyDefault,
-       ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage,
-       false, false, ReferrerPolicyDefault},
-      // MIME type tests
-      {"http://example.test/cat.webp", "image", "image/webp", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.svg", "image", "image/svg+xml", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.jxr", "image", "image/jxr", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextImage, false, false, ReferrerPolicyDefault},
-      {"http://example.test/cat.js", "script", "text/javascript", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityHigh,
-       WebURLRequest::RequestContextScript, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.js", "script", "text/coffeescript", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextScript, false, false,
-       ReferrerPolicyDefault},
-      {"http://example.test/cat.css", "style", "text/css", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityVeryHigh,
-       WebURLRequest::RequestContextStyle, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.css", "style", "text/sass", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextStyle, false, false, ReferrerPolicyDefault},
-      {"http://example.test/cat.wav", "audio", "audio/wav", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextVideo, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.wav", "audio", "audio/mp57", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextVideo, false, false, ReferrerPolicyDefault},
-      {"http://example.test/cat.webm", "video", "video/webm", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextVideo, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.mp199", "video", "video/mp199", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextVideo, false, false, ReferrerPolicyDefault},
-      {"http://example.test/cat.vtt", "track", "text/vtt", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextTrack, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.vtt", "track", "text/subtitlething", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextTrack, false, false, ReferrerPolicyDefault},
-      {"http://example.test/cat.woff", "font", "font/woff2", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityHigh,
-       WebURLRequest::RequestContextFont, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.woff", "font", "font/woff84", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
-       WebURLRequest::RequestContextFont, false, false, ReferrerPolicyDefault},
-      {"http://example.test/cat.empty", "", "foo/bar", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityHigh,
-       WebURLRequest::RequestContextSubresource, true, true,
-       ReferrerPolicyDefault},
-      {"http://example.test/cat.blob", "blabla", "foo/bar", "",
-       ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextSubresource, false, false,
-       ReferrerPolicyDefault},
-      // Media tests
-      {"http://example.test/cat.gif", "image", "image/gif",
-       "(max-width: 600px)", ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, true, true, ReferrerPolicyDefault},
-      {"http://example.test/cat.gif", "image", "image/gif",
-       "(max-width: 400px)", ReferrerPolicyDefault,
-       ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, true,
-       false, ReferrerPolicyDefault},
-      {"http://example.test/cat.gif", "image", "image/gif",
-       "(max-width: 600px)", ReferrerPolicyDefault, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, false, false, ReferrerPolicyDefault},
-      // Referrer Policy
-      {"http://example.test/cat.gif", "image", "image/gif", "",
-       ReferrerPolicyOrigin, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, true, true, ReferrerPolicyOrigin},
-      {"http://example.test/cat.gif", "image", "image/gif", "",
-       ReferrerPolicyOriginWhenCrossOrigin, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, true, true,
-       ReferrerPolicyOriginWhenCrossOrigin},
-      {"http://example.test/cat.gif", "image", "image/gif", "",
-       ReferrerPolicyNever, ResourceLoadPriorityLow,
-       WebURLRequest::RequestContextImage, true, true, ReferrerPolicyNever},
-  };
+struct PreloadTestParams {
+  const char* href;
+  const char* as;
+  const char* type;
+  const char* media;
+  const ReferrerPolicy referrerPolicy;
+  const ResourceLoadPriority priority;
+  const WebURLRequest::RequestContext context;
+  const bool linkLoaderShouldLoadValue;
+  const bool expectingLoad;
+  const ReferrerPolicy expectedReferrerPolicy;
+};
 
-  // Test the cases with a single header
-  for (const auto& testCase : cases) {
-    std::unique_ptr<DummyPageHolder> dummyPageHolder =
-        DummyPageHolder::create(IntSize(500, 500));
-    dummyPageHolder->frame().settings()->setScriptEnabled(true);
-    Persistent<MockLinkLoaderClient> loaderClient =
-        MockLinkLoaderClient::create(testCase.linkLoaderShouldLoadValue);
-    LinkLoader* loader = LinkLoader::create(loaderClient.get());
-    KURL hrefURL = KURL(KURL(), testCase.href);
-    URLTestHelpers::registerMockedErrorURLLoad(hrefURL);
-    loader->loadLink(LinkRelAttribute("preload"), CrossOriginAttributeNotSet,
-                     testCase.type, testCase.as, testCase.media,
-                     testCase.referrerPolicy, hrefURL,
-                     dummyPageHolder->document(), NetworkHintsMock());
-    ASSERT_TRUE(dummyPageHolder->document().fetcher());
-    HeapListHashSet<Member<Resource>>* preloads =
-        dummyPageHolder->document().fetcher()->preloads();
-    if (testCase.expectingLoad) {
-      if (!preloads) {
-        fprintf(stderr, "Unexpected result %s %s %s\n", testCase.href,
-                testCase.as, testCase.type);
-      }
-      EXPECT_TRUE(preloads);
-    } else {
-      EXPECT_FALSE(preloads);
-    }
-    if (preloads) {
-      if (testCase.priority == ResourceLoadPriorityUnresolved) {
-        EXPECT_EQ(0u, preloads->size());
-      } else {
-        EXPECT_EQ(1u, preloads->size());
-        if (preloads->size() > 0) {
-          Resource* resource = preloads->begin().get()->get();
-          EXPECT_EQ(testCase.priority, resource->resourceRequest().priority());
-          EXPECT_EQ(testCase.context,
-                    resource->resourceRequest().requestContext());
-          if (testCase.expectedReferrerPolicy != ReferrerPolicyDefault) {
-            EXPECT_EQ(testCase.expectedReferrerPolicy,
-                      resource->resourceRequest().getReferrerPolicy());
-          }
-        }
-      }
-      dummyPageHolder->document().fetcher()->clearPreloads();
-    }
+class LinkLoaderPreloadTest
+    : public ::testing::TestWithParam<PreloadTestParams> {
+ public:
+  ~LinkLoaderPreloadTest() {
     Platform::current()
         ->getURLLoaderMockFactory()
         ->unregisterAllURLsAndClearMemoryCache();
   }
+};
+
+TEST_P(LinkLoaderPreloadTest, Preload) {
+  const auto& testCase = GetParam();
+  std::unique_ptr<DummyPageHolder> dummyPageHolder =
+      DummyPageHolder::create(IntSize(500, 500));
+  ResourceFetcher* fetcher = dummyPageHolder->document().fetcher();
+  ASSERT_TRUE(fetcher);
+  dummyPageHolder->frame().settings()->setScriptEnabled(true);
+  Persistent<MockLinkLoaderClient> loaderClient =
+      MockLinkLoaderClient::create(testCase.linkLoaderShouldLoadValue);
+  LinkLoader* loader = LinkLoader::create(loaderClient.get());
+  KURL hrefURL = KURL(KURL(), testCase.href);
+  URLTestHelpers::registerMockedErrorURLLoad(hrefURL);
+  loader->loadLink(LinkRelAttribute("preload"), CrossOriginAttributeNotSet,
+                   testCase.type, testCase.as, testCase.media,
+                   testCase.referrerPolicy, hrefURL,
+                   dummyPageHolder->document(), NetworkHintsMock());
+  if (testCase.expectingLoad &&
+      testCase.priority != ResourceLoadPriorityUnresolved) {
+    ASSERT_EQ(1, fetcher->countPreloads());
+    Resource* resource = loader->linkPreloadedResourceForTesting();
+    ASSERT_NE(resource, nullptr);
+    EXPECT_TRUE(fetcher->containsAsPreloadForTesting(resource));
+    EXPECT_EQ(testCase.priority, resource->resourceRequest().priority());
+    EXPECT_EQ(testCase.context, resource->resourceRequest().requestContext());
+    if (testCase.expectedReferrerPolicy != ReferrerPolicyDefault) {
+      EXPECT_EQ(testCase.expectedReferrerPolicy,
+                resource->resourceRequest().getReferrerPolicy());
+    }
+  } else {
+    ASSERT_EQ(0, fetcher->countPreloads());
+  }
 }
 
+constexpr PreloadTestParams kPreloadTestParams[] = {
+    {"http://example.test/cat.jpg", "image", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityLow, WebURLRequest::RequestContextImage, true, true,
+     ReferrerPolicyDefault},
+    {"http://example.test/cat.js", "script", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityHigh, WebURLRequest::RequestContextScript, true, true,
+     ReferrerPolicyDefault},
+    {"http://example.test/cat.css", "style", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityVeryHigh, WebURLRequest::RequestContextStyle, true,
+     true, ReferrerPolicyDefault},
+    // TODO(yoav): It doesn't seem like the audio context is ever used. That
+    // should probably be fixed (or we can consolidate audio and video).
+    {"http://example.test/cat.wav", "audio", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true,
+     ReferrerPolicyDefault},
+    {"http://example.test/cat.mp4", "video", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true,
+     ReferrerPolicyDefault},
+    {"http://example.test/cat.vtt", "track", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityLow, WebURLRequest::RequestContextTrack, true, true,
+     ReferrerPolicyDefault},
+    {"http://example.test/cat.woff", "font", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityHigh, WebURLRequest::RequestContextFont, true, true,
+     ReferrerPolicyDefault},
+    // TODO(yoav): subresource should be *very* low priority (rather than
+    // low).
+    {"http://example.test/cat.empty", "", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityHigh, WebURLRequest::RequestContextSubresource, true,
+     true, ReferrerPolicyDefault},
+    {"http://example.test/cat.blob", "blabla", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false,
+     false, ReferrerPolicyDefault},
+    {"bla://example.test/cat.gif", "image", "", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, false,
+     false, ReferrerPolicyDefault},
+    // MIME type tests
+    {"http://example.test/cat.webp", "image", "image/webp", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.svg", "image", "image/svg+xml", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.jxr", "image", "image/jxr", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextImage, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.js", "script", "text/javascript", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityHigh,
+     WebURLRequest::RequestContextScript, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.js", "script", "text/coffeescript", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextScript, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.css", "style", "text/css", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityVeryHigh,
+     WebURLRequest::RequestContextStyle, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.css", "style", "text/sass", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextStyle, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.wav", "audio", "audio/wav", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextVideo, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.wav", "audio", "audio/mp57", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextVideo, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.webm", "video", "video/webm", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextVideo, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.mp199", "video", "video/mp199", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextVideo, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.vtt", "track", "text/vtt", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextTrack, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.vtt", "track", "text/subtitlething", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextTrack, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.woff", "font", "font/woff2", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityHigh,
+     WebURLRequest::RequestContextFont, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.woff", "font", "font/woff84", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextFont, false, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.empty", "", "foo/bar", "", ReferrerPolicyDefault,
+     ResourceLoadPriorityHigh, WebURLRequest::RequestContextSubresource, true,
+     true, ReferrerPolicyDefault},
+    {"http://example.test/cat.blob", "blabla", "foo/bar", "",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextSubresource, false, false,
+     ReferrerPolicyDefault},
+    // Media tests
+    {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, true, true, ReferrerPolicyDefault},
+    {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 400px)",
+     ReferrerPolicyDefault, ResourceLoadPriorityUnresolved,
+     WebURLRequest::RequestContextImage, true, false, ReferrerPolicyDefault},
+    {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)",
+     ReferrerPolicyDefault, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, false, false, ReferrerPolicyDefault},
+    // Referrer Policy
+    {"http://example.test/cat.gif", "image", "image/gif", "",
+     ReferrerPolicyOrigin, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, true, true, ReferrerPolicyOrigin},
+    {"http://example.test/cat.gif", "image", "image/gif", "",
+     ReferrerPolicyOriginWhenCrossOrigin, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, true, true,
+     ReferrerPolicyOriginWhenCrossOrigin},
+    {"http://example.test/cat.gif", "image", "image/gif", "",
+     ReferrerPolicyNever, ResourceLoadPriorityLow,
+     WebURLRequest::RequestContextImage, true, true, ReferrerPolicyNever}};
+
+INSTANTIATE_TEST_CASE_P(LinkLoaderPreloadTest,
+                        LinkLoaderPreloadTest,
+                        ::testing::ValuesIn(kPreloadTestParams));
+
 TEST(LinkLoaderTest, Prefetch) {
   struct TestCase {
     const char* href;
@@ -377,4 +373,6 @@
   }
 }
 
+}  // namespace
+
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/loader/PingLoader.cpp b/third_party/WebKit/Source/core/loader/PingLoader.cpp
index 01744876..2a2af33 100644
--- a/third_party/WebKit/Source/core/loader/PingLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/PingLoader.cpp
@@ -281,8 +281,8 @@
 }
 
 PingLoaderImpl::~PingLoaderImpl() {
-  if (m_loader)
-    m_loader->cancel();
+  // TODO(kinuko): Turn this to DCHECK once crbug.com/662769 is resolved.
+  CHECK(!m_loader);
 }
 
 void PingLoaderImpl::dispose() {
diff --git a/third_party/WebKit/Source/core/loader/resource/LinkPreloadResourceClients.h b/third_party/WebKit/Source/core/loader/resource/LinkPreloadResourceClients.h
index e5b040e..e92ba95e 100644
--- a/third_party/WebKit/Source/core/loader/resource/LinkPreloadResourceClients.h
+++ b/third_party/WebKit/Source/core/loader/resource/LinkPreloadResourceClients.h
@@ -23,6 +23,7 @@
   virtual ~LinkPreloadResourceClient() {}
 
   void triggerEvents(const Resource*);
+  virtual Resource* resource() = 0;
   virtual void clear() = 0;
 
   DEFINE_INLINE_VIRTUAL_TRACE() { visitor->trace(m_loader); }
@@ -50,6 +51,9 @@
   virtual String debugName() const { return "LinkPreloadScript"; }
   virtual ~LinkPreloadScriptResourceClient() {}
 
+  Resource* resource() override {
+    return ResourceOwner<ScriptResource>::resource();
+  }
   void clear() override { clearResource(); }
 
   void notifyFinished(Resource* resource) override {
@@ -84,6 +88,9 @@
   virtual String debugName() const { return "LinkPreloadStyle"; }
   virtual ~LinkPreloadStyleResourceClient() {}
 
+  Resource* resource() override {
+    return ResourceOwner<CSSStyleSheetResource>::resource();
+  }
   void clear() override { clearResource(); }
 
   void setCSSStyleSheet(const String&,
@@ -122,6 +129,9 @@
   virtual String debugName() const { return "LinkPreloadImage"; }
   virtual ~LinkPreloadImageResourceClient() {}
 
+  Resource* resource() override {
+    return ResourceOwner<ImageResource>::resource();
+  }
   void clear() override { clearResource(); }
 
   void notifyFinished(Resource* resource) override {
@@ -155,6 +165,9 @@
   virtual String debugName() const { return "LinkPreloadFont"; }
   virtual ~LinkPreloadFontResourceClient() {}
 
+  Resource* resource() override {
+    return ResourceOwner<FontResource>::resource();
+  }
   void clear() override { clearResource(); }
 
   void notifyFinished(Resource* resource) override {
@@ -188,6 +201,9 @@
   virtual String debugName() const { return "LinkPreloadRaw"; }
   virtual ~LinkPreloadRawResourceClient() {}
 
+  Resource* resource() override {
+    return ResourceOwner<RawResource>::resource();
+  }
   void clear() override { clearResource(); }
 
   void notifyFinished(Resource* resource) override {
diff --git a/third_party/WebKit/Source/core/plugins/PluginView.h b/third_party/WebKit/Source/core/plugins/PluginView.h
index 97f23618..e0b2ed17 100644
--- a/third_party/WebKit/Source/core/plugins/PluginView.h
+++ b/third_party/WebKit/Source/core/plugins/PluginView.h
@@ -31,6 +31,7 @@
 #include "core/CoreExport.h"
 #include "platform/FrameViewBase.h"
 #include "platform/scroll/ScrollTypes.h"
+#include "public/platform/WebFocusType.h"
 #include "v8/include/v8.h"
 #include "wtf/text/WTFString.h"
 
@@ -45,6 +46,7 @@
 class CORE_EXPORT PluginView : public FrameViewBase {
  public:
   bool isPluginView() const final { return true; }
+  virtual void setFocused(bool, WebFocusType) {}
 
   virtual WebLayer* platformLayer() const { return 0; }
   virtual v8::Local<v8::Object> scriptableObject(v8::Isolate*) {
diff --git a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
index 99834dd..f167c51 100644
--- a/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
+++ b/third_party/WebKit/Source/modules/bluetooth/Bluetooth.cpp
@@ -153,7 +153,7 @@
                                        ExceptionState& exceptionState) {
   ExecutionContext* context = scriptState->getExecutionContext();
 
-  // If the incumbent settings object is not a secure context, reject promise
+  // If the Relevant settings object is not a secure context, reject promise
   // with a SecurityError and abort these steps.
   String errorMessage;
   if (!context->isSecureContext(errorMessage)) {
diff --git a/third_party/WebKit/Source/platform/FrameViewBase.h b/third_party/WebKit/Source/platform/FrameViewBase.h
index 2c3e03c..08c1acb2 100644
--- a/third_party/WebKit/Source/platform/FrameViewBase.h
+++ b/third_party/WebKit/Source/platform/FrameViewBase.h
@@ -32,7 +32,6 @@
 #include "platform/geometry/FloatPoint.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/heap/Handle.h"
-#include "public/platform/WebFocusType.h"
 #include "wtf/Forward.h"
 
 namespace blink {
@@ -73,8 +72,6 @@
   void invalidate() { invalidateRect(boundsRect()); }
   virtual void invalidateRect(const IntRect&) = 0;
 
-  virtual void setFocused(bool, WebFocusType) {}
-
   virtual void show() {}
   virtual void hide() {}
   bool isSelfVisible() const {
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
index ac49b8a..10e86d5 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -149,13 +149,13 @@
     if (!markers) {
       showSequenceUnderInvalidationError(
           "under-invalidation : unexpected subsequence", client, start, end);
-      DCHECK(false);
+      CHECK(false);
     }
     if (markers->end - markers->start != end - start) {
       showSequenceUnderInvalidationError(
           "under-invalidation: new subsequence wrong length", client, start,
           end);
-      DCHECK(false);
+      CHECK(false);
     }
   }
 
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
index a06b44a..46aef1e 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.h
@@ -139,8 +139,9 @@
   // Calling this method before main document resource is fetched is invalid.
   ResourceTimingInfo* getNavigationTimingInfo();
 
-  // This is only exposed for testing purposes.
-  HeapListHashSet<Member<Resource>>* preloads() { return m_preloads.get(); }
+  bool containsAsPreloadForTesting(Resource* resource) const {
+    return m_preloads && m_preloads->contains(resource);
+  }
 
   // Workaround for https://crbug.com/666214.
   // TODO(hiroshige): Remove this hack.
diff --git a/third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.h b/third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.h
index 1fc9c400..3a99ec8 100644
--- a/third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.h
+++ b/third_party/WebKit/Source/web/AnimationWorkletProxyClientImpl.h
@@ -7,9 +7,9 @@
 
 #include "core/dom/AnimationWorkletProxyClient.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Noncopyable.h"
 #include "web/CompositorAnimator.h"
 #include "web/CompositorProxyClientImpl.h"
-#include "wtf/Noncopyable.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/AssertMatchingEnums.cpp b/third_party/WebKit/Source/web/AssertMatchingEnums.cpp
index eb61d17..5e39367c 100644
--- a/third_party/WebKit/Source/web/AssertMatchingEnums.cpp
+++ b/third_party/WebKit/Source/web/AssertMatchingEnums.cpp
@@ -78,6 +78,8 @@
 #include "platform/text/TextDecoration.h"
 #include "platform/weborigin/ReferrerPolicy.h"
 #include "platform/weborigin/SchemeRegistry.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/text/StringImpl.h"
 #include "public/platform/WebApplicationCacheHost.h"
 #include "public/platform/WebClipboard.h"
 #include "public/platform/WebContentSecurityPolicy.h"
@@ -134,8 +136,6 @@
 #include "public/web/WebTextDecorationType.h"
 #include "public/web/WebTouchAction.h"
 #include "public/web/WebView.h"
-#include "wtf/Assertions.h"
-#include "wtf/text/StringImpl.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
index ede2d331..d19fddf 100644
--- a/third_party/WebKit/Source/web/ChromeClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ChromeClientImpl.cpp
@@ -31,6 +31,7 @@
 
 #include "web/ChromeClientImpl.h"
 
+#include <memory>
 #include "bindings/core/v8/ScriptController.h"
 #include "core/HTMLNames.h"
 #include "core/dom/AXObjectCache.h"
@@ -73,6 +74,12 @@
 #include "platform/geometry/IntRect.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/Optional.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/CString.h"
+#include "platform/wtf/text/CharacterNames.h"
+#include "platform/wtf/text/StringBuilder.h"
+#include "platform/wtf/text/StringConcatenate.h"
 #include "public/platform/WebCursorInfo.h"
 #include "public/platform/WebFloatRect.h"
 #include "public/platform/WebInputEvent.h"
@@ -117,13 +124,6 @@
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/Optional.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/CharacterNames.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringConcatenate.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ColorChooserUIController.cpp b/third_party/WebKit/Source/web/ColorChooserUIController.cpp
index 5f79b19a..c8cdaef 100644
--- a/third_party/WebKit/Source/web/ColorChooserUIController.cpp
+++ b/third_party/WebKit/Source/web/ColorChooserUIController.cpp
@@ -27,12 +27,12 @@
 
 #include "core/html/forms/ColorChooserClient.h"
 #include "platform/graphics/Color.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebColor.h"
 #include "public/web/WebColorChooser.h"
 #include "public/web/WebColorSuggestion.h"
 #include "public/web/WebFrameClient.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/CompositionUnderlineVectorBuilder.h b/third_party/WebKit/Source/web/CompositionUnderlineVectorBuilder.h
index e666901..a73bf86 100644
--- a/third_party/WebKit/Source/web/CompositionUnderlineVectorBuilder.h
+++ b/third_party/WebKit/Source/web/CompositionUnderlineVectorBuilder.h
@@ -32,9 +32,9 @@
 #define CompositionUnderlineVectorBuilder_h
 
 #include "core/editing/CompositionUnderline.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebCompositionUnderline.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
index f1287dc..69b5d2b6 100644
--- a/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
+++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.cpp
@@ -12,9 +12,9 @@
 #include "platform/graphics/CompositorMutatorClient.h"
 #include "platform/heap/Handle.h"
 #include "platform/instrumentation/tracing/TraceEvent.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "web/CompositorAnimator.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/CompositorMutatorImpl.h b/third_party/WebKit/Source/web/CompositorMutatorImpl.h
index 2a99df6..a113bf8 100644
--- a/third_party/WebKit/Source/web/CompositorMutatorImpl.h
+++ b/third_party/WebKit/Source/web/CompositorMutatorImpl.h
@@ -5,12 +5,12 @@
 #ifndef CompositorMutatorImpl_h
 #define CompositorMutatorImpl_h
 
+#include <memory>
 #include "core/animation/CustomCompositorAnimationManager.h"
 #include "platform/graphics/CompositorMutator.h"
 #include "platform/heap/Handle.h"
 #include "platform/heap/HeapAllocator.h"
-#include "wtf/Noncopyable.h"
-#include <memory>
+#include "platform/wtf/Noncopyable.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.cpp b/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.cpp
index 48890aa..f9f9d381 100644
--- a/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.cpp
+++ b/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.cpp
@@ -8,8 +8,8 @@
 #include "modules/compositorworker/CompositorWorkerGlobalScope.h"
 #include "platform/graphics/CompositorMutableStateProvider.h"
 #include "platform/instrumentation/tracing/TraceEvent.h"
+#include "platform/wtf/CurrentTime.h"
 #include "web/CompositorMutatorImpl.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.h b/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.h
index 5f9a600..1ad4f27 100644
--- a/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.h
+++ b/third_party/WebKit/Source/web/CompositorWorkerProxyClientImpl.h
@@ -7,9 +7,9 @@
 
 #include "core/dom/CompositorWorkerProxyClient.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Noncopyable.h"
 #include "web/CompositorAnimator.h"
 #include "web/CompositorProxyClientImpl.h"
-#include "wtf/Noncopyable.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ContextMenuAllowedScope.h b/third_party/WebKit/Source/web/ContextMenuAllowedScope.h
index 600cbd3..c76ad34 100644
--- a/third_party/WebKit/Source/web/ContextMenuAllowedScope.h
+++ b/third_party/WebKit/Source/web/ContextMenuAllowedScope.h
@@ -5,7 +5,7 @@
 #ifndef ContextMenuAllowedScope_h
 #define ContextMenuAllowedScope_h
 
-#include "wtf/Allocator.h"
+#include "platform/wtf/Allocator.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
index 032fe49..819b217 100644
--- a/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp
@@ -61,6 +61,7 @@
 #include "platform/exported/WrappedResourceResponse.h"
 #include "platform/text/TextBreakIterator.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebPoint.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
@@ -79,7 +80,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/DEPS b/third_party/WebKit/Source/web/DEPS
index 0c646884..bdd4bc35 100644
--- a/third_party/WebKit/Source/web/DEPS
+++ b/third_party/WebKit/Source/web/DEPS
@@ -13,4 +13,7 @@
     "+third_party/skia",
     "+ui/gfx/geometry",
     "+web",
+
+    # Use platform/wtf/ now (see crbug.com/691465).
+    "-wtf/",
 ]
diff --git a/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.cpp b/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.cpp
index 0a6687d..d6e6810 100644
--- a/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.cpp
+++ b/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.cpp
@@ -34,6 +34,7 @@
 #include "core/workers/DedicatedWorkerMessagingProxy.h"
 #include "core/workers/Worker.h"
 #include "core/workers/WorkerClients.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebContentSettingsClient.h"
 #include "public/platform/WebString.h"
 #include "public/web/WebFrameClient.h"
@@ -43,7 +44,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/WorkerContentSettingsClient.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.h b/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.h
index 0bf4014..d40ddc8f 100644
--- a/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.h
+++ b/third_party/WebKit/Source/web/DedicatedWorkerMessagingProxyProviderImpl.h
@@ -32,7 +32,7 @@
 #define DedicatedWorkerMessagingProxyProviderImpl_h
 
 #include "core/workers/DedicatedWorkerMessagingProxyProvider.h"
-#include "wtf/Noncopyable.h"
+#include "platform/wtf/Noncopyable.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.cpp b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
index cbfedf4..c2d030a 100644
--- a/third_party/WebKit/Source/web/DevToolsEmulator.cpp
+++ b/third_party/WebKit/Source/web/DevToolsEmulator.cpp
@@ -16,12 +16,12 @@
 #include "platform/geometry/IntRect.h"
 #include "platform/geometry/IntSize.h"
 #include "platform/loader/fetch/MemoryCache.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebLayerTreeView.h"
 #include "web/WebInputEventConversion.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace {
 
diff --git a/third_party/WebKit/Source/web/DevToolsEmulator.h b/third_party/WebKit/Source/web/DevToolsEmulator.h
index 1fc21b5c..22753dd 100644
--- a/third_party/WebKit/Source/web/DevToolsEmulator.h
+++ b/third_party/WebKit/Source/web/DevToolsEmulator.h
@@ -5,15 +5,15 @@
 #ifndef DevToolsEmulator_h
 #define DevToolsEmulator_h
 
+#include <memory>
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Forward.h"
+#include "platform/wtf/Optional.h"
 #include "public/platform/PointerProperties.h"
 #include "public/platform/WebFloatPoint.h"
 #include "public/platform/WebViewportStyle.h"
 #include "public/web/WebDeviceEmulationParams.h"
 #include "web/WebExport.h"
-#include "wtf/Forward.h"
-#include "wtf/Optional.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/EditorClientImpl.h b/third_party/WebKit/Source/web/EditorClientImpl.h
index f4535c1..35579e0d0 100644
--- a/third_party/WebKit/Source/web/EditorClientImpl.h
+++ b/third_party/WebKit/Source/web/EditorClientImpl.h
@@ -32,7 +32,7 @@
 #define EditorClientImpl_h
 
 #include "core/page/EditorClient.h"
-#include "wtf/Forward.h"
+#include "platform/wtf/Forward.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp b/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp
index 31d6ef2..5a04af3 100644
--- a/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp
+++ b/third_party/WebKit/Source/web/ExternalDateTimeChooser.cpp
@@ -28,11 +28,11 @@
 #include "core/InputTypeNames.h"
 #include "core/html/forms/DateTimeChooserClient.h"
 #include "platform/RuntimeEnabledFeatures.h"
+#include "platform/wtf/text/AtomicString.h"
 #include "public/web/WebDateTimeChooserCompletion.h"
 #include "public/web/WebDateTimeChooserParams.h"
 #include "public/web/WebViewClient.h"
 #include "web/ChromeClientImpl.h"
-#include "wtf/text/AtomicString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
index d8e0c51..d4b345c 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
+++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -42,6 +42,7 @@
 #include "platform/geometry/FloatQuad.h"
 #include "platform/geometry/IntPoint.h"
 #include "platform/text/TextDirection.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebMouseEvent.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebExternalPopupMenu.h"
@@ -50,7 +51,6 @@
 #include "public/web/WebPopupMenuInfo.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.h b/third_party/WebKit/Source/web/ExternalPopupMenu.h
index dec44f1d..b24f06a 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenu.h
+++ b/third_party/WebKit/Source/web/ExternalPopupMenu.h
@@ -31,14 +31,14 @@
 #ifndef ExternalPopupMenu_h
 #define ExternalPopupMenu_h
 
+#include <memory>
 #include "platform/PopupMenu.h"
 #include "platform/Timer.h"
+#include "platform/wtf/Compiler.h"
 #include "public/platform/WebCanvas.h"
 #include "public/platform/WebScrollbar.h"
 #include "public/web/WebExternalPopupMenuClient.h"
 #include "web/WebExport.h"
-#include "wtf/Compiler.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/InspectorOverlay.cpp b/third_party/WebKit/Source/web/InspectorOverlay.cpp
index c6fbc27f..d24af87 100644
--- a/third_party/WebKit/Source/web/InspectorOverlay.cpp
+++ b/third_party/WebKit/Source/web/InspectorOverlay.cpp
@@ -54,6 +54,7 @@
 #include "platform/graphics/Color.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/paint/CullRect.h"
+#include "platform/wtf/AutoReset.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "v8/include/v8.h"
@@ -61,7 +62,6 @@
 #include "web/PageOverlay.h"
 #include "web/WebInputEventConversion.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/AutoReset.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/InspectorOverlay.h b/third_party/WebKit/Source/web/InspectorOverlay.h
index 341fd36..6a713be 100644
--- a/third_party/WebKit/Source/web/InspectorOverlay.h
+++ b/third_party/WebKit/Source/web/InspectorOverlay.h
@@ -29,6 +29,8 @@
 #ifndef InspectorOverlay_h
 #define InspectorOverlay_h
 
+#include <v8-inspector.h>
+#include <memory>
 #include "core/inspector/InspectorDOMAgent.h"
 #include "core/inspector/InspectorOverlayHost.h"
 #include "core/inspector/protocol/Forward.h"
@@ -37,11 +39,9 @@
 #include "platform/geometry/LayoutRect.h"
 #include "platform/graphics/Color.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/RefPtr.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebInputEvent.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
-#include <memory>
-#include <v8-inspector.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
index a5f44dc..49bd5397a 100644
--- a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
+++ b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
@@ -25,6 +25,7 @@
 
 #include "web/LinkHighlightImpl.h"
 
+#include <memory>
 #include "core/dom/DOMNodeIds.h"
 #include "core/dom/LayoutTreeBuilderTraversal.h"
 #include "core/dom/Node.h"
@@ -47,6 +48,9 @@
 #include "platform/graphics/paint/DrawingRecorder.h"
 #include "platform/graphics/paint/PaintCanvas.h"
 #include "platform/graphics/paint/PaintRecorder.h"
+#include "platform/wtf/CurrentTime.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCompositorSupport.h"
 #include "public/platform/WebContentLayer.h"
@@ -61,10 +65,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/Vector.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.h b/third_party/WebKit/Source/web/LinkHighlightImpl.h
index b9eecac..c4d0954 100644
--- a/third_party/WebKit/Source/web/LinkHighlightImpl.h
+++ b/third_party/WebKit/Source/web/LinkHighlightImpl.h
@@ -26,17 +26,17 @@
 #ifndef LinkHighlightImpl_h
 #define LinkHighlightImpl_h
 
+#include <memory>
 #include "platform/animation/CompositorAnimationDelegate.h"
 #include "platform/animation/CompositorAnimationPlayer.h"
 #include "platform/animation/CompositorAnimationPlayerClient.h"
 #include "platform/graphics/LinkHighlight.h"
 #include "platform/graphics/Path.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Forward.h"
 #include "public/platform/WebContentLayer.h"
 #include "public/platform/WebContentLayerClient.h"
 #include "web/WebExport.h"
-#include "wtf/Forward.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
index ef8d70e..bcf4dcc 100644
--- a/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
+++ b/third_party/WebKit/Source/web/LinkHighlightImplTest.cpp
@@ -35,6 +35,7 @@
 #include "platform/geometry/IntRect.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebContentLayer.h"
 #include "public/platform/WebFloatPoint.h"
@@ -49,7 +50,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LocalFileSystemClient.cpp b/third_party/WebKit/Source/web/LocalFileSystemClient.cpp
index 2ca9f49e..3305aab0b 100644
--- a/third_party/WebKit/Source/web/LocalFileSystemClient.cpp
+++ b/third_party/WebKit/Source/web/LocalFileSystemClient.cpp
@@ -36,10 +36,10 @@
 #include "core/workers/WorkerGlobalScope.h"
 #include "platform/ContentSettingCallbacks.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/WTFString.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WorkerContentSettingsClient.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LocalFileSystemClient.h b/third_party/WebKit/Source/web/LocalFileSystemClient.h
index b1029eb..dc4ad2d 100644
--- a/third_party/WebKit/Source/web/LocalFileSystemClient.h
+++ b/third_party/WebKit/Source/web/LocalFileSystemClient.h
@@ -31,9 +31,9 @@
 #ifndef LocalFileSystemClient_h
 #define LocalFileSystemClient_h
 
-#include "modules/filesystem/FileSystemClient.h"
-#include "wtf/Forward.h"
 #include <memory>
+#include "modules/filesystem/FileSystemClient.h"
+#include "platform/wtf/Forward.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
index 9aac7c6..e68af02 100644
--- a/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
+++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.cpp
@@ -73,6 +73,10 @@
 #include "platform/network/HTTPParsers.h"
 #include "platform/network/mime/MIMETypeRegistry.h"
 #include "platform/plugins/PluginData.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/StringExtras.h"
+#include "platform/wtf/text/CString.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebApplicationCacheHost.h"
 #include "public/platform/WebMediaPlayerSource.h"
@@ -101,10 +105,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/StringExtras.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
 
 #include <memory>
 
diff --git a/third_party/WebKit/Source/web/LocalFrameClientImpl.h b/third_party/WebKit/Source/web/LocalFrameClientImpl.h
index 6228f89..d68051f 100644
--- a/third_party/WebKit/Source/web/LocalFrameClientImpl.h
+++ b/third_party/WebKit/Source/web/LocalFrameClientImpl.h
@@ -35,8 +35,8 @@
 #include "core/frame/LocalFrameClient.h"
 #include "platform/heap/Handle.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/RefPtr.h"
 #include "public/platform/WebInsecureRequestPolicy.h"
-#include "wtf/RefPtr.h"
 
 #include <memory>
 
diff --git a/third_party/WebKit/Source/web/OpenedFrameTracker.h b/third_party/WebKit/Source/web/OpenedFrameTracker.h
index aadfda2..54e902c2 100644
--- a/third_party/WebKit/Source/web/OpenedFrameTracker.h
+++ b/third_party/WebKit/Source/web/OpenedFrameTracker.h
@@ -5,8 +5,8 @@
 #ifndef OpenedFrameTracker_h
 #define OpenedFrameTracker_h
 
-#include "wtf/HashSet.h"
-#include "wtf/Noncopyable.h"
+#include "platform/wtf/HashSet.h"
+#include "platform/wtf/Noncopyable.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/PageOverlay.cpp b/third_party/WebKit/Source/web/PageOverlay.cpp
index fee8fd2..96c4913 100644
--- a/third_party/WebKit/Source/web/PageOverlay.cpp
+++ b/third_party/WebKit/Source/web/PageOverlay.cpp
@@ -37,12 +37,12 @@
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/GraphicsLayerClient.h"
 #include "platform/scroll/MainThreadScrollingReason.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebLayer.h"
 #include "public/web/WebViewClient.h"
 #include "web/WebDevToolsAgentImpl.h"
 #include "web/WebFrameWidgetImpl.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/PageOverlay.h b/third_party/WebKit/Source/web/PageOverlay.h
index d0b7f8b..5a273869 100644
--- a/third_party/WebKit/Source/web/PageOverlay.h
+++ b/third_party/WebKit/Source/web/PageOverlay.h
@@ -29,12 +29,12 @@
 #ifndef PageOverlay_h
 #define PageOverlay_h
 
+#include <memory>
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/GraphicsLayerClient.h"
 #include "platform/graphics/paint/DisplayItemClient.h"
+#include "platform/wtf/text/WTFString.h"
 #include "web/WebExport.h"
-#include "wtf/text/WTFString.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/PageWidgetDelegate.cpp b/third_party/WebKit/Source/web/PageWidgetDelegate.cpp
index 35defa69b..0295d8a 100644
--- a/third_party/WebKit/Source/web/PageWidgetDelegate.cpp
+++ b/third_party/WebKit/Source/web/PageWidgetDelegate.cpp
@@ -43,9 +43,9 @@
 #include "platform/graphics/paint/DrawingRecorder.h"
 #include "platform/graphics/paint/PaintRecordBuilder.h"
 #include "platform/transforms/AffineTransform.h"
+#include "platform/wtf/CurrentTime.h"
 #include "public/platform/WebInputEvent.h"
 #include "web/WebInputEventConversion.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/PrerendererClientImpl.h b/third_party/WebKit/Source/web/PrerendererClientImpl.h
index 17d9a9c..1d3dc75 100644
--- a/third_party/WebKit/Source/web/PrerendererClientImpl.h
+++ b/third_party/WebKit/Source/web/PrerendererClientImpl.h
@@ -33,8 +33,8 @@
 #define PrerendererClientImpl_h
 
 #include "core/loader/PrerendererClient.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
index b9ec5941..f85662a 100644
--- a/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
+++ b/third_party/WebKit/Source/web/RemoteFrameClientImpl.cpp
@@ -4,6 +4,7 @@
 
 #include "web/RemoteFrameClientImpl.h"
 
+#include <memory>
 #include "core/events/KeyboardEvent.h"
 #include "core/events/MouseEvent.h"
 #include "core/events/WheelEvent.h"
@@ -15,12 +16,11 @@
 #include "platform/geometry/IntRect.h"
 #include "platform/weborigin/SecurityOrigin.h"
 #include "platform/weborigin/SecurityPolicy.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/web/WebRemoteFrameClient.h"
 #include "web/WebInputEventConversion.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebRemoteFrameImpl.h"
-#include "wtf/PtrUtil.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index 87b0531..0b49db4 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -72,15 +72,15 @@
 #include "modules/serviceworkers/WaitUntilObserver.h"
 #include "platform/CrossThreadFunctional.h"
 #include "platform/RuntimeEnabledFeatures.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/Functional.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/modules/notifications/WebNotificationData.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
 #include "public/web/WebSerializedScriptValue.h"
 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
 #include "web/WebEmbeddedWorkerImpl.h"
-#include "wtf/Assertions.h"
-#include "wtf/Functional.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
index 44e3be6..93a48bf5 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.h
@@ -31,14 +31,14 @@
 #ifndef ServiceWorkerGlobalScopeProxy_h
 #define ServiceWorkerGlobalScopeProxy_h
 
+#include <memory>
 #include "core/workers/WorkerReportingProxy.h"
 #include "platform/heap/Handle.h"
 #include "platform/heap/HeapAllocator.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/Forward.h"
 #include "public/platform/WebString.h"
 #include "public/web/modules/serviceworker/WebServiceWorkerContextProxy.h"
-#include "wtf/Forward.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp
index 2ff5c47..e7937829 100644
--- a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp
+++ b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.cpp
@@ -39,6 +39,7 @@
 #include "core/probe/CoreProbes.h"
 #include "core/workers/SharedWorker.h"
 #include "platform/loader/fetch/ResourceResponse.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebContentSecurityPolicy.h"
 #include "public/platform/WebMessagePortChannel.h"
 #include "public/platform/WebString.h"
@@ -50,7 +51,6 @@
 #include "public/web/WebSharedWorkerCreationErrors.h"
 #include "public/web/WebSharedWorkerRepositoryClient.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h
index 1b0e381..1d384bce 100644
--- a/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h
+++ b/third_party/WebKit/Source/web/SharedWorkerRepositoryClientImpl.h
@@ -31,11 +31,11 @@
 #ifndef SharedWorkerRepositoryClientImpl_h
 #define SharedWorkerRepositoryClientImpl_h
 
-#include "core/workers/SharedWorkerRepositoryClient.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/PtrUtil.h"
 #include <memory>
+#include "core/workers/SharedWorkerRepositoryClient.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/PassRefPtr.h"
+#include "platform/wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp
index 63d3afd..ade3816 100644
--- a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp
+++ b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.cpp
@@ -25,6 +25,7 @@
 
 #include "web/SpeechRecognitionClientProxy.h"
 
+#include <memory>
 #include "core/dom/ExecutionContext.h"
 #include "modules/mediastream/MediaStreamTrack.h"
 #include "modules/speech/SpeechGrammarList.h"
@@ -34,6 +35,8 @@
 #include "modules/speech/SpeechRecognitionResultList.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/PassRefPtr.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebMediaStreamTrack.h"
 #include "public/platform/WebSecurityOrigin.h"
 #include "public/web/WebSpeechGrammar.h"
@@ -41,9 +44,6 @@
 #include "public/web/WebSpeechRecognitionParams.h"
 #include "public/web/WebSpeechRecognitionResult.h"
 #include "public/web/WebSpeechRecognizer.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/PtrUtil.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h
index 0ad3592..fb95e79c 100644
--- a/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h
+++ b/third_party/WebKit/Source/web/SpeechRecognitionClientProxy.h
@@ -26,11 +26,11 @@
 #ifndef SpeechRecognitionClientProxy_h
 #define SpeechRecognitionClientProxy_h
 
-#include "modules/speech/SpeechRecognitionClient.h"
-#include "public/web/WebSpeechRecognizerClient.h"
-#include "wtf/Compiler.h"
-#include "wtf/text/WTFString.h"
 #include <memory>
+#include "modules/speech/SpeechRecognitionClient.h"
+#include "platform/wtf/Compiler.h"
+#include "platform/wtf/text/WTFString.h"
+#include "public/web/WebSpeechRecognizerClient.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/StorageClientImpl.cpp b/third_party/WebKit/Source/web/StorageClientImpl.cpp
index 05133b42..87a6dda 100644
--- a/third_party/WebKit/Source/web/StorageClientImpl.cpp
+++ b/third_party/WebKit/Source/web/StorageClientImpl.cpp
@@ -28,10 +28,10 @@
 #include <memory>
 #include "core/frame/ContentSettingsClient.h"
 #include "modules/storage/StorageNamespace.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebStorageNamespace.h"
 #include "public/web/WebViewClient.h"
 #include "web/WebViewImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/StorageQuotaClientImpl.h b/third_party/WebKit/Source/web/StorageQuotaClientImpl.h
index 5743f76f..02c3b0db 100644
--- a/third_party/WebKit/Source/web/StorageQuotaClientImpl.h
+++ b/third_party/WebKit/Source/web/StorageQuotaClientImpl.h
@@ -32,7 +32,7 @@
 #define StorageQuotaClientImpl_h
 
 #include "modules/quota/StorageQuotaClient.h"
-#include "wtf/Forward.h"
+#include "platform/wtf/Forward.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp b/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp
index 9fca9851..955c31e 100644
--- a/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp
+++ b/third_party/WebKit/Source/web/SuspendableScriptExecutor.cpp
@@ -15,10 +15,10 @@
 #include "core/dom/TaskRunnerHelper.h"
 #include "core/frame/LocalFrame.h"
 #include "platform/UserGestureIndicator.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebScriptExecutionCallback.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/SuspendableScriptExecutor.h b/third_party/WebKit/Source/web/SuspendableScriptExecutor.h
index 92654c2..27b8b4f 100644
--- a/third_party/WebKit/Source/web/SuspendableScriptExecutor.h
+++ b/third_party/WebKit/Source/web/SuspendableScriptExecutor.h
@@ -9,9 +9,9 @@
 #include "core/frame/SuspendableTimer.h"
 #include "platform/heap/Handle.h"
 #include "platform/heap/SelfKeepAlive.h"
+#include "platform/wtf/RefPtr.h"
+#include "platform/wtf/Vector.h"
 #include "v8/include/v8.h"
-#include "wtf/RefPtr.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/TextFinder.cpp b/third_party/WebKit/Source/web/TextFinder.cpp
index 2574860..105f995 100644
--- a/third_party/WebKit/Source/web/TextFinder.cpp
+++ b/third_party/WebKit/Source/web/TextFinder.cpp
@@ -46,6 +46,7 @@
 #include "modules/accessibility/AXObjectCacheImpl.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/Timer.h"
+#include "platform/wtf/CurrentTime.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebAXObject.h"
 #include "public/web/WebFindOptions.h"
@@ -54,7 +55,6 @@
 #include "web/FindInPageCoordinates.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/TextFinder.h b/third_party/WebKit/Source/web/TextFinder.h
index ea5dd0a..ce4dbed 100644
--- a/third_party/WebKit/Source/web/TextFinder.h
+++ b/third_party/WebKit/Source/web/TextFinder.h
@@ -34,15 +34,15 @@
 #include "core/editing/FindOptions.h"
 #include "platform/geometry/FloatRect.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/PassRefPtr.h"
+#include "platform/wtf/Vector.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebFloatPoint.h"
 #include "public/platform/WebFloatRect.h"
 #include "public/platform/WebRect.h"
 #include "public/web/WebFindOptions.h"
 #include "web/WebExport.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/UserMediaClientImpl.cpp b/third_party/WebKit/Source/web/UserMediaClientImpl.cpp
index 90f2662..6622d9b 100644
--- a/third_party/WebKit/Source/web/UserMediaClientImpl.cpp
+++ b/third_party/WebKit/Source/web/UserMediaClientImpl.cpp
@@ -30,13 +30,13 @@
 
 #include "web/UserMediaClientImpl.h"
 
+#include "platform/wtf/RefPtr.h"
 #include "public/web/WebFrameClient.h"
 #include "public/web/WebMediaDeviceChangeObserver.h"
 #include "public/web/WebMediaDevicesRequest.h"
 #include "public/web/WebUserMediaClient.h"
 #include "public/web/WebUserMediaRequest.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/RefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/UserMediaClientImpl.h b/third_party/WebKit/Source/web/UserMediaClientImpl.h
index cd8818f9..db1b2e3 100644
--- a/third_party/WebKit/Source/web/UserMediaClientImpl.h
+++ b/third_party/WebKit/Source/web/UserMediaClientImpl.h
@@ -32,7 +32,7 @@
 #define UserMediaClientImpl_h
 
 #include "modules/mediastream/UserMediaClient.h"
-#include "wtf/PassRefPtr.h"
+#include "platform/wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ValidationMessageClientImpl.cpp b/third_party/WebKit/Source/web/ValidationMessageClientImpl.cpp
index c740f751..d5be723 100644
--- a/third_party/WebKit/Source/web/ValidationMessageClientImpl.cpp
+++ b/third_party/WebKit/Source/web/ValidationMessageClientImpl.cpp
@@ -29,12 +29,12 @@
 #include "core/dom/TaskRunnerHelper.h"
 #include "core/frame/FrameView.h"
 #include "platform/HostWindow.h"
+#include "platform/wtf/CurrentTime.h"
 #include "public/platform/WebRect.h"
 #include "public/platform/WebString.h"
 #include "public/web/WebTextDirection.h"
 #include "public/web/WebViewClient.h"
 #include "web/WebViewImpl.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/ValidationMessageClientImpl.h b/third_party/WebKit/Source/web/ValidationMessageClientImpl.h
index 57a1519..7d644b6 100644
--- a/third_party/WebKit/Source/web/ValidationMessageClientImpl.h
+++ b/third_party/WebKit/Source/web/ValidationMessageClientImpl.h
@@ -30,7 +30,7 @@
 #include "platform/Timer.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/heap/Handle.h"
-#include "wtf/text/WTFString.h"
+#include "platform/wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebAXObject.cpp b/third_party/WebKit/Source/web/WebAXObject.cpp
index bafe38a..595474e 100644
--- a/third_party/WebKit/Source/web/WebAXObject.cpp
+++ b/third_party/WebKit/Source/web/WebAXObject.cpp
@@ -39,14 +39,15 @@
 #include "core/frame/FrameView.h"
 #include "core/frame/VisualViewport.h"
 #include "core/input/KeyboardEventManager.h"
-#include "core/style/ComputedStyle.h"
 #include "core/page/Page.h"
+#include "core/style/ComputedStyle.h"
 #include "modules/accessibility/AXObject.h"
 #include "modules/accessibility/AXObjectCacheImpl.h"
 #include "modules/accessibility/AXTable.h"
 #include "modules/accessibility/AXTableCell.h"
 #include "modules/accessibility/AXTableColumn.h"
 #include "modules/accessibility/AXTableRow.h"
+#include "platform/wtf/text/StringBuilder.h"
 #include "public/platform/WebFloatRect.h"
 #include "public/platform/WebPoint.h"
 #include "public/platform/WebRect.h"
@@ -57,7 +58,6 @@
 #include "public/web/WebNode.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/text/StringBuilder.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
index 627ab987..6a539bb 100644
--- a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
+++ b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.cpp
@@ -44,6 +44,9 @@
 #include "platform/loader/fetch/FetchUtils.h"
 #include "platform/loader/fetch/ResourceError.h"
 #include "platform/network/HTTPParsers.h"
+#include "platform/wtf/HashSet.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebHTTPHeaderVisitor.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebURLError.h"
@@ -51,9 +54,6 @@
 #include "public/web/WebAssociatedURLLoaderClient.h"
 #include "public/web/WebDataSource.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/HashSet.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h
index 3d8eb06..d9ff6e80 100644
--- a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h
+++ b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImpl.h
@@ -5,12 +5,12 @@
 #ifndef WebAssociatedURLLoaderImpl_h
 #define WebAssociatedURLLoaderImpl_h
 
+#include <memory>
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/RefPtr.h"
 #include "public/web/WebAssociatedURLLoader.h"
 #include "public/web/WebAssociatedURLLoaderOptions.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/RefPtr.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImplTest.cpp b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImplTest.cpp
index 1ef43de6..98daa43 100644
--- a/third_party/WebKit/Source/web/WebAssociatedURLLoaderImplTest.cpp
+++ b/third_party/WebKit/Source/web/WebAssociatedURLLoaderImplTest.cpp
@@ -33,6 +33,9 @@
 #include <memory>
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/CString.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebThread.h"
@@ -46,9 +49,6 @@
 #include "public/web/WebView.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
 
 using blink::URLTestHelpers::toKURL;
 using blink::testing::runPendingTasks;
diff --git a/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp b/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp
index 027e4f5..59c8792 100644
--- a/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp
+++ b/third_party/WebKit/Source/web/WebDOMActivityLogger.cpp
@@ -30,14 +30,14 @@
 
 #include "public/web/WebDOMActivityLogger.h"
 
+#include <memory>
 #include "bindings/core/v8/V8Binding.h"
 #include "bindings/core/v8/V8DOMActivityLogger.h"
 #include "core/dom/Document.h"
 #include "core/frame/LocalDOMWindow.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/WTFString.h"
-#include <memory>
+#include "platform/wtf/PassRefPtr.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDOMEvent.cpp b/third_party/WebKit/Source/web/WebDOMEvent.cpp
index 62ec5e9..f456b17 100644
--- a/third_party/WebKit/Source/web/WebDOMEvent.cpp
+++ b/third_party/WebKit/Source/web/WebDOMEvent.cpp
@@ -31,7 +31,7 @@
 #include "public/web/WebDOMEvent.h"
 
 #include "core/events/Event.h"
-#include "wtf/PassRefPtr.h"
+#include "platform/wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp
index 1f32c07..52d0c303 100644
--- a/third_party/WebKit/Source/web/WebDataSourceImpl.cpp
+++ b/third_party/WebKit/Source/web/WebDataSourceImpl.cpp
@@ -33,12 +33,12 @@
 #include <memory>
 #include "core/dom/Document.h"
 #include "core/loader/SubresourceFilter.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebDocumentSubresourceFilter.h"
 #include "public/platform/WebURL.h"
 #include "public/platform/WebURLError.h"
 #include "public/platform/WebVector.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDataSourceImpl.h b/third_party/WebKit/Source/web/WebDataSourceImpl.h
index 3497fed..e4de4a6 100644
--- a/third_party/WebKit/Source/web/WebDataSourceImpl.h
+++ b/third_party/WebKit/Source/web/WebDataSourceImpl.h
@@ -31,15 +31,15 @@
 #ifndef WebDataSourceImpl_h
 #define WebDataSourceImpl_h
 
+#include <memory>
 #include "core/frame/FrameTypes.h"
 #include "core/loader/DocumentLoader.h"
 #include "platform/exported/WrappedResourceRequest.h"
 #include "platform/exported/WrappedResourceResponse.h"
 #include "platform/heap/Handle.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/Vector.h"
 #include "public/web/WebDataSource.h"
-#include "wtf/Vector.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
index 2b86e5c..fa31e41 100644
--- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
+++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp
@@ -72,6 +72,10 @@
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/paint/PaintController.h"
 #include "platform/instrumentation/tracing/TraceEvent.h"
+#include "platform/wtf/MathExtras.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebLayerTreeView.h"
 #include "public/platform/WebRect.h"
@@ -87,10 +91,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/MathExtras.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h
index da1fe8c..6c625dc 100644
--- a/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h
+++ b/third_party/WebKit/Source/web/WebDevToolsAgentImpl.h
@@ -37,12 +37,12 @@
 #include "core/inspector/InspectorSession.h"
 #include "core/inspector/InspectorTracingAgent.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Forward.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/WebSize.h"
 #include "public/platform/WebThread.h"
 #include "public/web/WebDevToolsAgent.h"
 #include "web/InspectorEmulationAgent.h"
-#include "wtf/Forward.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDevToolsFrontendImpl.h b/third_party/WebKit/Source/web/WebDevToolsFrontendImpl.h
index e7d7adda..5cb63525 100644
--- a/third_party/WebKit/Source/web/WebDevToolsFrontendImpl.h
+++ b/third_party/WebKit/Source/web/WebDevToolsFrontendImpl.h
@@ -33,10 +33,10 @@
 
 #include "core/inspector/InspectorFrontendClient.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/HashMap.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/web/WebDevToolsFrontend.h"
-#include "wtf/HashMap.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebDocument.cpp b/third_party/WebKit/Source/web/WebDocument.cpp
index 4bec3b0..cda62b3 100644
--- a/third_party/WebKit/Source/web/WebDocument.cpp
+++ b/third_party/WebKit/Source/web/WebDocument.cpp
@@ -56,6 +56,7 @@
 #include "modules/accessibility/AXObject.h"
 #include "modules/accessibility/AXObjectCacheImpl.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebDistillability.h"
 #include "public/platform/WebURL.h"
 #include "public/web/WebAXObject.h"
@@ -65,7 +66,6 @@
 #include "public/web/WebFormElement.h"
 #include "v8/include/v8.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebElement.cpp b/third_party/WebKit/Source/web/WebElement.cpp
index f931410d..ae3b2dbe8 100644
--- a/third_party/WebKit/Source/web/WebElement.cpp
+++ b/third_party/WebKit/Source/web/WebElement.cpp
@@ -37,10 +37,10 @@
 #include "core/editing/EditingUtilities.h"
 #include "core/html/TextControlElement.h"
 #include "platform/graphics/Image.h"
+#include "platform/wtf/PassRefPtr.h"
+#include "platform/wtf/text/AtomicString.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebRect.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebElementCollection.cpp b/third_party/WebKit/Source/web/WebElementCollection.cpp
index 0f77be8..09e2514 100644
--- a/third_party/WebKit/Source/web/WebElementCollection.cpp
+++ b/third_party/WebKit/Source/web/WebElementCollection.cpp
@@ -33,8 +33,8 @@
 
 #include "core/dom/Element.h"
 #include "core/html/HTMLCollection.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/web/WebElement.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
index 626956c7..a9d5347 100644
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImpl.cpp
@@ -56,6 +56,8 @@
 #include "platform/network/ContentSecurityPolicyResponseHeaders.h"
 #include "platform/network/NetworkUtils.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/Functional.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebURLRequest.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h"
@@ -72,8 +74,6 @@
 #include "web/WebDataSourceImpl.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WorkerContentSettingsClient.h"
-#include "wtf/Functional.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
index 6f5937b..eaba76289 100644
--- a/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
+++ b/third_party/WebKit/Source/web/WebEmbeddedWorkerImplTest.cpp
@@ -7,6 +7,7 @@
 #include <memory>
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebURLLoaderMockFactory.h"
 #include "public/platform/WebURLResponse.h"
@@ -16,7 +17,6 @@
 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 namespace {
diff --git a/third_party/WebKit/Source/web/WebEntities.cpp b/third_party/WebKit/Source/web/WebEntities.cpp
index 04054df13..174086c0 100644
--- a/third_party/WebKit/Source/web/WebEntities.cpp
+++ b/third_party/WebKit/Source/web/WebEntities.cpp
@@ -30,9 +30,9 @@
 
 #include "web/WebEntities.h"
 
-#include "public/platform/WebString.h"
-#include "wtf/text/StringBuilder.h"
 #include <string.h>
+#include "platform/wtf/text/StringBuilder.h"
+#include "public/platform/WebString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebEntities.h b/third_party/WebKit/Source/web/WebEntities.h
index 7c95d03f..a8371a8 100644
--- a/third_party/WebKit/Source/web/WebEntities.h
+++ b/third_party/WebKit/Source/web/WebEntities.h
@@ -31,8 +31,8 @@
 #ifndef WebEntities_h
 #define WebEntities_h
 
-#include "wtf/HashMap.h"
-#include "wtf/text/WTFString.h"
+#include "platform/wtf/HashMap.h"
+#include "platform/wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebExport.h b/third_party/WebKit/Source/web/WebExport.h
index 2c1304b..57ab557 100644
--- a/third_party/WebKit/Source/web/WebExport.h
+++ b/third_party/WebKit/Source/web/WebExport.h
@@ -5,7 +5,7 @@
 #ifndef WebExport_h
 #define WebExport_h
 
-#include "wtf/Compiler.h"
+#include "platform/wtf/Compiler.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.cpp b/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.cpp
index f528d1a..4cf9e4b 100644
--- a/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.cpp
@@ -31,7 +31,7 @@
 #include "web/WebFileChooserCompletionImpl.h"
 
 #include "platform/FileMetadata.h"
-#include "wtf/DateMath.h"
+#include "platform/wtf/DateMath.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.h b/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.h
index 48237fa..7e3d68cd 100644
--- a/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.h
+++ b/third_party/WebKit/Source/web/WebFileChooserCompletionImpl.h
@@ -32,10 +32,10 @@
 #define WebFileChooserCompletionImpl_h
 
 #include "platform/FileChooser.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebFileChooserCompletion.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFormControlElement.cpp b/third_party/WebKit/Source/web/WebFormControlElement.cpp
index 1e9fd835..2fef3d86 100644
--- a/third_party/WebKit/Source/web/WebFormControlElement.cpp
+++ b/third_party/WebKit/Source/web/WebFormControlElement.cpp
@@ -38,7 +38,7 @@
 #include "core/html/HTMLSelectElement.h"
 #include "core/html/HTMLTextAreaElement.h"
 
-#include "wtf/PassRefPtr.h"
+#include "platform/wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFormElement.cpp b/third_party/WebKit/Source/web/WebFormElement.cpp
index e297aad..0b2bfeb3 100644
--- a/third_party/WebKit/Source/web/WebFormElement.cpp
+++ b/third_party/WebKit/Source/web/WebFormElement.cpp
@@ -34,11 +34,11 @@
 #include "core/html/HTMLFormControlElement.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLInputElement.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
 #include "public/web/WebFormControlElement.h"
 #include "public/web/WebInputElement.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameContentDumper.cpp b/third_party/WebKit/Source/web/WebFrameContentDumper.cpp
index 5700e7e9..070fc34 100644
--- a/third_party/WebKit/Source/web/WebFrameContentDumper.cpp
+++ b/third_party/WebKit/Source/web/WebFrameContentDumper.cpp
@@ -12,11 +12,11 @@
 #include "core/layout/LayoutTreeAsText.h"
 #include "core/layout/api/LayoutPartItem.h"
 #include "core/layout/api/LayoutViewItem.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/web/WebDocument.h"
 #include "public/web/WebLocalFrame.h"
 #include "public/web/WebView.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameImplBase.h b/third_party/WebKit/Source/web/WebFrameImplBase.h
index 8134801..a22d1ea 100644
--- a/third_party/WebKit/Source/web/WebFrameImplBase.h
+++ b/third_party/WebKit/Source/web/WebFrameImplBase.h
@@ -6,8 +6,8 @@
 #define WebFrameImplBase_h
 
 #include "platform/heap/Handle.h"
+#include "platform/wtf/text/AtomicString.h"
 #include "web/WebExport.h"
-#include "wtf/text/AtomicString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameSerializer.cpp b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
index 3b47ccd..892dfc68 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializer.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializer.cpp
@@ -54,6 +54,13 @@
 #include "platform/mhtml/MHTMLArchive.h"
 #include "platform/mhtml/MHTMLParser.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/Deque.h"
+#include "platform/wtf/HashMap.h"
+#include "platform/wtf/HashSet.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/Vector.h"
+#include "platform/wtf/text/StringConcatenate.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
 #include "public/platform/WebURLResponse.h"
@@ -66,13 +73,6 @@
 #include "web/WebFrameSerializerImpl.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebRemoteFrameImpl.h"
-#include "wtf/Assertions.h"
-#include "wtf/Deque.h"
-#include "wtf/HashMap.h"
-#include "wtf/HashSet.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/Vector.h"
-#include "wtf/text/StringConcatenate.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp b/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp
index 1dec6c6..7ac6adc 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameSerializerImpl.cpp
@@ -92,10 +92,10 @@
 #include "core/html/HTMLMetaElement.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
+#include "platform/wtf/text/TextEncoding.h"
 #include "public/platform/WebCString.h"
 #include "public/platform/WebVector.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/text/TextEncoding.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameSerializerImpl.h b/third_party/WebKit/Source/web/WebFrameSerializerImpl.h
index 9326cf5..5b53c08 100644
--- a/third_party/WebKit/Source/web/WebFrameSerializerImpl.h
+++ b/third_party/WebKit/Source/web/WebFrameSerializerImpl.h
@@ -31,17 +31,17 @@
 #ifndef WebFrameSerializerImpl_h
 #define WebFrameSerializerImpl_h
 
+#include "platform/wtf/Forward.h"
+#include "platform/wtf/HashMap.h"
+#include "platform/wtf/Vector.h"
+#include "platform/wtf/text/StringBuilder.h"
+#include "platform/wtf/text/StringHash.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
 #include "public/web/WebFrameSerializer.h"
 #include "public/web/WebFrameSerializerClient.h"
 #include "web/WebEntities.h"
-#include "wtf/Forward.h"
-#include "wtf/HashMap.h"
-#include "wtf/Vector.h"
-#include "wtf/text/StringBuilder.h"
-#include "wtf/text/StringHash.h"
-#include "wtf/text/WTFString.h"
 
 namespace WTF {
 class TextEncoding;
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetBase.h b/third_party/WebKit/Source/web/WebFrameWidgetBase.h
index ecd56909..29915b0 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetBase.h
+++ b/third_party/WebKit/Source/web/WebFrameWidgetBase.h
@@ -7,9 +7,9 @@
 
 #include "core/clipboard/DataObject.h"
 #include "platform/UserGestureIndicator.h"
+#include "platform/wtf/Assertions.h"
 #include "public/platform/WebDragData.h"
 #include "public/web/WebFrameWidget.h"
-#include "wtf/Assertions.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
index fa53cf4..919b58b 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -56,6 +56,8 @@
 #include "platform/animation/CompositorAnimationHost.h"
 #include "platform/graphics/Color.h"
 #include "platform/graphics/CompositorMutatorClient.h"
+#include "platform/wtf/AutoReset.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/web/WebAutofillClient.h"
 #include "public/web/WebPlugin.h"
 #include "public/web/WebRange.h"
@@ -74,8 +76,6 @@
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebRemoteFrameImpl.h"
 #include "web/WebViewFrameWidget.h"
-#include "wtf/AutoReset.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
index fb071fe..f5609f5 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
@@ -34,6 +34,8 @@
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/heap/SelfKeepAlive.h"
 #include "platform/scroll/ScrollTypes.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/HashSet.h"
 #include "public/platform/WebCoalescedInputEvent.h"
 #include "public/platform/WebPoint.h"
 #include "public/platform/WebSize.h"
@@ -43,8 +45,6 @@
 #include "web/WebInputMethodControllerImpl.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/Assertions.h"
-#include "wtf/HashSet.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebHelperPluginImpl.h b/third_party/WebKit/Source/web/WebHelperPluginImpl.h
index 818dc65..e6e3dbb 100644
--- a/third_party/WebKit/Source/web/WebHelperPluginImpl.h
+++ b/third_party/WebKit/Source/web/WebHelperPluginImpl.h
@@ -32,11 +32,11 @@
 #define WebHelperPluginImpl_h
 
 #include "platform/Timer.h"
+#include "platform/wtf/Allocator.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/RefPtr.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/web/WebHelperPlugin.h"
-#include "wtf/Allocator.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/RefPtr.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebHistoryItem.cpp b/third_party/WebKit/Source/web/WebHistoryItem.cpp
index 6315cb9..a873c78 100644
--- a/third_party/WebKit/Source/web/WebHistoryItem.cpp
+++ b/third_party/WebKit/Source/web/WebHistoryItem.cpp
@@ -34,13 +34,13 @@
 #include "core/loader/HistoryItem.h"
 #include "platform/network/EncodedFormData.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/text/StringHash.h"
 #include "public/platform/WebFloatPoint.h"
 #include "public/platform/WebHTTPBody.h"
 #include "public/platform/WebPoint.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebSerializedScriptValue.h"
-#include "wtf/text/StringHash.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebImageDecoder.cpp b/third_party/WebKit/Source/web/WebImageDecoder.cpp
index 0c8428f..3267b8b 100644
--- a/third_party/WebKit/Source/web/WebImageDecoder.cpp
+++ b/third_party/WebKit/Source/web/WebImageDecoder.cpp
@@ -33,11 +33,11 @@
 #include "platform/SharedBuffer.h"
 #include "platform/image-decoders/bmp/BMPImageDecoder.h"
 #include "platform/image-decoders/ico/ICOImageDecoder.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebImage.h"
 #include "public/platform/WebSize.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebInputElement.cpp b/third_party/WebKit/Source/web/WebInputElement.cpp
index 4033cee5..294d6de 100644
--- a/third_party/WebKit/Source/web/WebInputElement.cpp
+++ b/third_party/WebKit/Source/web/WebInputElement.cpp
@@ -40,10 +40,10 @@
 #include "core/html/shadow/ShadowElementNames.h"
 #include "core/html/shadow/TextControlInnerElements.h"
 #include "platform/RuntimeEnabledFeatures.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
 #include "public/web/WebElementCollection.h"
 #include "public/web/WebOptionElement.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebInputEvent.cpp b/third_party/WebKit/Source/web/WebInputEvent.cpp
index 9cfffce..fd9bb9a 100644
--- a/third_party/WebKit/Source/web/WebInputEvent.cpp
+++ b/third_party/WebKit/Source/web/WebInputEvent.cpp
@@ -30,15 +30,15 @@
 
 #include "public/platform/WebInputEvent.h"
 
+#include <ctype.h>
 #include "platform/KeyboardCodes.h"
+#include "platform/wtf/ASCIICType.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/StringExtras.h"
 #include "public/platform/WebGestureEvent.h"
 #include "public/platform/WebKeyboardEvent.h"
 #include "public/platform/WebMouseWheelEvent.h"
 #include "public/platform/WebTouchEvent.h"
-#include "wtf/ASCIICType.h"
-#include "wtf/Assertions.h"
-#include "wtf/StringExtras.h"
-#include <ctype.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebInputEventConversion.h b/third_party/WebKit/Source/web/WebInputEventConversion.h
index 546b841..7d63873 100644
--- a/third_party/WebKit/Source/web/WebInputEventConversion.h
+++ b/third_party/WebKit/Source/web/WebInputEventConversion.h
@@ -31,14 +31,14 @@
 #ifndef WebInputEventConversion_h
 #define WebInputEventConversion_h
 
+#include <vector>
 #include "platform/scroll/ScrollTypes.h"
+#include "platform/wtf/Compiler.h"
 #include "public/platform/WebInputEvent.h"
 #include "public/platform/WebKeyboardEvent.h"
 #include "public/platform/WebMouseWheelEvent.h"
 #include "public/platform/WebTouchEvent.h"
 #include "web/WebExport.h"
-#include "wtf/Compiler.h"
-#include <vector>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebKit.cpp b/third_party/WebKit/Source/web/WebKit.cpp
index 0bcd0fb7..952e687 100644
--- a/third_party/WebKit/Source/web/WebKit.cpp
+++ b/third_party/WebKit/Source/web/WebKit.cpp
@@ -44,15 +44,15 @@
 #include "modules/ModulesInitializer.h"
 #include "platform/LayoutTestSupport.h"
 #include "platform/heap/Heap.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/WTF.h"
+#include "platform/wtf/allocator/Partitions.h"
+#include "platform/wtf/text/AtomicString.h"
+#include "platform/wtf/text/TextEncoding.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "v8/include/v8.h"
-#include "wtf/Assertions.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/WTF.h"
-#include "wtf/allocator/Partitions.h"
-#include "wtf/text/AtomicString.h"
-#include "wtf/text/TextEncoding.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebLabelElement.cpp b/third_party/WebKit/Source/web/WebLabelElement.cpp
index fc9b48b..d4fae9f6 100644
--- a/third_party/WebKit/Source/web/WebLabelElement.cpp
+++ b/third_party/WebKit/Source/web/WebLabelElement.cpp
@@ -33,8 +33,8 @@
 #include "core/HTMLNames.h"
 #include "core/html/HTMLLabelElement.h"
 #include "core/html/LabelableElement.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index b04cd1c09..3fd9436 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -181,6 +181,9 @@
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SchemeRegistry.h"
 #include "platform/weborigin/SecurityPolicy.h"
+#include "platform/wtf/CurrentTime.h"
+#include "platform/wtf/HashMap.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebDoubleSize.h"
 #include "public/platform/WebFloatPoint.h"
 #include "public/platform/WebFloatRect.h"
@@ -228,9 +231,6 @@
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebRemoteFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/HashMap.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.h b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
index 4ac184f..2479d47 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.h
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.h
@@ -36,6 +36,8 @@
 #include "core/frame/LocalFrame.h"
 #include "platform/geometry/FloatRect.h"
 #include "platform/heap/SelfKeepAlive.h"
+#include "platform/wtf/Compiler.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebFileSystemType.h"
 #include "public/web/WebLocalFrame.h"
 #include "web/LocalFrameClientImpl.h"
@@ -44,8 +46,6 @@
 #include "web/WebFrameImplBase.h"
 #include "web/WebFrameWidgetBase.h"
 #include "web/WebInputMethodControllerImpl.h"
-#include "wtf/Compiler.h"
-#include "wtf/text/WTFString.h"
 
 #include <memory>
 
diff --git a/third_party/WebKit/Source/web/WebMediaDevicesRequest.cpp b/third_party/WebKit/Source/web/WebMediaDevicesRequest.cpp
index fb72349..96e5880 100644
--- a/third_party/WebKit/Source/web/WebMediaDevicesRequest.cpp
+++ b/third_party/WebKit/Source/web/WebMediaDevicesRequest.cpp
@@ -28,12 +28,12 @@
 #include "core/dom/Document.h"
 #include "modules/mediastream/MediaDevicesRequest.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/WebMediaDeviceInfo.h"
 #include "public/platform/WebSecurityOrigin.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebDocument.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebMemoryStatistics.cpp b/third_party/WebKit/Source/web/WebMemoryStatistics.cpp
index 540b0e61..8ddbefc 100644
--- a/third_party/WebKit/Source/web/WebMemoryStatistics.cpp
+++ b/third_party/WebKit/Source/web/WebMemoryStatistics.cpp
@@ -5,7 +5,7 @@
 #include "public/web/WebMemoryStatistics.h"
 
 #include "platform/heap/Handle.h"
-#include "wtf/allocator/Partitions.h"
+#include "platform/wtf/allocator/Partitions.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebMetaElement.cpp b/third_party/WebKit/Source/web/WebMetaElement.cpp
index c2184b7..3d758330 100644
--- a/third_party/WebKit/Source/web/WebMetaElement.cpp
+++ b/third_party/WebKit/Source/web/WebMetaElement.cpp
@@ -6,8 +6,8 @@
 
 #include "core/HTMLNames.h"
 #include "core/html/HTMLMetaElement.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebNode.cpp b/third_party/WebKit/Source/web/WebNode.cpp
index 6c1b8e2..35a5eed 100644
--- a/third_party/WebKit/Source/web/WebNode.cpp
+++ b/third_party/WebKit/Source/web/WebNode.cpp
@@ -48,6 +48,7 @@
 #include "modules/accessibility/AXObject.h"
 #include "modules/accessibility/AXObjectCacheImpl.h"
 #include "platform/FrameViewBase.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebString.h"
 #include "public/web/WebAXObject.h"
 #include "public/web/WebDOMEvent.h"
@@ -58,7 +59,6 @@
 #include "web/LocalFrameClientImpl.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebPluginContainerImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebOptionElement.cpp b/third_party/WebKit/Source/web/WebOptionElement.cpp
index 714bdd6..a6c2659 100644
--- a/third_party/WebKit/Source/web/WebOptionElement.cpp
+++ b/third_party/WebKit/Source/web/WebOptionElement.cpp
@@ -32,8 +32,8 @@
 
 #include "core/HTMLNames.h"
 #include "core/html/HTMLOptionElement.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
index 8d85f67..2ec065df 100644
--- a/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPagePopupImpl.cpp
@@ -54,6 +54,7 @@
 #include "platform/animation/CompositorAnimationHost.h"
 #include "platform/heap/Handle.h"
 #include "platform/instrumentation/tracing/TraceEvent.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
 #include "public/platform/WebCursorInfo.h"
 #include "public/platform/WebFloatRect.h"
@@ -65,7 +66,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPagePopupImpl.h b/third_party/WebKit/Source/web/WebPagePopupImpl.h
index 423af2c..1230e90 100644
--- a/third_party/WebKit/Source/web/WebPagePopupImpl.h
+++ b/third_party/WebKit/Source/web/WebPagePopupImpl.h
@@ -32,9 +32,9 @@
 #define WebPagePopupImpl_h
 
 #include "core/page/PagePopup.h"
+#include "platform/wtf/RefCounted.h"
 #include "public/web/WebPagePopup.h"
 #include "web/PageWidgetDelegate.h"
-#include "wtf/RefCounted.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPepperSocket.cpp b/third_party/WebKit/Source/web/WebPepperSocket.cpp
index 13a10fb..59a5dc61 100644
--- a/third_party/WebKit/Source/web/WebPepperSocket.cpp
+++ b/third_party/WebKit/Source/web/WebPepperSocket.cpp
@@ -30,9 +30,9 @@
 
 #include "public/web/WebPepperSocket.h"
 
-#include "web/WebPepperSocketImpl.h"
-#include "wtf/PtrUtil.h"
 #include <memory>
+#include "platform/wtf/PtrUtil.h"
+#include "web/WebPepperSocketImpl.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h b/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h
index 080531b..514a296 100644
--- a/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h
+++ b/third_party/WebKit/Source/web/WebPepperSocketChannelClientProxy.h
@@ -5,13 +5,13 @@
 #ifndef WebPepperSocketChannelClientProxy_h
 #define WebPepperSocketChannelClientProxy_h
 
+#include <stdint.h>
+#include <memory>
 #include "modules/websockets/WebSocketChannelClient.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Vector.h"
+#include "platform/wtf/text/WTFString.h"
 #include "web/WebPepperSocketImpl.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
-#include <memory>
-#include <stdint.h>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp b/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp
index 20e1a6c..8aa5831 100644
--- a/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPepperSocketImpl.cpp
@@ -30,19 +30,19 @@
 
 #include "web/WebPepperSocketImpl.h"
 
+#include <memory>
 #include "core/dom/DOMArrayBuffer.h"
 #include "core/dom/Document.h"
 #include "core/inspector/ConsoleTypes.h"
 #include "modules/websockets/DocumentWebSocketChannel.h"
 #include "modules/websockets/WebSocketChannel.h"
+#include "platform/wtf/text/CString.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebURL.h"
 #include "public/web/WebArrayBuffer.h"
 #include "public/web/WebDocument.h"
 #include "web/WebPepperSocketChannelClientProxy.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPepperSocketImpl.h b/third_party/WebKit/Source/web/WebPepperSocketImpl.h
index 1f8f390e..07f67d3e 100644
--- a/third_party/WebKit/Source/web/WebPepperSocketImpl.h
+++ b/third_party/WebKit/Source/web/WebPepperSocketImpl.h
@@ -31,14 +31,14 @@
 #ifndef WebPepperSocketImpl_h
 #define WebPepperSocketImpl_h
 
+#include <memory>
 #include "modules/websockets/WebSocketChannelClient.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/RefPtr.h"
 #include "public/platform/WebCommon.h"
 #include "public/platform/WebString.h"
 #include "public/web/WebPepperSocket.h"
 #include "public/web/WebPepperSocketClient.h"
-#include "wtf/RefPtr.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
index 9607807..e31fafd 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -81,6 +81,7 @@
 #include "platform/graphics/paint/ForeignLayerDisplayItem.h"
 #include "platform/scroll/ScrollAnimatorBase.h"
 #include "platform/scroll/ScrollbarTheme.h"
+#include "platform/wtf/Assertions.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebClipboard.h"
 #include "public/platform/WebCompositorSupport.h"
@@ -106,7 +107,6 @@
 #include "web/WebInputEventConversion.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
-#include "wtf/Assertions.h"
 
 namespace blink {
 
@@ -186,7 +186,6 @@
 }
 
 void WebPluginContainerImpl::setFocused(bool focused, WebFocusType focusType) {
-  FrameViewBase::setFocused(focused, focusType);
   m_webPlugin->updateFocus(focused, focusType);
 }
 
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.h b/third_party/WebKit/Source/web/WebPluginContainerImpl.h
index 4ae72e6..0a54f99 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.h
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.h
@@ -35,12 +35,12 @@
 #include "core/dom/ContextLifecycleObserver.h"
 #include "core/plugins/PluginView.h"
 #include "platform/FrameViewBase.h"
+#include "platform/wtf/Compiler.h"
+#include "platform/wtf/PassRefPtr.h"
+#include "platform/wtf/Vector.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/web/WebPluginContainer.h"
 #include "web/WebExport.h"
-#include "wtf/Compiler.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/Vector.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebPluginDocument.cpp b/third_party/WebKit/Source/web/WebPluginDocument.cpp
index 9dfbd6e..f1e7fd8 100644
--- a/third_party/WebKit/Source/web/WebPluginDocument.cpp
+++ b/third_party/WebKit/Source/web/WebPluginDocument.cpp
@@ -35,7 +35,7 @@
 
 #include "web/WebPluginContainerImpl.h"
 
-#include "wtf/PassRefPtr.h"
+#include "platform/wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
index 52cc9ce8..89aa138 100644
--- a/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
+++ b/third_party/WebKit/Source/web/WebRemoteFrameImpl.h
@@ -7,13 +7,13 @@
 
 #include "core/frame/RemoteFrame.h"
 #include "platform/heap/SelfKeepAlive.h"
+#include "platform/wtf/Compiler.h"
 #include "public/platform/WebInsecureRequestPolicy.h"
 #include "public/web/WebRemoteFrame.h"
 #include "public/web/WebRemoteFrameClient.h"
 #include "web/RemoteFrameClientImpl.h"
 #include "web/WebExport.h"
 #include "web/WebFrameImplBase.h"
-#include "wtf/Compiler.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp b/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
index 9faa2c3..c3963f4 100644
--- a/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
+++ b/third_party/WebKit/Source/web/WebRuntimeFeatures.cpp
@@ -31,7 +31,7 @@
 #include "public/web/WebRuntimeFeatures.h"
 
 #include "platform/RuntimeEnabledFeatures.h"
-#include "wtf/Assertions.h"
+#include "platform/wtf/Assertions.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebScriptSource.cpp b/third_party/WebKit/Source/web/WebScriptSource.cpp
index 65c0875..c61b9da 100644
--- a/third_party/WebKit/Source/web/WebScriptSource.cpp
+++ b/third_party/WebKit/Source/web/WebScriptSource.cpp
@@ -5,7 +5,7 @@
 #include "public/web/WebScriptSource.h"
 
 #include "bindings/core/v8/ScriptSourceCode.h"
-#include "wtf/text/TextPosition.h"
+#include "platform/wtf/text/TextPosition.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSearchableFormData.cpp b/third_party/WebKit/Source/web/WebSearchableFormData.cpp
index 1cee88d..b525a39 100644
--- a/third_party/WebKit/Source/web/WebSearchableFormData.cpp
+++ b/third_party/WebKit/Source/web/WebSearchableFormData.cpp
@@ -40,9 +40,9 @@
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLSelectElement.h"
 #include "platform/network/FormDataEncoder.h"
+#include "platform/wtf/text/TextEncoding.h"
 #include "public/web/WebFormElement.h"
 #include "public/web/WebInputElement.h"
-#include "wtf/text/TextEncoding.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSelectElement.cpp b/third_party/WebKit/Source/web/WebSelectElement.cpp
index ce455f3..b8e19c81 100644
--- a/third_party/WebKit/Source/web/WebSelectElement.cpp
+++ b/third_party/WebKit/Source/web/WebSelectElement.cpp
@@ -33,8 +33,8 @@
 #include "core/HTMLNames.h"
 #include "core/html/HTMLOptionElement.h"
 #include "core/html/HTMLSelectElement.h"
+#include "platform/wtf/PassRefPtr.h"
 #include "public/platform/WebString.h"
-#include "wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSettingsImpl.h b/third_party/WebKit/Source/web/WebSettingsImpl.h
index 502344c..0f8b5523 100644
--- a/third_party/WebKit/Source/web/WebSettingsImpl.h
+++ b/third_party/WebKit/Source/web/WebSettingsImpl.h
@@ -32,9 +32,9 @@
 #define WebSettingsImpl_h
 
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Compiler.h"
 #include "public/web/WebSettings.h"
 #include "web/WebExport.h"
-#include "wtf/Compiler.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
index 6726bb88..2718c89 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -54,6 +54,8 @@
 #include "platform/network/ContentSecurityPolicyParsers.h"
 #include "platform/weborigin/KURL.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/Functional.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebMessagePortChannel.h"
 #include "public/platform/WebString.h"
@@ -70,8 +72,6 @@
 #include "web/WebDataSourceImpl.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WorkerContentSettingsClient.h"
-#include "wtf/Functional.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
index 334c42f..e778518 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.h
@@ -37,13 +37,13 @@
 #include "core/dom/ExecutionContext.h"
 #include "core/workers/WorkerLoaderProxy.h"
 #include "core/workers/WorkerThread.h"
+#include "platform/wtf/RefPtr.h"
 #include "public/platform/WebAddressSpace.h"
 #include "public/platform/WebContentSecurityPolicy.h"
 #include "public/web/WebDevToolsAgentClient.h"
 #include "public/web/WebFrameClient.h"
 #include "public/web/WebSharedWorkerClient.h"
 #include "web/WebSharedWorkerReportingProxyImpl.h"
-#include "wtf/RefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
index e189c85..49659c83 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
@@ -6,9 +6,9 @@
 
 #include "bindings/core/v8/SourceLocation.h"
 #include "platform/CrossThreadFunctional.h"
+#include "platform/wtf/WTF.h"
 #include "public/platform/WebTraceLocation.h"
 #include "web/WebSharedWorkerImpl.h"
-#include "wtf/WTF.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSpeechGrammar.cpp b/third_party/WebKit/Source/web/WebSpeechGrammar.cpp
index c8df5d2..40c7045 100644
--- a/third_party/WebKit/Source/web/WebSpeechGrammar.cpp
+++ b/third_party/WebKit/Source/web/WebSpeechGrammar.cpp
@@ -26,7 +26,7 @@
 #include "public/web/WebSpeechGrammar.h"
 
 #include "modules/speech/SpeechGrammar.h"
-#include "wtf/PassRefPtr.h"
+#include "platform/wtf/PassRefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebSpeechRecognitionResult.cpp b/third_party/WebKit/Source/web/WebSpeechRecognitionResult.cpp
index 6b570e3..e8e5c435 100644
--- a/third_party/WebKit/Source/web/WebSpeechRecognitionResult.cpp
+++ b/third_party/WebKit/Source/web/WebSpeechRecognitionResult.cpp
@@ -28,7 +28,7 @@
 #include "modules/speech/SpeechRecognitionAlternative.h"
 #include "modules/speech/SpeechRecognitionResult.h"
 #include "platform/heap/Handle.h"
-#include "wtf/Vector.h"
+#include "platform/wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.cpp b/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.cpp
index b76edf0..18a1457a 100644
--- a/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.cpp
+++ b/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.cpp
@@ -31,10 +31,10 @@
 #include "web/WebTextCheckingCompletionImpl.h"
 
 #include "platform/text/TextCheckerClient.h"
+#include "platform/wtf/Assertions.h"
 #include "public/platform/WebVector.h"
 #include "public/web/WebTextCheckingResult.h"
 #include "web/EditorClientImpl.h"
-#include "wtf/Assertions.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.h b/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.h
index cf3be0d3..cd5176ec 100644
--- a/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.h
+++ b/third_party/WebKit/Source/web/WebTextCheckingCompletionImpl.h
@@ -33,8 +33,8 @@
 
 #include "platform/heap/Handle.h"
 #include "platform/text/TextChecking.h"
+#include "platform/wtf/RefPtr.h"
 #include "public/web/WebTextCheckingCompletion.h"
-#include "wtf/RefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebViewFrameWidget.h b/third_party/WebKit/Source/web/WebViewFrameWidget.h
index ead37003f..d6bf1b2 100644
--- a/third_party/WebKit/Source/web/WebViewFrameWidget.h
+++ b/third_party/WebKit/Source/web/WebViewFrameWidget.h
@@ -6,11 +6,11 @@
 #define WebViewFrameWidget_h
 
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Noncopyable.h"
+#include "platform/wtf/RefPtr.h"
 #include "web/WebFrameWidgetBase.h"
 #include "web/WebInputMethodControllerImpl.h"
 #include "web/WebLocalFrameImpl.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/RefPtr.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 452dcaa..cfffa16e 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -117,6 +117,10 @@
 #include "platform/loader/fetch/UniqueIdentifier.h"
 #include "platform/scroll/ScrollbarTheme.h"
 #include "platform/weborigin/SchemeRegistry.h"
+#include "platform/wtf/AutoReset.h"
+#include "platform/wtf/CurrentTime.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/RefPtr.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCompositeAndReadbackAsyncCallback.h"
 #include "public/platform/WebCompositorSupport.h"
@@ -174,10 +178,6 @@
 #include "web/WebPluginContainerImpl.h"
 #include "web/WebRemoteFrameImpl.h"
 #include "web/WebSettingsImpl.h"
-#include "wtf/AutoReset.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/RefPtr.h"
 
 #if USE(DEFAULT_RENDER_THEME)
 #include "core/layout/LayoutThemeDefault.h"
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h
index 19df220..96c97df8 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.h
+++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -39,6 +39,10 @@
 #include "platform/geometry/IntRect.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/heap/Handle.h"
+#include "platform/wtf/Compiler.h"
+#include "platform/wtf/HashSet.h"
+#include "platform/wtf/RefCounted.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/WebDisplayMode.h"
 #include "public/platform/WebFloatSize.h"
 #include "public/platform/WebGestureCurveTarget.h"
@@ -64,10 +68,6 @@
 #include "web/SpellCheckerClientImpl.h"
 #include "web/StorageClientImpl.h"
 #include "web/WebExport.h"
-#include "wtf/Compiler.h"
-#include "wtf/HashSet.h"
-#include "wtf/RefCounted.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/WorkerContentSettingsClient.h b/third_party/WebKit/Source/web/WorkerContentSettingsClient.h
index a457394..bffee55 100644
--- a/third_party/WebKit/Source/web/WorkerContentSettingsClient.h
+++ b/third_party/WebKit/Source/web/WorkerContentSettingsClient.h
@@ -31,9 +31,9 @@
 #ifndef WorkerContentSettingsClient_h
 #define WorkerContentSettingsClient_h
 
-#include "core/workers/WorkerClients.h"
-#include "wtf/Forward.h"
 #include <memory>
+#include "core/workers/WorkerClients.h"
+#include "platform/wtf/Forward.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
index ad90d74..943b8cb 100644
--- a/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ActivityLoggerTest.cpp
@@ -6,14 +6,14 @@
 #include "bindings/core/v8/ScriptSourceCode.h"
 #include "bindings/core/v8/V8Binding.h"
 #include "bindings/core/v8/V8DOMActivityLogger.h"
+#include "platform/wtf/Forward.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/text/Base64.h"
 #include "public/platform/WebCache.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "v8/include/v8.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/Forward.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/text/Base64.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp b/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp
index d83818d..551cfea 100644
--- a/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp
+++ b/third_party/WebKit/Source/web/tests/AnimationSimTest.cpp
@@ -5,13 +5,13 @@
 #include "core/animation/ElementAnimation.h"
 #include "core/css/PropertyDescriptor.h"
 #include "core/css/PropertyRegistration.h"
+#include "platform/wtf/CurrentTime.h"
 #include "public/web/WebScriptSource.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
index 3a90cd9..c97e474 100644
--- a/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/CompositorWorkerTest.cpp
@@ -15,6 +15,7 @@
 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebLayer.h"
 #include "public/platform/WebLayerTreeView.h"
@@ -25,7 +26,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
index dcebba4..9fb4230 100644
--- a/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
+++ b/third_party/WebKit/Source/web/tests/DocumentLoaderTest.cpp
@@ -8,13 +8,13 @@
 #include "core/page/Page.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/AutoReset.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebURLLoaderClient.h"
 #include "public/platform/WebURLLoaderMockFactory.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/AutoReset.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp
index 3b3ccb7..d4025fb 100644
--- a/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameSerializerTest.cpp
@@ -36,6 +36,9 @@
 #include "platform/SerializedResource.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/Assertions.h"
+#include "platform/wtf/Deque.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebString.h"
 #include "public/platform/WebThread.h"
@@ -48,9 +51,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/Assertions.h"
-#include "wtf/Deque.h"
-#include "wtf/Vector.h"
 
 using blink::URLTestHelpers::toKURL;
 using blink::URLTestHelpers::registerMockedURLLoad;
diff --git a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
index 7f3ad4f..61ae06d 100644
--- a/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
+++ b/third_party/WebKit/Source/web/tests/FrameTestHelpers.cpp
@@ -33,6 +33,10 @@
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
 #include "platform/testing/WebLayerTreeViewImplForTesting.h"
+#include "platform/wtf/Functional.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/StdLibExtras.h"
+#include "platform/wtf/text/StringBuilder.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebData.h"
 #include "public/platform/WebString.h"
@@ -46,10 +50,6 @@
 #include "public/web/WebViewClient.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebRemoteFrameImpl.h"
-#include "wtf/Functional.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/StdLibExtras.h"
-#include "wtf/text/StringBuilder.h"
 
 namespace blink {
 namespace FrameTestHelpers {
diff --git a/third_party/WebKit/Source/web/tests/IntersectionObserverTest.cpp b/third_party/WebKit/Source/web/tests/IntersectionObserverTest.cpp
index 2269127..e64f9ac 100644
--- a/third_party/WebKit/Source/web/tests/IntersectionObserverTest.cpp
+++ b/third_party/WebKit/Source/web/tests/IntersectionObserverTest.cpp
@@ -8,12 +8,12 @@
 #include "core/dom/IntersectionObserverInit.h"
 #include "core/frame/FrameView.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/CurrentTime.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/LocalFrameClientImplTest.cpp b/third_party/WebKit/Source/web/tests/LocalFrameClientImplTest.cpp
index fc9d88e..1427a21 100644
--- a/third_party/WebKit/Source/web/tests/LocalFrameClientImplTest.cpp
+++ b/third_party/WebKit/Source/web/tests/LocalFrameClientImplTest.cpp
@@ -32,6 +32,8 @@
 
 #include "core/loader/FrameLoader.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/text/CString.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/web/WebFrameClient.h"
 #include "public/web/WebSettings.h"
 #include "public/web/WebView.h"
@@ -39,8 +41,6 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/text/CString.h"
-#include "wtf/text/WTFString.h"
 
 using testing::_;
 using testing::Mock;
diff --git a/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp b/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp
index 9095ac0..91d5fab 100644
--- a/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp
+++ b/third_party/WebKit/Source/web/tests/NGInlineLayoutTest.cpp
@@ -8,13 +8,13 @@
 #include "core/layout/ng/ng_inline_node.h"
 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/CurrentTime.h"
+#include "platform/wtf/text/CharacterNames.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/text/CharacterNames.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
index 43023c6..19c0711b 100644
--- a/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
+++ b/third_party/WebKit/Source/web/tests/PrerenderingTest.cpp
@@ -34,6 +34,7 @@
 #include "core/dom/NodeTraversal.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCache.h"
 #include "public/platform/WebPrerender.h"
@@ -48,7 +49,6 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/PtrUtil.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/ResizeObserverTest.cpp b/third_party/WebKit/Source/web/tests/ResizeObserverTest.cpp
index b02f7c5..c76b9e9 100644
--- a/third_party/WebKit/Source/web/tests/ResizeObserverTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ResizeObserverTest.cpp
@@ -11,13 +11,13 @@
 #include "core/dom/ResizeObserverCallback.h"
 #include "core/dom/ResizeObserverController.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/CurrentTime.h"
 #include "public/web/WebHeap.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/sim/SimCompositor.h"
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
index 0ce5504bb..378b5c77 100644
--- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -20,6 +20,7 @@
 #include "core/paint/PaintLayerScrollableArea.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebURLLoaderMockFactory.h"
 #include "public/web/WebConsoleMessage.h"
@@ -30,7 +31,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebRemoteFrameImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/Vector.h"
 
 using blink::testing::runPendingTasks;
 using testing::Mock;
diff --git a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
index e5e8b91..b6170638 100644
--- a/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
+++ b/third_party/WebKit/Source/web/tests/SpinLockTest.cpp
@@ -28,16 +28,16 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "wtf/SpinLock.h"
+#include "platform/wtf/SpinLock.h"
 
+#include <memory>
 #include "platform/CrossThreadFunctional.h"
 #include "platform/WebTaskRunner.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/PtrUtil.h"
-#include <memory>
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp b/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp
index 2cbf2a22..0ea2df37 100644
--- a/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp
+++ b/third_party/WebKit/Source/web/tests/TimerPerfTest.cpp
@@ -8,10 +8,10 @@
 #include "base/message_loop/message_loop.h"
 #include "base/time/time.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/Vector.h"
 #include "public/platform/Platform.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
index fb2cbab9..39cb775 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameSerializerTest.cpp
@@ -33,6 +33,7 @@
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
 #include "platform/weborigin/KURL.h"
+#include "platform/wtf/text/StringBuilder.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCString.h"
 #include "public/platform/WebCache.h"
@@ -44,7 +45,6 @@
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/text/StringBuilder.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index 16e5bad22..153a6e87 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -105,6 +105,9 @@
 #include "platform/weborigin/KURLHash.h"
 #include "platform/weborigin/SchemeRegistry.h"
 #include "platform/weborigin/SecurityOrigin.h"
+#include "platform/wtf/Forward.h"
+#include "platform/wtf/PtrUtil.h"
+#include "platform/wtf/dtoa/utils.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebCache.h"
 #include "public/platform/WebCachePolicy.h"
@@ -152,9 +155,6 @@
 #include "web/tests/sim/SimDisplayItemList.h"
 #include "web/tests/sim/SimRequest.h"
 #include "web/tests/sim/SimTest.h"
-#include "wtf/Forward.h"
-#include "wtf/PtrUtil.h"
-#include "wtf/dtoa/utils.h"
 
 using blink::URLTestHelpers::toKURL;
 using blink::testing::runPendingTasks;
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 7dfcc06..c6daa300 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -69,6 +69,7 @@
 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "platform/testing/UnitTestHelpers.h"
+#include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebDisplayMode.h"
 #include "public/platform/WebDragData.h"
@@ -107,7 +108,6 @@
 #include "web/WebSettingsImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/FrameTestHelpers.h"
-#include "wtf/PtrUtil.h"
 
 #if OS(MACOSX)
 #include "public/web/mac/WebSubstringUtil.h"
diff --git a/third_party/WebKit/Source/web/tests/sim/SimCanvas.h b/third_party/WebKit/Source/web/tests/sim/SimCanvas.h
index 2fef88884..b559d72 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimCanvas.h
+++ b/third_party/WebKit/Source/web/tests/sim/SimCanvas.h
@@ -6,8 +6,8 @@
 #define SimCanvas_h
 
 #include "platform/graphics/Color.h"
+#include "platform/wtf/Vector.h"
 #include "third_party/skia/include/core/SkCanvas.h"
-#include "wtf/Vector.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp b/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp
index 5f699da1..c4d6864 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp
+++ b/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp
@@ -11,11 +11,11 @@
 #include "core/paint/PaintLayer.h"
 #include "platform/graphics/ContentLayerDelegate.h"
 #include "platform/graphics/GraphicsLayer.h"
+#include "platform/wtf/CurrentTime.h"
 #include "public/platform/WebRect.h"
 #include "web/WebLocalFrameImpl.h"
 #include "web/WebViewImpl.h"
 #include "web/tests/sim/SimDisplayItemList.h"
-#include "wtf/CurrentTime.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h b/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h
index 4c42bf5..b91f983e 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h
+++ b/third_party/WebKit/Source/web/tests/sim/SimDisplayItemList.h
@@ -6,9 +6,9 @@
 #define SimDisplayItemList_h
 
 #include "platform/graphics/paint/PaintRecord.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebDisplayItemList.h"
 #include "web/tests/sim/SimCanvas.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/sim/SimNetwork.h b/third_party/WebKit/Source/web/tests/sim/SimNetwork.h
index a56e40a1..765c78e 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimNetwork.h
+++ b/third_party/WebKit/Source/web/tests/sim/SimNetwork.h
@@ -5,10 +5,10 @@
 #ifndef SimNetwork_h
 #define SimNetwork_h
 
+#include "platform/wtf/HashMap.h"
+#include "platform/wtf/text/StringHash.h"
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebURLLoaderTestDelegate.h"
-#include "wtf/HashMap.h"
-#include "wtf/text/StringHash.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/web/tests/sim/SimRequest.h b/third_party/WebKit/Source/web/tests/sim/SimRequest.h
index 12ebe683..2f4eae3 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimRequest.h
+++ b/third_party/WebKit/Source/web/tests/sim/SimRequest.h
@@ -5,9 +5,9 @@
 #ifndef SimRequest_h
 #define SimRequest_h
 
+#include "platform/wtf/text/WTFString.h"
 #include "public/platform/WebURLError.h"
 #include "public/platform/WebURLResponse.h"
-#include "wtf/text/WTFString.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/exit_codes.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/exit_codes.py
new file mode 100644
index 0000000..2e8ab88
--- /dev/null
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/exit_codes.py
@@ -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.
+
+import signal
+
+OK_EXIT_STATUS = 0
+
+# This matches what the shell does on POSIX (returning -SIGNUM on unhandled
+# signal). (unsigned)(-SIGINT) == 128+signal.SIGINT
+INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
+
+# POSIX limits status codes to 0-255. Normally run-webkit-tests returns the
+# number of tests that failed. These indicate exceptional conditions triggered
+# by the script itself, so we count backwards from 255 (aka -1) to enumerate
+# them.
+#
+# FIXME: crbug.com/357866. We really shouldn't return the number of failures
+# in the exit code at all.
+EARLY_EXIT_STATUS = 251
+SYS_DEPS_EXIT_STATUS = 252
+NO_TESTS_EXIT_STATUS = 253
+NO_DEVICES_EXIT_STATUS = 254
+UNEXPECTED_ERROR_EXIT_STATUS = 255
+
+# FIXME: EXCEPTIONAL_EXIT_STATUS and NO_DEVICES_EXIT_STATUS conflict
+EXCEPTIONAL_EXIT_STATUS = 254
+
+ERROR_CODES = (
+    INTERRUPTED_EXIT_STATUS,
+    EARLY_EXIT_STATUS,
+    SYS_DEPS_EXIT_STATUS,
+    NO_TESTS_EXIT_STATUS,
+    NO_DEVICES_EXIT_STATUS,
+    UNEXPECTED_ERROR_EXIT_STATUS,
+)
+
+# In order to avoid colliding with the above codes, we put a ceiling on
+# the value returned by num_regressions
+MAX_FAILURES_EXIT_STATUS = 101
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
index 088d6c2..cba10f9 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/manager.py
@@ -43,6 +43,7 @@
 import sys
 import time
 
+from webkitpy.common import exit_codes
 from webkitpy.common.net.file_uploader import FileUploader
 from webkitpy.common.webkit_finder import WebKitFinder
 from webkitpy.layout_tests.controllers.layout_test_finder import LayoutTestFinder
@@ -106,7 +107,7 @@
             paths, all_test_names, running_all_tests = self._collect_tests(args)
         except IOError:
             # This is raised if --test-list doesn't exist
-            return test_run_results.RunDetails(exit_code=test_run_results.NO_TESTS_EXIT_STATUS)
+            return test_run_results.RunDetails(exit_code=exit_codes.NO_TESTS_EXIT_STATUS)
 
         # Create a sorted list of test files so the subset chunk,
         # if used, contains alphabetically consecutive tests.
@@ -132,7 +133,7 @@
         # Check to make sure we're not skipping every test.
         if not tests_to_run:
             _log.critical('No tests to run.')
-            return test_run_results.RunDetails(exit_code=test_run_results.NO_TESTS_EXIT_STATUS)
+            return test_run_results.RunDetails(exit_code=exit_codes.NO_TESTS_EXIT_STATUS)
 
         exit_code = self._set_up_run(tests_to_run)
         if exit_code:
@@ -204,10 +205,10 @@
             enabled_pixel_tests_in_retry, only_include_failing=True)
 
         exit_code = summarized_failing_results['num_regressions']
-        if exit_code > test_run_results.MAX_FAILURES_EXIT_STATUS:
+        if exit_code > exit_codes.MAX_FAILURES_EXIT_STATUS:
             _log.warning('num regressions (%d) exceeds max exit status (%d)',
-                         exit_code, test_run_results.MAX_FAILURES_EXIT_STATUS)
-            exit_code = test_run_results.MAX_FAILURES_EXIT_STATUS
+                         exit_code, exit_codes.MAX_FAILURES_EXIT_STATUS)
+            exit_code = exit_codes.MAX_FAILURES_EXIT_STATUS
 
         if not self._options.dry_run:
             self._write_json_files(summarized_full_results, summarized_failing_results, initial_results, running_all_tests)
@@ -221,10 +222,10 @@
             results_path = self._filesystem.join(self._results_directory, "results.html")
             self._copy_results_html_file(results_path)
             if initial_results.keyboard_interrupted:
-                exit_code = test_run_results.INTERRUPTED_EXIT_STATUS
+                exit_code = exit_codes.INTERRUPTED_EXIT_STATUS
             else:
                 if initial_results.interrupted:
-                    exit_code = test_run_results.EARLY_EXIT_STATUS
+                    exit_code = exit_codes.EARLY_EXIT_STATUS
                 if self._options.show_results and (
                         exit_code or (self._options.full_results_html and initial_results.total_failures)):
                     self._port.show_results_html_file(results_path)
@@ -353,7 +354,7 @@
         self._port.host.filesystem.maybe_make_directory(self._results_directory)
 
         self._port.setup_test_run()
-        return test_run_results.OK_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def _run_tests(self, tests_to_run, tests_to_skip, repeat_each, iterations,
                    num_workers, retry_attempt=0):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py
index d2074280..73e876e 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations.py
@@ -32,18 +32,12 @@
 import signal
 import traceback
 
+from webkitpy.common import exit_codes
 from webkitpy.common.host import Host
 from webkitpy.layout_tests.models import test_expectations
 from webkitpy.layout_tests.port.factory import platform_options
 
 
-# This mirrors what the shell normally does.
-INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
-
-# This is a randomly chosen exit code that can be tested against to
-# indicate that an unexpected exception occurred.
-EXCEPTIONAL_EXIT_STATUS = 254
-
 _log = logging.getLogger(__name__)
 
 
@@ -142,10 +136,10 @@
     try:
         exit_status = run_checks(host, options, stderr)
     except KeyboardInterrupt:
-        exit_status = INTERRUPTED_EXIT_STATUS
+        exit_status = exit_codes.INTERRUPTED_EXIT_STATUS
     except Exception as error:  # pylint: disable=broad-except
         print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, error)
         traceback.print_exc(file=stderr)
-        exit_status = EXCEPTIONAL_EXIT_STATUS
+        exit_status = exit_codes.EXCEPTIONAL_EXIT_STATUS
 
     return exit_status
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py
index e9754049..b03f7dd 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/lint_test_expectations_unittest.py
@@ -30,6 +30,7 @@
 import optparse
 import unittest
 
+from webkitpy.common import exit_codes
 from webkitpy.common.host_mock import MockHost
 from webkitpy.layout_tests import lint_test_expectations
 
@@ -216,11 +217,11 @@
 
         lint_test_expectations.lint = interrupting_lint
         res = lint_test_expectations.main([], self.stdout, self.stderr)
-        self.assertEqual(res, lint_test_expectations.INTERRUPTED_EXIT_STATUS)
+        self.assertEqual(res, exit_codes.INTERRUPTED_EXIT_STATUS)
 
     def test_exception(self):
         def exception_raising_lint(host, options):
             assert False
         lint_test_expectations.lint = exception_raising_lint
         res = lint_test_expectations.main([], self.stdout, self.stderr)
-        self.assertEqual(res, lint_test_expectations.EXCEPTIONAL_EXIT_STATUS)
+        self.assertEqual(res, exit_codes.EXCEPTIONAL_EXIT_STATUS)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
index 299f11a..518aaf9 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
@@ -34,39 +34,8 @@
 from webkitpy.layout_tests.models import test_expectations
 from webkitpy.layout_tests.models import test_failures
 
-
 _log = logging.getLogger(__name__)
 
-OK_EXIT_STATUS = 0
-
-# This matches what the shell does on POSIX.
-INTERRUPTED_EXIT_STATUS = signal.SIGINT + 128
-
-# POSIX limits status codes to 0-255. Normally run-webkit-tests returns the number
-# of tests that failed. These indicate exceptional conditions triggered by the
-# script itself, so we count backwards from 255 (aka -1) to enumerate them.
-#
-# FIXME: crbug.com/357866. We really shouldn't return the number of failures
-# in the exit code at all.
-EARLY_EXIT_STATUS = 251
-SYS_DEPS_EXIT_STATUS = 252
-NO_TESTS_EXIT_STATUS = 253
-NO_DEVICES_EXIT_STATUS = 254
-UNEXPECTED_ERROR_EXIT_STATUS = 255
-
-ERROR_CODES = (
-    INTERRUPTED_EXIT_STATUS,
-    EARLY_EXIT_STATUS,
-    SYS_DEPS_EXIT_STATUS,
-    NO_TESTS_EXIT_STATUS,
-    NO_DEVICES_EXIT_STATUS,
-    UNEXPECTED_ERROR_EXIT_STATUS,
-)
-
-# In order to avoid colliding with the above codes, we put a ceiling on
-# the value returned by num_regressions
-MAX_FAILURES_EXIT_STATUS = 101
-
 
 class TestRunException(Exception):
 
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py
index 569c313..1369b74 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/android.py
@@ -36,6 +36,7 @@
 
 from multiprocessing.pool import ThreadPool
 
+from webkitpy.common import exit_codes
 from webkitpy.common.system.executive import ScriptError
 from webkitpy.layout_tests.breakpad.dump_reader_multipart import DumpReaderAndroid
 from webkitpy.layout_tests.models import test_run_results
@@ -355,7 +356,7 @@
     def default_child_processes(self):
         usable_devices = self._devices.usable_devices(self._executive)
         if not usable_devices:
-            raise test_run_results.TestRunException(test_run_results.NO_DEVICES_EXIT_STATUS,
+            raise test_run_results.TestRunException(exit_codes.NO_DEVICES_EXIT_STATUS,
                                                     'Unable to find any attached Android devices.')
         return len(usable_devices)
 
@@ -419,8 +420,8 @@
 
         if not self._devices.prepared_devices():
             _log.error('Could not prepare any devices for testing.')
-            return test_run_results.NO_DEVICES_EXIT_STATUS
-        return test_run_results.OK_EXIT_STATUS
+            return exit_codes.NO_DEVICES_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def setup_test_run(self):
         super(AndroidPort, self).setup_test_run()
@@ -447,8 +448,8 @@
             if not exists:
                 _log.error('You are missing %s under %s. Try installing %s. See build instructions.',
                            font_file, font_dirs, package)
-                return test_run_results.SYS_DEPS_EXIT_STATUS
-        return test_run_results.OK_EXIT_STATUS
+                return exit_codes.SYS_DEPS_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def requires_http_server(self):
         """Chromium Android runs tests on devices, and uses the HTTP server to
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
index c325f4d..2575a41 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -41,6 +41,7 @@
 import re
 import sys
 
+from webkitpy.common import exit_codes
 from webkitpy.common import find_files
 from webkitpy.common import read_checksum_from_png
 from webkitpy.common.memoized import memoized
@@ -329,7 +330,7 @@
         if needs_http:
             result = self.check_httpd() and result
 
-        return test_run_results.OK_EXIT_STATUS if result else test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS if result else exit_codes.UNEXPECTED_ERROR_EXIT_STATUS
 
     def _check_driver(self):
         driver_path = self._path_to_driver()
@@ -365,8 +366,8 @@
                 _log.error('')
                 _log.error('For complete build requirements, please see:')
                 _log.error(self.BUILD_REQUIREMENTS_URL)
-            return test_run_results.SYS_DEPS_EXIT_STATUS
-        return test_run_results.OK_EXIT_STATUS
+            return exit_codes.SYS_DEPS_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def check_image_diff(self):
         """Checks whether image_diff binary exists."""
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test.py
index 2608f57c..88ca2a8 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test.py
@@ -26,6 +26,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from webkitpy.common import exit_codes
 from webkitpy.layout_tests.models import test_run_results
 from webkitpy.layout_tests.port import browser_test_driver
 from webkitpy.layout_tests.port import linux
@@ -62,7 +63,7 @@
         """This function is meant to be a no-op since we don't want to actually
         check for system dependencies.
         """
-        return test_run_results.OK_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def driver_name(self):
         return 'browser_tests'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_unittest.py
index d005b84..1da63ea 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_unittest.py
@@ -28,6 +28,7 @@
 
 import optparse
 
+from webkitpy.common import exit_codes
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.layout_tests.models import test_run_results
 from webkitpy.layout_tests.port import browser_test
@@ -40,7 +41,7 @@
     def test_check_sys_deps(self):
         port = self.make_port()
         port._executive = MockExecutive(exit_code=0)  # pylint: disable=protected-access
-        self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.OK_EXIT_STATUS)
+        self.assertEqual(port.check_sys_deps(needs_http=False), exit_codes.OK_EXIT_STATUS)
 
     def test_driver_name_option(self):
         self.assertTrue(self.make_port()._path_to_driver().endswith(self.driver_name_endswith))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
index 1705eed..7e4cce76 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
@@ -47,6 +47,7 @@
 if script_dir not in sys.path:
     sys.path.append(script_dir)
 
+from webkitpy.common import exit_codes
 from webkitpy.common import read_checksum_from_png
 from webkitpy.common.system.system_host import SystemHost
 from webkitpy.layout_tests.models import test_run_results
@@ -70,10 +71,10 @@
         return getattr(self.__delegate, name)
 
     def check_build(self, needs_http, printer):
-        return test_run_results.OK_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def check_sys_deps(self, needs_http):
-        return test_run_results.OK_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def _driver_class(self, delegate):
         return self._mocked_driver_maker
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
index 660a676..05a2461 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/port_testcase.py
@@ -33,6 +33,7 @@
 import optparse
 import socket
 
+from webkitpy.common import exit_codes
 from webkitpy.common.system.executive_mock import MockExecutive
 from webkitpy.common.system.log_testing import LoggingTestCase
 from webkitpy.common.system.system_host import SystemHost
@@ -78,7 +79,7 @@
         port._check_driver_build_up_to_date = lambda config: True
         port.check_httpd = lambda: True
         self.assertEqual(port.check_build(needs_http=True, printer=FakePrinter()),
-                         test_run_results.OK_EXIT_STATUS)
+                         exit_codes.OK_EXIT_STATUS)
         # We should get a warning about PrettyPatch being missing,
         # but not the driver itself.
         logs = ''.join(self.logMessages())
@@ -95,7 +96,7 @@
         port._check_file_exists = lambda path, desc: False
         port._check_driver_build_up_to_date = lambda config: False
         self.assertEqual(port.check_build(needs_http=True, printer=FakePrinter()),
-                         test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
+                         exit_codes.UNEXPECTED_ERROR_EXIT_STATUS)
         # And, here we should get warnings about both.
         logs = ''.join(self.logMessages())
         self.assertIn('pretty patches', logs)
@@ -240,9 +241,9 @@
     def test_check_sys_deps(self):
         port = self.make_port()
         port._executive = MockExecutive(exit_code=0)  # pylint: disable=protected-access
-        self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.OK_EXIT_STATUS)
+        self.assertEqual(port.check_sys_deps(needs_http=False), exit_codes.OK_EXIT_STATUS)
         port._executive = MockExecutive(exit_code=1, output='testing output failure')  # pylint: disable=protected-access
-        self.assertEqual(port.check_sys_deps(needs_http=False), test_run_results.SYS_DEPS_EXIT_STATUS)
+        self.assertEqual(port.check_sys_deps(needs_http=False), exit_codes.SYS_DEPS_EXIT_STATUS)
 
     def test_expectations_ordering(self):
         port = self.make_port()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py
index 37394d8..43dce0d 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/test.py
@@ -29,6 +29,7 @@
 import base64
 import time
 
+from webkitpy.common import exit_codes
 from webkitpy.common.system.crash_logs import CrashLogs
 from webkitpy.layout_tests.models import test_run_results
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
@@ -439,10 +440,10 @@
         return 1
 
     def check_build(self, needs_http, printer):
-        return test_run_results.OK_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def check_sys_deps(self, needs_http):
-        return test_run_results.OK_EXIT_STATUS
+        return exit_codes.OK_EXIT_STATUS
 
     def default_configuration(self):
         return 'Release'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py
index 3c7c8ea..3f5c227b 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/win.py
@@ -38,6 +38,7 @@
 except ImportError:
     _winreg = None  # pylint: disable=invalid-name
 
+from webkitpy.common import exit_codes
 from webkitpy.layout_tests.breakpad.dump_reader_win import DumpReaderWin
 from webkitpy.layout_tests.models import test_run_results
 from webkitpy.layout_tests.port import base
@@ -172,7 +173,7 @@
 
         self._crash_service_available = self._check_crash_service_available()
         if not self._crash_service_available:
-            result = test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
+            result = exit_codes.UNEXPECTED_ERROR_EXIT_STATUS
 
         if result:
             _log.error('For complete Windows build requirements, please see:')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
index 0e87c72..c5fe3cdf 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -33,6 +33,7 @@
 import sys
 import traceback
 
+from webkitpy.common import exit_codes
 from webkitpy.common.host import Host
 from webkitpy.layout_tests.controllers.manager import Manager
 from webkitpy.layout_tests.generate_results_dashboard import DashBoardGenerator
@@ -61,14 +62,14 @@
     except (NotImplementedError, ValueError) as error:
         # FIXME: is this the best way to handle unsupported port names?
         print >> stderr, str(error)
-        return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
+        return exit_codes.UNEXPECTED_ERROR_EXIT_STATUS
 
     try:
         return run(port, options, args, stderr, stdout).exit_code
 
     # We need to still handle KeyboardInterrupt, at least for webkitpy unittest cases.
     except KeyboardInterrupt:
-        return test_run_results.INTERRUPTED_EXIT_STATUS
+        return exit_codes.INTERRUPTED_EXIT_STATUS
     except test_run_results.TestRunException as error:
         print >> stderr, error.msg
         return error.code
@@ -76,7 +77,7 @@
         if isinstance(error, Exception):
             print >> stderr, '\n%s raised: %s' % (error.__class__.__name__, error)
             traceback.print_exc(file=stderr)
-        return test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
+        return exit_codes.UNEXPECTED_ERROR_EXIT_STATUS
 
 
 def parse_args(args):
@@ -579,8 +580,8 @@
         printer.flush()
 
         if (not options.dry_run and
-                (run_details.exit_code not in test_run_results.ERROR_CODES or
-                 run_details.exit_code == test_run_results.EARLY_EXIT_STATUS) and
+                (run_details.exit_code not in exit_codes.ERROR_CODES or
+                 run_details.exit_code == exit_codes.EARLY_EXIT_STATUS) and
                 not run_details.initial_results.keyboard_interrupted):
             bot_printer = buildbot_results.BuildBotPrinter(stdout, options.debug_rwt_logging)
             bot_printer.print_results(run_details)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
index 02768f902..76f8050 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests_unittest.py
@@ -34,6 +34,7 @@
 import sys
 import unittest
 
+from webkitpy.common import exit_codes
 from webkitpy.common.host import Host
 from webkitpy.common.host_mock import MockHost
 from webkitpy.common.system.path import abspath_to_uri
@@ -284,7 +285,7 @@
         # Note that this also tests running a test marked as SKIP if
         # you specify it explicitly.
         details, _, _ = logging_run(['failures/expected/keyboard.html', '--child-processes', '1'], tests_included=True)
-        self.assertEqual(details.exit_code, test_run_results.INTERRUPTED_EXIT_STATUS)
+        self.assertEqual(details.exit_code, exit_codes.INTERRUPTED_EXIT_STATUS)
 
         _, regular_output, _ = logging_run(
             ['failures/expected/keyboard.html', 'passes/text.html', '--child-processes', '2', '--skipped=ignore'],
@@ -293,17 +294,17 @@
 
     def test_no_tests_found(self):
         details, err, _ = logging_run(['resources'], tests_included=True)
-        self.assertEqual(details.exit_code, test_run_results.NO_TESTS_EXIT_STATUS)
+        self.assertEqual(details.exit_code, exit_codes.NO_TESTS_EXIT_STATUS)
         self.assert_contains(err, 'No tests to run.\n')
 
     def test_no_tests_found_2(self):
         details, err, _ = logging_run(['foo'], tests_included=True)
-        self.assertEqual(details.exit_code, test_run_results.NO_TESTS_EXIT_STATUS)
+        self.assertEqual(details.exit_code, exit_codes.NO_TESTS_EXIT_STATUS)
         self.assert_contains(err, 'No tests to run.\n')
 
     def test_no_tests_found_3(self):
         details, err, _ = logging_run(['--shard-index', '4', '--total-shards', '400', 'foo/bar.html'], tests_included=True)
-        self.assertEqual(details.exit_code, test_run_results.NO_TESTS_EXIT_STATUS)
+        self.assertEqual(details.exit_code, exit_codes.NO_TESTS_EXIT_STATUS)
         self.assert_contains(err, 'No tests to run.\n')
 
     def test_natural_order(self):
@@ -488,7 +489,7 @@
         self.assertEqual(['passes/text.html'], tests_run)
         host.filesystem.remove(filename)
         details, err, _ = logging_run(['--test-list=%s' % filename], tests_included=True, host=host)
-        self.assertEqual(details.exit_code, test_run_results.NO_TESTS_EXIT_STATUS)
+        self.assertEqual(details.exit_code, exit_codes.NO_TESTS_EXIT_STATUS)
         self.assert_not_empty(err)
 
     def test_test_list_with_prefix(self):
@@ -644,7 +645,7 @@
         # By returning False, we know that the incremental results were generated and then deleted.
         self.assertFalse(host.filesystem.exists('/tmp/layout-test-results/incremental_results.json'))
 
-        self.assertEqual(details.exit_code, test_run_results.EARLY_EXIT_STATUS)
+        self.assertEqual(details.exit_code, exit_codes.EARLY_EXIT_STATUS)
 
         # This checks that passes/text.html is considered Skip-ped.
         self.assertIn('"skipped":1', host.filesystem.read_text_file('/tmp/layout-test-results/full_results.json'))
@@ -966,7 +967,7 @@
         stderr = StringIO.StringIO()
         res = run_webkit_tests.main(['--platform', 'foo'], stdout, stderr)
 
-        self.assertEqual(res, test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
+        self.assertEqual(res, exit_codes.UNEXPECTED_ERROR_EXIT_STATUS)
         self.assertEqual(stdout.getvalue(), '')
         self.assertTrue('unsupported platform' in stderr.getvalue())
 
@@ -979,7 +980,7 @@
         out = StringIO.StringIO()
         err = StringIO.StringIO()
         self.assertEqual(run_webkit_tests.main(
-            ['--platform', port_name, 'fast/harness/results.html'], out, err), test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
+            ['--platform', port_name, 'fast/harness/results.html'], out, err), exit_codes.UNEXPECTED_ERROR_EXIT_STATUS)
 
     def test_verbose_in_child_processes(self):
         # When we actually run multiple processes, we may have to reconfigure logging in the
@@ -1021,7 +1022,7 @@
                                      'failures/unexpected/missing_text.html',
                                      'failures/unexpected/missing_image.html'],
                                     stdout, stderr)
-        self.assertEqual(res, test_run_results.EARLY_EXIT_STATUS)
+        self.assertEqual(res, exit_codes.EARLY_EXIT_STATUS)
         self.assertEqual(stdout.getvalue(),
                          ('\n'
                           'Regressions: Unexpected missing results (1)\n'
@@ -1177,7 +1178,7 @@
         def successful_run(port, options, args, printer):
 
             class FakeRunDetails(object):
-                exit_code = test_run_results.UNEXPECTED_ERROR_EXIT_STATUS
+                exit_code = exit_codes.UNEXPECTED_ERROR_EXIT_STATUS
 
             return FakeRunDetails()
 
@@ -1189,14 +1190,14 @@
         try:
             run_webkit_tests._run_tests = interrupting_run
             res = run_webkit_tests.main([], stdout, stderr)
-            self.assertEqual(res, test_run_results.INTERRUPTED_EXIT_STATUS)
+            self.assertEqual(res, exit_codes.INTERRUPTED_EXIT_STATUS)
 
             run_webkit_tests._run_tests = successful_run
             res = run_webkit_tests.main(['--platform', 'test'], stdout, stderr)
-            self.assertEqual(res, test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
+            self.assertEqual(res, exit_codes.UNEXPECTED_ERROR_EXIT_STATUS)
 
             run_webkit_tests._run_tests = exception_raising_run
             res = run_webkit_tests.main([], stdout, stderr)
-            self.assertEqual(res, test_run_results.UNEXPECTED_ERROR_EXIT_STATUS)
+            self.assertEqual(res, exit_codes.UNEXPECTED_ERROR_EXIT_STATUS)
         finally:
             run_webkit_tests._run_tests = orig_run_fn
diff --git a/third_party/WebKit/Tools/Scripts/wpt-import b/third_party/WebKit/Tools/Scripts/wpt-import
index 78850d7..f8b1d5d 100755
--- a/third_party/WebKit/Tools/Scripts/wpt-import
+++ b/third_party/WebKit/Tools/Scripts/wpt-import
@@ -5,6 +5,7 @@
 
 """Pulls the latest revisions of the web-platform-tests or csswg-test repos."""
 
+from webkitpy.common import exit_codes
 from webkitpy.common import version_check
 from webkitpy.common.host import Host
 from webkitpy.w3c.test_importer import TestImporter
@@ -17,4 +18,4 @@
         host.exit(importer.main())
     except KeyboardInterrupt:
         host.print_("Interrupted, exiting")
-        host.exit(130)
+        host.exit(exit_codes.INTERRUPTED_EXIT_STATUS)
diff --git a/third_party/libjingle_xmpp/task_runner/task_unittest.cc b/third_party/libjingle_xmpp/task_runner/task_unittest.cc
index 7408ec4..8618f26 100644
--- a/third_party/libjingle_xmpp/task_runner/task_unittest.cc
+++ b/third_party/libjingle_xmpp/task_runner/task_unittest.cc
@@ -97,6 +97,9 @@
 
 class MyTaskRunner : public TaskRunner {
  public:
+  MyTaskRunner() { ThreadManager::Instance()->WrapCurrentThread(); }
+  ~MyTaskRunner() { ThreadManager::Instance()->UnwrapCurrentThread(); }
+
   virtual void WakeTasks() { RunTasks(); }
   virtual int64_t CurrentTime() { return GetCurrentTime(); }
 
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 43d8dcae..d42f33e 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -42525,19 +42525,19 @@
 </histogram>
 
 <histogram name="NewTabPage.TileType" enum="NTPTileVisualType">
-  <owner>newt@chromium.org</owner>
+  <owner>mastiz@chromium.org</owner>
   <summary>
     The visual type of each most visited tile displayed on the new tab page,
     e.g. actual thumbnail or placeholder thumbnail. This is recorded for each
-    most visited item when the NTP is opened. Only measured on Android.
+    most visited item when the NTP is opened.
   </summary>
 </histogram>
 
 <histogram name="NewTabPage.TileTypeClicked" enum="NTPTileVisualType">
-  <owner>newt@chromium.org</owner>
+  <owner>mastiz@chromium.org</owner>
   <summary>
     The visual type of the most visited item that the user clicked on, e.g.
-    actual thumbnail or placeholder thumbnail. Only measured on Android.
+    actual thumbnail or placeholder thumbnail.
   </summary>
 </histogram>
 
@@ -104767,6 +104767,12 @@
   <int value="6" label="DeprecatedThumbnailDefault">
     Deprecated: The item displays a default graphic in place of a thumbnail.
   </int>
+  <int value="7" label="Thumbnail">
+    The item displays a thumbnail of the page.
+  </int>
+  <int value="8" label="ThumbnailFailed">
+    The item displays a default gray box in place of a thumbnail.
+  </int>
 </enum>
 
 <enum name="NTSTATUS" type="int">
diff --git a/tools/perf/benchmarks/v8.py b/tools/perf/benchmarks/v8.py
index 1761f82..e671c67 100644
--- a/tools/perf/benchmarks/v8.py
+++ b/tools/perf/benchmarks/v8.py
@@ -188,7 +188,7 @@
   """Measures V8 GC metrics and memory usage while scrolling the top web pages.
   http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
 
-  page_set = page_sets.InfiniteScrollPageSet
+  page_set = page_sets.InfiniteScrollStorySet
 
   @classmethod
   def Name(cls):
@@ -228,7 +228,7 @@
   web pages.
   http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
 
-  page_set = page_sets.MobileInfiniteScrollPageSet
+  page_set = page_sets.MobileInfiniteScrollStorySet
 
   @classmethod
   def Name(cls):
diff --git a/tools/perf/page_sets/infinite_scroll_cases.py b/tools/perf/page_sets/infinite_scroll_cases.py
index 7930a6e..25221f0 100644
--- a/tools/perf/page_sets/infinite_scroll_cases.py
+++ b/tools/perf/page_sets/infinite_scroll_cases.py
@@ -1,80 +1,157 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
+# 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.
-from telemetry.page import page as page_module
+
+import sys
+
+from page_sets.login_helpers import facebook_login
+from page_sets.system_health import platforms
+from telemetry.core import discover
+from telemetry.page import page
 from telemetry.page import shared_page_state
 from telemetry import story
 
-TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5
-SCROLL_TIMEOUT_IN_SECONDS = 120
+class _InfiniteScrollStory(page.Page):
+  """ Base class for infinite scroll stories."""
 
-# TODO(ulan): Remove this once crbug.com/541508 is fixed.
-STARTUP_SCRIPT = '''
-    window.WebSocket = undefined;
-    window.Worker = undefined;
-    window.performance = undefined;'''
+  NAME = NotImplemented
+  URL = NotImplemented
+  SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS
 
+  SCROLL_DISTANCE = 25000
+  SCROLL_STEP = 1000
+  MAX_SCROLL_RETRIES = 3
+  TIME_BEFORE_SCROLL_RETRY_IN_SECONDS = 1
+  TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5
 
-class InfiniteScrollPage(page_module.Page):
-  def __init__(self, url, page_set, name, scroll_amount, delay, repeat,
-               credentials=None):
-    super(InfiniteScrollPage, self).__init__(
-        url=url, page_set=page_set, name=name,
+  def __init__(self, story_set):
+    super(_InfiniteScrollStory, self).__init__(
+        page_set=story_set, url=self.URL, name=self.NAME,
         shared_page_state_class=shared_page_state.SharedPageState,
-       credentials_path='data/credentials.json')
-    self.credentials = credentials
-    self.script_to_evaluate_on_commit = STARTUP_SCRIPT
-    self.scroll_amount = scroll_amount
-    self.delay = delay
-    self.repeat = repeat
+        credentials_path='data/credentials.json')
+    # TODO(ulan): Remove this once crbug.com/541508 is fixed.
+    self.script_to_evaluate_on_commit = '''
+        window.WebSocket = undefined;
+        window.Worker = undefined;
+        window.performance = undefined;'''
 
   def RunPageInteractions(self, action_runner):
-    self._WaitAction(action_runner)
-    self._ScrollAction(action_runner, self.scroll_amount, self.delay,
-                       self.repeat)
-
-  def _ScrollAction(self, action_runner, scroll_amount, delay, repeat):
-    with action_runner.CreateInteraction('Begin'):
-      action_runner.tab.browser.DumpMemory()
-    with action_runner.CreateInteraction('Scrolling'):
-      action_runner.RepeatableBrowserDrivenScroll(
-        y_scroll_distance_ratio=scroll_amount,
-        repeat_delay_ms=delay,
-        repeat_count=repeat,
-        timeout=SCROLL_TIMEOUT_IN_SECONDS)
-    with action_runner.CreateInteraction('End'):
-      action_runner.tab.browser.DumpMemory()
-
-  def _WaitAction(self, action_runner):
     with action_runner.CreateInteraction('Load'):
       action_runner.WaitForJavaScriptCondition(
         'document.body != null && '
         'document.body.scrollHeight > window.innerHeight && '
         '!document.body.addEventListener("touchstart", function() {})')
     with action_runner.CreateInteraction('Wait'):
-      action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS)
+      action_runner.Wait(self.TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS)
     with action_runner.CreateInteraction('GC'):
       action_runner.ForceGarbageCollection()
+    with action_runner.CreateInteraction('Begin'):
+      action_runner.tab.browser.DumpMemory()
+    with action_runner.CreateInteraction('Scrolling'):
+      self._Scroll(action_runner, self.SCROLL_DISTANCE, self.SCROLL_STEP)
+    with action_runner.CreateInteraction('End'):
+      action_runner.tab.browser.DumpMemory()
 
+  def _Scroll(self, action_runner, distance, step_size):
+    """ This function scrolls the webpage by the given scroll distance in
+    multiple steps, where each step (except the last one) has the given size.
 
-class InfiniteScrollPageSet(story.StorySet):
-  """ Top pages that can be scrolled for many pages. """
+    If scrolling gets stuck, the functions retries scrolling MAX_SCROLL_RETRIES
+    times waiting TIME_BEFORE_SCROLL_RETRY_IN_SECONDS seconds between retries.
+    """
+    remaining = distance - action_runner.EvaluateJavaScript('window.scrollY')
+    retry_count = 0
+    # Scroll until the window.scrollY is within 1 pixel of the target distance.
+    while remaining > 1:
+      action_runner.ScrollPage(distance=min(remaining, step_size) + 1)
+      new_remaining = (distance -
+          action_runner.EvaluateJavaScript('window.scrollY'))
+      if remaining == new_remaining:
+        # Scrolling is stuck. This can happen if the page is loading
+        # resources. Give the page some time and retry scrolling.
+        if retry_count == self.MAX_SCROLL_RETRIES:
+          raise Exception('Scrolling stuck at %d' % remaining)
+        retry_count += 1
+        action_runner.Wait(self.TIME_BEFORE_SCROLL_RETRY_IN_SECONDS)
+      else:
+        retry_count = 0
+        remaining = new_remaining
+
+class DiscourseDesktopStory(_InfiniteScrollStory):
+  NAME = 'discourse'
+  URL = ('https://meta.discourse.org/t/the-official-discourse-tags-plugin' +
+     '-discourse-tagging/26482')
+  SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
+
+class DiscourseMobileStory(_InfiniteScrollStory):
+  NAME = 'discourse'
+  URL = ('https://meta.discourse.org/t/the-official-discourse-tags-plugin' +
+     '-discourse-tagging/26482')
+  SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+  SCROLL_DISTANCE = 15000
+
+class FacebookDesktopStory(_InfiniteScrollStory):
+  NAME = 'facebook'
+  URL = 'https://www.facebook.com/shakira'
+  SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
+
+class FacebookMobileStory(_InfiniteScrollStory):
+  NAME = 'facebook'
+  URL = 'https://m.facebook.com/shakira'
+  SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+  def RunNavigateSteps(self, action_runner):
+    facebook_login.LoginWithMobileSite(
+        action_runner, 'facebook3', self.credentials_path)
+    super(FacebookMobileStory, self).RunNavigateSteps(action_runner)
+
+class FlickrDesktopStory(_InfiniteScrollStory):
+  NAME = 'flickr'
+  URL = 'https://www.flickr.com/explore'
+  SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
+
+class FlickrMobileStory(_InfiniteScrollStory):
+  NAME = 'flickr'
+  URL = 'https://www.flickr.com/explore'
+  SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+  SCROLL_DISTANCE = 10000
+
+class PinterestMobileStory(_InfiniteScrollStory):
+  NAME = 'pinterest'
+  URL = 'https://www.pinterest.com/all'
+  SUPPORTED_PLATFORMS = platforms.MOBILE_ONLY
+
+class TumblrStory(_InfiniteScrollStory):
+  NAME = 'tumblr'
+  URL = 'http://techcrunch.tumblr.com/'
+
+class TwitterDesktopStory(_InfiniteScrollStory):
+  NAME = 'twitter'
+  URL = 'https://twitter.com/taylorswift13'
+  SUPPORTED_PLATFORMS = platforms.DESKTOP_ONLY
+
+class InfiniteScrollStorySet(story.StorySet):
+  """ Desktop story set. """
   def __init__(self):
-    super(InfiniteScrollPageSet, self).__init__(
+    super(InfiniteScrollStorySet, self).__init__(
         archive_data_file='data/infinite_scroll.json',
         cloud_storage_bucket=story.PARTNER_BUCKET)
-    # The scroll distance is chosen such that the page can be scrolled
-    # continuously through the test without hitting the end of the page.
-    SCROLL_FAR = 60
-    SCROLL_PAGE = 1
-    pages = [
-        ('https://www.facebook.com/shakira', 'facebook', SCROLL_FAR, 0, 0),
-        ('https://twitter.com/taylorswift13', 'twitter', SCROLL_PAGE, 10, 30),
-        ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR, 0, 0),
-        ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0),
-        ('https://meta.discourse.org/t/the-official-discourse-tags-plugin-discourse-tagging/26482',
-         'discourse', SCROLL_PAGE, 10, 30)
-    ]
-    for (url, name, scroll_amount, delay, repeat) in pages:
-      self.AddStory(
-        InfiniteScrollPage(url, self, name, scroll_amount, delay, repeat))
+    for story_class in _FindInfiniteScrollStoryClasses(platforms.DESKTOP):
+      self.AddStory(story_class(self))
+
+class MobileInfiniteScrollStorySet(story.StorySet):
+  """ Mobile story set. """
+  def __init__(self):
+    super(MobileInfiniteScrollStorySet, self).__init__(
+        archive_data_file='data/mobile_infinite_scroll.json',
+        cloud_storage_bucket=story.PARTNER_BUCKET)
+    for story_class in _FindInfiniteScrollStoryClasses(platforms.MOBILE):
+      self.AddStory(story_class(self))
+
+def _FindInfiniteScrollStoryClasses(platform):
+  # Sort the classes by their names so that their order is stable and
+  # deterministic.
+  for unused_cls_name, cls in sorted(discover.DiscoverClassesInModule(
+      module=sys.modules[__name__], base_class=_InfiniteScrollStory,
+      index_by_class_name=True).iteritems()):
+    if platform in cls.SUPPORTED_PLATFORMS:
+      yield cls
diff --git a/tools/perf/page_sets/mobile_infinite_scroll_cases.py b/tools/perf/page_sets/mobile_infinite_scroll_cases.py
deleted file mode 100644
index adf4271..0000000
--- a/tools/perf/page_sets/mobile_infinite_scroll_cases.py
+++ /dev/null
@@ -1,98 +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.
-from page_sets import mobile_facebook_page
-from telemetry.page import page as page_module
-from telemetry.page import shared_page_state
-from telemetry import story
-
-TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS = 5
-SCROLL_TIMEOUT_IN_SECONDS = 120
-
-# TODO(ulan): Remove this once crbug.com/541508 is fixed.
-STARTUP_SCRIPT = '''
-    window.WebSocket = undefined;
-    window.Worker = undefined;
-    window.performance = undefined;'''
-
-def _ScrollAction(action_runner, scroll_amount, delay, repeat):
-  with action_runner.CreateInteraction('Begin'):
-    action_runner.tab.browser.DumpMemory()
-  with action_runner.CreateInteraction('Scrolling'):
-    action_runner.RepeatableBrowserDrivenScroll(
-      y_scroll_distance_ratio=scroll_amount,
-      repeat_delay_ms=delay,
-      repeat_count=repeat,
-      timeout=SCROLL_TIMEOUT_IN_SECONDS)
-  with action_runner.CreateInteraction('End'):
-    action_runner.tab.browser.DumpMemory()
-
-def _WaitAction(action_runner):
-  with action_runner.CreateInteraction('Load'):
-    action_runner.WaitForJavaScriptCondition(
-      'document.body != null && '
-      'document.body.scrollHeight > window.innerHeight && '
-      '!document.body.addEventListener("touchstart", function() {})')
-  with action_runner.CreateInteraction('Wait'):
-    action_runner.Wait(TIME_TO_WAIT_BEFORE_STARTING_IN_SECONDS)
-  with action_runner.CreateInteraction('GC'):
-    action_runner.ForceGarbageCollection()
-
-class MobileInfiniteScrollPage(page_module.Page):
-  def __init__(self, url, page_set, name, scroll_amount, delay, repeat,
-               credentials=None):
-    super(MobileInfiniteScrollPage, self).__init__(
-        url=url, page_set=page_set, name=name,
-        shared_page_state_class=shared_page_state.SharedPageState,
-       credentials_path='data/credentials.json')
-    self.credentials = credentials
-    self.script_to_evaluate_on_commit = STARTUP_SCRIPT
-    self.scroll_amount = scroll_amount
-    self.delay = delay
-    self.repeat = repeat
-
-  def RunPageInteractions(self, action_runner):
-    _WaitAction(action_runner)
-    _ScrollAction(action_runner, self.scroll_amount, self.delay,
-                       self.repeat)
-
-class MobileInfiniteScrollFacebookPage(mobile_facebook_page.MobileFacebookPage):
-  def __init__(self, url, page_set, name, scroll_amount, delay, repeat):
-    super(MobileInfiniteScrollFacebookPage, self).__init__(
-        url=url, page_set=page_set,
-        shared_page_state_class=shared_page_state.SharedPageState,
-        name=name)
-    self.script_to_evaluate_on_commit = STARTUP_SCRIPT
-    self.scroll_amount = scroll_amount
-    self.delay = delay
-    self.repeat = repeat
-
-  def RunPageInteractions(self, action_runner):
-    _WaitAction(action_runner)
-    _ScrollAction(action_runner, self.scroll_amount, self.delay,
-                       self.repeat)
-
-class MobileInfiniteScrollPageSet(story.StorySet):
-  """ Top mobile pages that can be scrolled for many pages. """
-  def __init__(self):
-    super(MobileInfiniteScrollPageSet, self).__init__(
-        archive_data_file='data/mobile_infinite_scroll.json',
-        cloud_storage_bucket=story.PARTNER_BUCKET)
-    # The scroll distance is chosen such that the page can be scrolled
-    # continuously through the test without hitting the end of the page.
-    SCROLL_FAR = 60
-    SCROLL_PAGE = 1
-    pages = [
-        ('https://m.facebook.com/shakira', 'facebook', SCROLL_FAR, 0, 0),
-        ('https://www.pinterest.com/all', 'pinterest', SCROLL_FAR, 0, 0),
-        ('http://techcrunch.tumblr.com/', 'tumblr', SCROLL_FAR, 0, 0),
-        ('https://www.flickr.com/explore', 'flickr', SCROLL_FAR, 0, 0),
-        ('https://meta.discourse.org/t/the-official-discourse-tags-plugin-discourse-tagging/26482',
-         'discourse', SCROLL_PAGE, 10, 30)
-    ]
-    self.AddStory(
-      MobileInfiniteScrollFacebookPage(pages[0][0], self, pages[0][1],
-                                       pages[0][2], pages[0][3], pages[0][4]))
-    for (url, name, scroll_amount, delay, repeat) in pages[1:]:
-      self.AddStory(
-        MobileInfiniteScrollPage(url, self, name, scroll_amount, delay, repeat))
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 375d42b..133416a 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -474,7 +474,7 @@
 
 void MessageCenterView::ClickOnSettingsButton(
     const std::string& notification_id) {
-  message_center_->ClickOnSettingsButton(notification_id);
+  tray_->ShowNotifierSettingsBubble();
 }
 
 void MessageCenterView::UpdateNotificationSize(
diff --git a/ui/message_center/views/message_popup_collection.cc b/ui/message_center/views/message_popup_collection.cc
index 0a2afc4..8b43c9c 100644
--- a/ui/message_center/views/message_popup_collection.cc
+++ b/ui/message_center/views/message_popup_collection.cc
@@ -122,7 +122,7 @@
 
 void MessagePopupCollection::ClickOnSettingsButton(
     const std::string& notification_id) {
-  message_center_->ClickOnSettingsButton(notification_id);
+  tray_->ShowNotifierSettingsBubble();
 }
 
 void MessagePopupCollection::UpdateNotificationSize(