diff --git a/.gitignore b/.gitignore
index d12ac93b..aaf4bf7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -372,7 +372,6 @@
 /third_party/jsoncpp/source
 /third_party/jsr-305/src
 /third_party/junit/src
-/third_party/kasko
 /third_party/khronos_glcts
 /third_party/leakcanary/src
 /third_party/leveldatabase/src
diff --git a/.gn b/.gn
index be1fb72..0042ecbb 100644
--- a/.gn
+++ b/.gn
@@ -137,7 +137,6 @@
 
   #"//third_party/*",  # May not ever want this.
   "//third_party/hunspell/*",
-  "//third_party/kasko/*",
   "//third_party/libaddressinput/*",
   "//third_party/libphonenumber/*",
   "//third_party/WebKit/Source/*",
diff --git a/DEPS b/DEPS
index 2ab47ae..6bd48d4 100644
--- a/DEPS
+++ b/DEPS
@@ -40,11 +40,11 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling Skia
   # and whatever else without interference from each other.
-  'skia_revision': '44f80a24f010e99de773dad89fb9f50100898969',
+  'skia_revision': '0bd699e497819344083df4715928a54a597cd630',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
-  'v8_revision': 'b30e976b3bbab8b7c0a193300f1b316b9be79fa5',
+  'v8_revision': '8a548224319bcd3e903ab94edfa8c1986bd3757e',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling swarming_client
   # and whatever else without interference from each other.
@@ -64,7 +64,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling PDFium
   # and whatever else without interference from each other.
-  'pdfium_revision': '1f5e327bc8a4114b5c390b89ac94ee320d1d06de',
+  'pdfium_revision': '5c19c3597b2865c0b5bc2c61fc5911cbd5d6ba90',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling openmax_dl
   # and whatever else without interference from each other.
@@ -96,7 +96,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling catapult
   # and whatever else without interference from each other.
-  'catapult_revision': 'a801abb6bc4419c4d50a9c47a504a001bc1568c4',
+  'catapult_revision': 'fc2f450c1b33802d3e1b5f5d2cb240e6b501e61f',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling libFuzzer
   # and whatever else without interference from each other.
@@ -1004,19 +1004,6 @@
                '--copy-dia-binaries',
     ],
   },
-  # TODO(pmonette): Move include files out of binaries folder.
-  {
-    'name': 'kasko',
-    'pattern': '.',
-    'action': ['python',
-               'src/build/get_syzygy_binaries.py',
-               '--output-dir=src/third_party/kasko/binaries',
-               '--revision=266a18d9209be5ca5c5dcd0620942b82a2d238f3',
-               '--resource=kasko.zip',
-               '--resource=kasko_symbols.zip',
-               '--overwrite',
-    ],
-  },
   {
     'name': 'apache_win32',
     'pattern': '\\.sha1',
diff --git a/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java b/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java
index c8b3ae7..802a2f9 100644
--- a/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java
+++ b/android_webview/tools/system_webview_shell/apk/src/org/chromium/webview_shell/WebViewBrowserActivity.java
@@ -44,6 +44,7 @@
 import android.widget.FrameLayout;
 import android.widget.PopupMenu;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import org.chromium.base.Log;
 
@@ -56,6 +57,7 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -74,6 +76,12 @@
     // WebKit permissions with no corresponding Android permission can always be granted
     private static final String NO_ANDROID_PERMISSION = "NO_ANDROID_PERMISSION";
 
+    // TODO(timav): Remove these variables after http://crbug.com/626202 is fixed.
+    // The Bundle key for WebView serialized state
+    private static final String SAVE_RESTORE_STATE_KEY = "WEBVIEW_CHROMIUM_STATE";
+    // Maximal size of this state.
+    private static final int MAX_STATE_LENGTH = 300 * 1024;
+
     // Map from WebKit permissions to Android permissions
     private static final HashMap<String, String> sPermissions;
     static {
@@ -214,6 +222,17 @@
     public void onSaveInstanceState(Bundle savedInstanceState) {
         // Deliberately don't catch TransactionTooLargeException here.
         mWebView.saveState(savedInstanceState);
+
+        // TODO(timav): Remove this hack after http://crbug.com/626202 is fixed.
+        // Drop the saved state of it is too long since Android N and above
+        // can't handle large states without a crash.
+        byte[] webViewState = savedInstanceState.getByteArray(SAVE_RESTORE_STATE_KEY);
+        if (webViewState != null && webViewState.length > MAX_STATE_LENGTH) {
+            savedInstanceState.remove(SAVE_RESTORE_STATE_KEY);
+            String message = String.format(
+                    Locale.US, "Can't save state: %dkb is too long", webViewState.length / 1024);
+            Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
+        }
     }
 
     @Override
diff --git a/ash/common/system/tray/tray_popup_utils.cc b/ash/common/system/tray/tray_popup_utils.cc
index cc0632fb..3c2a607f 100644
--- a/ash/common/system/tray/tray_popup_utils.cc
+++ b/ash/common/system/tray/tray_popup_utils.cc
@@ -4,6 +4,9 @@
 
 #include "ash/common/system/tray/tray_popup_utils.h"
 
+#include <algorithm>
+#include <utility>
+
 #include "ash/common/ash_constants.h"
 #include "ash/common/ash_view_ids.h"
 #include "ash/common/material_design/material_design_controller.h"
@@ -350,30 +353,9 @@
     const views::View* host,
     const gfx::Point& center_point,
     SkColor color) {
-  const gfx::Rect bounds =
-      TrayPopupUtils::GetInkDropBounds(ink_drop_style, host);
-  switch (ink_drop_style) {
-    case TrayPopupInkDropStyle::HOST_CENTERED:
-      if (MaterialDesignController::GetMode() ==
-          MaterialDesignController::MATERIAL_EXPERIMENTAL) {
-        return base::MakeUnique<views::SquareInkDropRipple>(
-            bounds.size(), bounds.size().width() / 2, bounds.size(),
-            bounds.size().width() / 2, center_point, bounds.CenterPoint(),
-            color, kTrayPopupInkDropRippleOpacity);
-      }
-    // Intentional fall through.
-    case TrayPopupInkDropStyle::INSET_BOUNDS:
-    case TrayPopupInkDropStyle::FILL_BOUNDS: {
-      const gfx::Insets insets =
-          TrayPopupUtils::GetInkDropInsets(ink_drop_style);
-      return base::MakeUnique<views::FloodFillInkDropRipple>(
-          host->size(), insets, center_point, color,
-          kTrayPopupInkDropRippleOpacity);
-    }
-  }
-  // Required for some compilers.
-  NOTREACHED();
-  return nullptr;
+  return base::MakeUnique<views::FloodFillInkDropRipple>(
+      host->size(), TrayPopupUtils::GetInkDropInsets(ink_drop_style),
+      center_point, color, kTrayPopupInkDropRippleOpacity);
 }
 
 std::unique_ptr<views::InkDropHighlight> TrayPopupUtils::CreateInkDropHighlight(
diff --git a/ash/common/system/tray/tray_popup_utils.h b/ash/common/system/tray/tray_popup_utils.h
index 557ce070..1e73c1fc 100644
--- a/ash/common/system/tray/tray_popup_utils.h
+++ b/ash/common/system/tray/tray_popup_utils.h
@@ -5,6 +5,8 @@
 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_UTILS_H_
 #define ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_UTILS_H_
 
+#include <memory>
+
 #include "ash/common/login_status.h"
 #include "ash/common/system/tray/tray_constants.h"
 #include "ash/common/system/tray/tray_popup_ink_drop_style.h"
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc
index 3668e51..b19455ab 100644
--- a/ash/display/display_manager_unittest.cc
+++ b/ash/display/display_manager_unittest.cc
@@ -526,22 +526,22 @@
 
     EXPECT_EQ(8U, display_manager()->GetNumDisplays());
 
-    EXPECT_EQ("0,0 480x400",
-              display_manager()->GetDisplayAt(0).bounds().ToString());
-    EXPECT_EQ("50,400 480x400",
-              display_manager()->GetDisplayAt(1).bounds().ToString());
-    EXPECT_EQ("480,0 480x400",
-              display_manager()->GetDisplayAt(2).bounds().ToString());
-    EXPECT_EQ("960,30 480x400",
-              display_manager()->GetDisplayAt(3).bounds().ToString());
-    EXPECT_EQ("730,430 480x400",
-              display_manager()->GetDisplayAt(4).bounds().ToString());
-    EXPECT_EQ("-730,-300 480x400",
-              display_manager()->GetDisplayAt(5).bounds().ToString());
-    EXPECT_EQ("-250,-400 480x400",
-              display_manager()->GetDisplayAt(6).bounds().ToString());
-    EXPECT_EQ("-780,-450 530x150",
-              display_manager()->GetDisplayAt(7).bounds().ToString());
+    EXPECT_EQ(gfx::Rect(0, 0, 480, 400),
+              display_manager()->GetDisplayAt(0).bounds());
+    EXPECT_EQ(gfx::Rect(50, 400, 480, 400),
+              display_manager()->GetDisplayAt(1).bounds());
+    EXPECT_EQ(gfx::Rect(480, 0, 480, 400),
+              display_manager()->GetDisplayAt(2).bounds());
+    EXPECT_EQ(gfx::Rect(960, 30, 480, 400),
+              display_manager()->GetDisplayAt(3).bounds());
+    EXPECT_EQ(gfx::Rect(730, 430, 480, 400),
+              display_manager()->GetDisplayAt(4).bounds());
+    EXPECT_EQ(gfx::Rect(-730, -300, 480, 400),
+              display_manager()->GetDisplayAt(5).bounds());
+    EXPECT_EQ(gfx::Rect(-250, -400, 480, 400),
+              display_manager()->GetDisplayAt(6).bounds());
+    EXPECT_EQ(gfx::Rect(-780, -450, 530, 150),
+              display_manager()->GetDisplayAt(7).bounds());
 
     // Expect that the displays have been reparented correctly, such that a
     // child is always touching its parent.
@@ -618,14 +618,14 @@
     //
 
     EXPECT_EQ(4U, display_manager()->GetNumDisplays());
-    EXPECT_EQ("0,0 696x800",
-              display_manager()->GetDisplayAt(0).bounds().ToString());
-    EXPECT_EQ("0,800 696x800",
-              display_manager()->GetDisplayAt(1).bounds().ToString());
-    EXPECT_EQ("696,800 300x800",
-              display_manager()->GetDisplayAt(2).bounds().ToString());
-    EXPECT_EQ("996,100 696x800",
-              display_manager()->GetDisplayAt(3).bounds().ToString());
+    EXPECT_EQ(gfx::Rect(0, 0, 696, 800),
+              display_manager()->GetDisplayAt(0).bounds());
+    EXPECT_EQ(gfx::Rect(0, 800, 696, 800),
+              display_manager()->GetDisplayAt(1).bounds());
+    EXPECT_EQ(gfx::Rect(696, 800, 300, 800),
+              display_manager()->GetDisplayAt(2).bounds());
+    EXPECT_EQ(gfx::Rect(996, 100, 696, 800),
+              display_manager()->GetDisplayAt(3).bounds());
 
     // This case if not handled correctly might lead to a cyclic dependency.
     // Make sure this doesn't happen.
@@ -683,12 +683,12 @@
     // +---------+
 
     EXPECT_EQ(3U, display_manager()->GetNumDisplays());
-    EXPECT_EQ("0,0 696x500",
-              display_manager()->GetDisplayAt(0).bounds().ToString());
-    EXPECT_EQ("-696,0 696x500",
-              display_manager()->GetDisplayAt(1).bounds().ToString());
-    EXPECT_EQ("-696,500 696x500",
-              display_manager()->GetDisplayAt(2).bounds().ToString());
+    EXPECT_EQ(gfx::Rect(0, 0, 696, 500),
+              display_manager()->GetDisplayAt(0).bounds());
+    EXPECT_EQ(gfx::Rect(-696, 0, 696, 500),
+              display_manager()->GetDisplayAt(1).bounds());
+    EXPECT_EQ(gfx::Rect(-696, 500, 696, 500),
+              display_manager()->GetDisplayAt(2).bounds());
   }
 
   {
@@ -735,12 +735,12 @@
     //
 
     EXPECT_EQ(3U, display_manager()->GetNumDisplays());
-    EXPECT_EQ("0,0 696x500",
-              display_manager()->GetDisplayAt(0).bounds().ToString());
-    EXPECT_EQ("0,-500 696x500",
-              display_manager()->GetDisplayAt(1).bounds().ToString());
-    EXPECT_EQ("-696,-500 696x500",
-              display_manager()->GetDisplayAt(2).bounds().ToString());
+    EXPECT_EQ(gfx::Rect(0, 0, 696, 500),
+              display_manager()->GetDisplayAt(0).bounds());
+    EXPECT_EQ(gfx::Rect(0, -500, 696, 500),
+              display_manager()->GetDisplayAt(1).bounds());
+    EXPECT_EQ(gfx::Rect(-696, -500, 696, 500),
+              display_manager()->GetDisplayAt(2).bounds());
   }
 }
 
@@ -788,14 +788,14 @@
   //
 
   EXPECT_EQ(4U, display_manager()->GetNumDisplays());
-  EXPECT_EQ("0,0 1200x500",
-            display_manager()->GetDisplayAt(0).bounds().ToString());
-  EXPECT_EQ("-110,-500 600x500",
-            display_manager()->GetDisplayAt(1).bounds().ToString());
-  EXPECT_EQ("490,-500 600x500",
-            display_manager()->GetDisplayAt(2).bounds().ToString());
-  EXPECT_EQ("1090,-500 600x500",
-            display_manager()->GetDisplayAt(3).bounds().ToString());
+  EXPECT_EQ(gfx::Rect(0, 0, 1200, 500),
+            display_manager()->GetDisplayAt(0).bounds());
+  EXPECT_EQ(gfx::Rect(-110, -500, 600, 500),
+            display_manager()->GetDisplayAt(1).bounds());
+  EXPECT_EQ(gfx::Rect(490, -500, 600, 500),
+            display_manager()->GetDisplayAt(2).bounds());
+  EXPECT_EQ(gfx::Rect(1090, -500, 600, 500),
+            display_manager()->GetDisplayAt(3).bounds());
 }
 
 TEST_P(DisplayManagerTest, NoOverlappedDisplaysAfterResolutionChange) {
@@ -839,16 +839,16 @@
 
   // There should be no overlap at all.
   EXPECT_EQ(5U, display_manager()->GetNumDisplays());
-  EXPECT_EQ("0,0 1000x500",
-            display_manager()->GetDisplayAt(0).bounds().ToString());
-  EXPECT_EQ("-250,-500 500x500",
-            display_manager()->GetDisplayAt(1).bounds().ToString());
-  EXPECT_EQ("250,-500 500x500",
-            display_manager()->GetDisplayAt(2).bounds().ToString());
-  EXPECT_EQ("750,-500 500x500",
-            display_manager()->GetDisplayAt(3).bounds().ToString());
-  EXPECT_EQ("0,-1000 1000x500",
-            display_manager()->GetDisplayAt(4).bounds().ToString());
+  EXPECT_EQ(gfx::Rect(0, 0, 1000, 500),
+            display_manager()->GetDisplayAt(0).bounds());
+  EXPECT_EQ(gfx::Rect(-250, -500, 500, 500),
+            display_manager()->GetDisplayAt(1).bounds());
+  EXPECT_EQ(gfx::Rect(250, -500, 500, 500),
+            display_manager()->GetDisplayAt(2).bounds());
+  EXPECT_EQ(gfx::Rect(750, -500, 500, 500),
+            display_manager()->GetDisplayAt(3).bounds());
+  EXPECT_EQ(gfx::Rect(0, -1000, 1000, 500),
+            display_manager()->GetDisplayAt(4).bounds());
 
   // Change the resolution of display (2) and expect the following layout.
   //
@@ -875,16 +875,103 @@
   UpdateDisplay("1000x500,500x500,600x600,500x500,1000x500");
 
   EXPECT_EQ(5U, display_manager()->GetNumDisplays());
-  EXPECT_EQ("0,0 1000x500",
-            display_manager()->GetDisplayAt(0).bounds().ToString());
-  EXPECT_EQ("-250,-500 500x500",
-            display_manager()->GetDisplayAt(1).bounds().ToString());
-  EXPECT_EQ("250,-600 600x600",
-            display_manager()->GetDisplayAt(2).bounds().ToString());
-  EXPECT_EQ("850,-500 500x500",
-            display_manager()->GetDisplayAt(3).bounds().ToString());
-  EXPECT_EQ("0,-1100 1000x500",
-            display_manager()->GetDisplayAt(4).bounds().ToString());
+  EXPECT_EQ(gfx::Rect(0, 0, 1000, 500),
+            display_manager()->GetDisplayAt(0).bounds());
+  EXPECT_EQ(gfx::Rect(-250, -500, 500, 500),
+            display_manager()->GetDisplayAt(1).bounds());
+  EXPECT_EQ(gfx::Rect(250, -600, 600, 600),
+            display_manager()->GetDisplayAt(2).bounds());
+  EXPECT_EQ(gfx::Rect(850, -500, 500, 500),
+            display_manager()->GetDisplayAt(3).bounds());
+  EXPECT_EQ(gfx::Rect(0, -1100, 1000, 500),
+            display_manager()->GetDisplayAt(4).bounds());
+}
+
+TEST_P(DisplayManagerTest, NoOverlappedDisplaysWithDetachedDisplays) {
+  // Detached displays that intersect other non-detached displays.
+  //
+  //    +---------+---------+---------+
+  //    |    1    |    2    |    3    |
+  //    |         |         |         |
+  //    |         |         |         |
+  //    |         |         |         |
+  //    +----+----+-----+---+----+----+
+  //         |  4, 5    | P      |
+  //         | detached |        |
+  //         |          |        |
+  //         +----------+        |
+  //         +-------------------+
+  //
+
+  int64_t primary_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+  display::DisplayIdList list = display::test::CreateDisplayIdListN(
+      6, primary_id, primary_id + 1, primary_id + 2, primary_id + 3,
+      primary_id + 4, primary_id + 5);
+  display::DisplayLayoutBuilder builder(primary_id);
+  builder.AddDisplayPlacement(list[1], primary_id,
+                              display::DisplayPlacement::TOP, -250);
+  builder.AddDisplayPlacement(list[2], primary_id,
+                              display::DisplayPlacement::TOP, 250);
+  builder.AddDisplayPlacement(list[3], primary_id,
+                              display::DisplayPlacement::TOP, 750);
+  display_manager()->layout_store()->RegisterLayoutForDisplayIdList(
+      list, builder.Build());
+  UpdateDisplay("1000x500,500x500,500x500,500x500,500x400,500x400");
+
+  // Detached displays will be de-intersected and reparented appropriately.
+  //
+  //    +---------+---------+---------+
+  //    |    1    |    2    |    3    |
+  //    |         |         |         |
+  //    |         |         |         |
+  //    |         |         |         |
+  //    +----+----+---------+----+----+
+  //         |         P         |
+  //         |                   |
+  //         |                   |
+  //         |                   |
+  //         +----------+--------+
+  //         |     4    |
+  //         |          |
+  //         |          |
+  //         +----------+
+  //         |     5    |
+  //         |          |
+  //         |          |
+  //         +----------+
+  //
+
+  EXPECT_EQ(6U, display_manager()->GetNumDisplays());
+  EXPECT_EQ(gfx::Rect(0, 0, 1000, 500),
+            display_manager()->GetDisplayAt(0).bounds());
+  EXPECT_EQ(gfx::Rect(-250, -500, 500, 500),
+            display_manager()->GetDisplayAt(1).bounds());
+  EXPECT_EQ(gfx::Rect(250, -500, 500, 500),
+            display_manager()->GetDisplayAt(2).bounds());
+  EXPECT_EQ(gfx::Rect(750, -500, 500, 500),
+            display_manager()->GetDisplayAt(3).bounds());
+  EXPECT_EQ(gfx::Rect(0, 500, 500, 400),
+            display_manager()->GetDisplayAt(4).bounds());
+  EXPECT_EQ(gfx::Rect(0, 900, 500, 400),
+            display_manager()->GetDisplayAt(5).bounds());
+
+  // This case if not handled correctly might lead to a cyclic dependency.
+  // Make sure this doesn't happen.
+  display::DisplayLayoutBuilder expected_layout_builder(primary_id);
+  expected_layout_builder.AddDisplayPlacement(
+      list[1], primary_id, display::DisplayPlacement::TOP, -250);
+  expected_layout_builder.AddDisplayPlacement(
+      list[2], primary_id, display::DisplayPlacement::TOP, 250);
+  expected_layout_builder.AddDisplayPlacement(
+      list[3], primary_id, display::DisplayPlacement::TOP, 750);
+  expected_layout_builder.AddDisplayPlacement(
+      list[4], primary_id, display::DisplayPlacement::BOTTOM, 0);
+  expected_layout_builder.AddDisplayPlacement(
+      list[5], list[4], display::DisplayPlacement::BOTTOM, 0);
+
+  const display::DisplayLayout& layout =
+      display_manager()->GetCurrentResolvedDisplayLayout();
+  EXPECT_TRUE(layout.HasSamePlacementList(*(expected_layout_builder.Build())));
 }
 
 TEST_P(DisplayManagerTest, NoMirrorInThreeDisplays) {
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc
index bcf57726..1ca6846 100644
--- a/ash/mus/window_manager.cc
+++ b/ash/mus/window_manager.cc
@@ -41,6 +41,7 @@
 #include "services/ui/public/interfaces/window_manager.mojom.h"
 #include "ui/aura/client/window_parenting_client.h"
 #include "ui/aura/env.h"
+#include "ui/aura/mus/capture_synchronizer.h"
 #include "ui/aura/mus/property_converter.h"
 #include "ui/aura/mus/window_tree_client.h"
 #include "ui/aura/mus/window_tree_host_mus.h"
@@ -114,6 +115,13 @@
       std::move(frame_decoration_values));
 
   lookup_.reset(new WmLookupMus);
+
+  // Notify PointerWatcherEventRouter and CaptureSynchronizer that the capture
+  // client has been set.
+  aura::client::CaptureClient* capture_client = wm_state_->capture_controller();
+  pointer_watcher_event_router_->AttachToCaptureClient(capture_client);
+  window_tree_client_->capture_synchronizer()->AttachToCaptureClient(
+      capture_client);
 }
 
 void WindowManager::DeleteAllRootWindowControllers() {
@@ -238,6 +246,11 @@
   if (!window_tree_client_)
     return;
 
+  aura::client::CaptureClient* capture_client = wm_state_->capture_controller();
+  pointer_watcher_event_router_->DetachFromCaptureClient(capture_client);
+  window_tree_client_->capture_synchronizer()->DetachFromCaptureClient(
+      capture_client);
+
   Shell::DeleteInstance();
 
   lookup_.reset();
@@ -280,10 +293,6 @@
   pointer_watcher_event_router_->OnPointerEventObserved(event, target);
 }
 
-aura::client::CaptureClient* WindowManager::GetCaptureClient() {
-  return wm_state_->capture_controller();
-}
-
 aura::PropertyConverter* WindowManager::GetPropertyConverter() {
   return property_converter_.get();
 }
diff --git a/ash/mus/window_manager.h b/ash/mus/window_manager.h
index bd9b8b54..27dae0ee 100644
--- a/ash/mus/window_manager.h
+++ b/ash/mus/window_manager.h
@@ -132,7 +132,6 @@
   void OnLostConnection(aura::WindowTreeClient* client) override;
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override;
-  aura::client::CaptureClient* GetCaptureClient() override;
   aura::PropertyConverter* GetPropertyConverter() override;
 
   // WindowManagerDelegate:
diff --git a/ash/mus/window_manager_unittest.cc b/ash/mus/window_manager_unittest.cc
index 168bb4b..4c2c0cd 100644
--- a/ash/mus/window_manager_unittest.cc
+++ b/ash/mus/window_manager_unittest.cc
@@ -49,9 +49,6 @@
   void OnLostConnection(aura::WindowTreeClient* client) override {}
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override {}
-  aura::client::CaptureClient* GetCaptureClient() override {
-    return wm_state_.capture_controller();
-  }
   aura::PropertyConverter* GetPropertyConverter() override {
     return &property_converter_;
   }
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index 7585098..953c520f 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -66,6 +66,7 @@
 #include "ui/aura/client/drag_drop_client.h"
 #include "ui/aura/client/screen_position_client.h"
 #include "ui/aura/mus/window_mus.h"
+#include "ui/aura/mus/window_port_mus.h"
 #include "ui/aura/mus/window_tree_client.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
@@ -248,6 +249,11 @@
 WmWindow* CreateContainer(int window_id, const char* name, WmWindow* parent) {
   WmWindow* window = WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_UNKNOWN,
                                                ui::LAYER_NOT_DRAWN);
+  if (WmShell::Get()->IsRunningInMash()) {
+    aura::WindowPortMus::Get(window->aura_window())
+        ->SetEventTargetingPolicy(
+            ui::mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
+  }
   window->SetShellWindowId(window_id);
   window->SetName(name);
   parent->AddChild(window);
diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h
index 533b7dfd..296e40b 100644
--- a/base/task_scheduler/task_scheduler.h
+++ b/base/task_scheduler/task_scheduler.h
@@ -93,7 +93,9 @@
   virtual void FlushForTesting() = 0;
 
   // Joins all threads. Tasks that are already running are allowed to complete
-  // their execution. This can only be called once.
+  // their execution. This can only be called once. Using this task scheduler
+  // instance to create task runners or post tasks is not permitted during or
+  // after this call.
   virtual void JoinForTesting() = 0;
 
   // CreateAndSetSimpleTaskScheduler(), CreateAndSetDefaultTaskScheduler(), and
diff --git a/build/android/gyp/write_build_config.py b/build/android/gyp/write_build_config.py
index d636f31d..251df4e 100755
--- a/build/android/gyp/write_build_config.py
+++ b/build/android/gyp/write_build_config.py
@@ -50,25 +50,23 @@
     assert len(manifests) == 1
     self.manifest = manifests[0]
 
-  def GetInstrumentation(self):
+  def GetInstrumentationElements(self):
     instrumentation_els = self.manifest.getElementsByTagName('instrumentation')
     if len(instrumentation_els) == 0:
       return None
-    if len(instrumentation_els) != 1:
-      raise Exception(
-          'More than one <instrumentation> element found in %s' % self.path)
-    return instrumentation_els[0]
+    return instrumentation_els
 
-  def CheckInstrumentation(self, expected_package):
-    instr = self.GetInstrumentation()
-    if not instr:
+  def CheckInstrumentationElements(self, expected_package):
+    instrs = self.GetInstrumentationElements()
+    if not instrs:
       raise Exception('No <instrumentation> elements found in %s' % self.path)
-    instrumented_package = instr.getAttributeNS(
-        'http://schemas.android.com/apk/res/android', 'targetPackage')
-    if instrumented_package != expected_package:
-      raise Exception(
-          'Wrong instrumented package. Expected %s, got %s'
-          % (expected_package, instrumented_package))
+    for instr in instrs:
+      instrumented_package = instr.getAttributeNS(
+          'http://schemas.android.com/apk/res/android', 'targetPackage')
+      if instrumented_package != expected_package:
+        raise Exception(
+            'Wrong instrumented package. Expected %s, got %s'
+            % (expected_package, instrumented_package))
 
   def GetPackageName(self):
     return self.manifest.getAttribute('package')
@@ -578,7 +576,7 @@
     tested_apk_config = GetDepConfig(options.tested_apk_config)
 
     expected_tested_package = tested_apk_config['package_name']
-    AndroidManifest(options.android_manifest).CheckInstrumentation(
+    AndroidManifest(options.android_manifest).CheckInstrumentationElements(
         expected_tested_package)
     if options.proguard_enabled:
       # Add all tested classes to the test's classpath to ensure that the test's
@@ -653,9 +651,9 @@
     dependency_jars = [c['jar_path'] for c in all_library_deps]
     manifest = AndroidManifest(options.android_manifest)
     deps_info['package_name'] = manifest.GetPackageName()
-    if not options.tested_apk_config and manifest.GetInstrumentation():
+    if not options.tested_apk_config and manifest.GetInstrumentationElements():
       # This must then have instrumentation only for itself.
-      manifest.CheckInstrumentation(manifest.GetPackageName())
+      manifest.CheckInstrumentationElements(manifest.GetPackageName())
 
     library_paths = []
     java_libraries_list = None
diff --git a/build/android/lint/suppressions.xml b/build/android/lint/suppressions.xml
index 804aaa4..0066fe24 100644
--- a/build/android/lint/suppressions.xml
+++ b/build/android/lint/suppressions.xml
@@ -164,6 +164,8 @@
   <issue id="LongLogTag" severity="ignore"/>
   <issue id="MissingApplicationIcon" severity="ignore"/>
   <issue id="MissingPermission" severity="ignore"/>
+  <!-- TODO(yolandyan) remove this once all tests are converted to junit4 -->
+  <issue id="MissingPrefix" severity="ignore"/>
   <!--
     TODO(estevenson) remove this once translations are added for
     IDS_ACCESSIBILITY_TOOLBAR_BTN_TABSWITCHER_TOGGLE (http://crbug.com/635677)
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance.py b/build/android/pylib/instrumentation/instrumentation_test_instance.py
index ce28c44..2800b6f6 100644
--- a/build/android/pylib/instrumentation/instrumentation_test_instance.py
+++ b/build/android/pylib/instrumentation/instrumentation_test_instance.py
@@ -51,7 +51,7 @@
 _NATIVE_CRASH_RE = re.compile('(process|native) crash', re.IGNORECASE)
 _CMDLINE_NAME_SEGMENT_RE = re.compile(
     r' with(?:out)? \{[^\}]*\}')
-_PICKLE_FORMAT_VERSION = 10
+_PICKLE_FORMAT_VERSION = 11
 
 
 class MissingSizeAnnotationError(test_exception.TestException):
@@ -355,6 +355,7 @@
       'class': c['class'],
       'annotations': recursive_class_annotations(c),
       'methods': [m for m in c['methods'] if is_test_method(m)],
+      'superclass': c['superclass'],
     }
 
   return [stripped_test_class(c) for c in p['classes']
@@ -362,7 +363,7 @@
 
 
 def _GetTestsFromDexdump(test_apk):
-  d = dexdump.Dump(test_apk)
+  dump = dexdump.Dump(test_apk)
   tests = []
 
   def get_test_methods(methods):
@@ -374,13 +375,14 @@
           'annotations': {'MediumTest': None},
         } for m in methods if m.startswith('test')]
 
-  for package_name, package_info in d.iteritems():
+  for package_name, package_info in dump.iteritems():
     for class_name, class_info in package_info['classes'].iteritems():
       if class_name.endswith('Test'):
         tests.append({
             'class': '%s.%s' % (package_name, class_name),
             'annotations': {},
             'methods': get_test_methods(class_info['methods']),
+            'superclass': class_info['superclass'],
         })
   return tests
 
@@ -396,6 +398,14 @@
     pickle.dump(pickle_data, pickle_file)
 
 
+class MissingJUnit4RunnerException(test_exception.TestException):
+  """Raised when JUnit4 runner is not provided or specified in apk manifest"""
+
+  def __init__(self):
+    super(MissingJUnit4RunnerException, self).__init__(
+        'JUnit4 runner is not provided or specified in test apk manifest.')
+
+
 class UnmatchedFilterException(test_exception.TestException):
   """Raised when a user specifies a filter that doesn't match any tests."""
 
@@ -456,6 +466,7 @@
     self._test_jar = None
     self._test_package = None
     self._test_runner = None
+    self._test_runner_junit4 = None
     self._test_support_apk = None
     self._initializeApkAttributes(args, error_func)
 
@@ -549,7 +560,24 @@
       error_func('Unable to find test JAR: %s' % self._test_jar)
 
     self._test_package = self._test_apk.GetPackageName()
-    self._test_runner = self._test_apk.GetInstrumentationName()
+    all_instrumentations = self._test_apk.GetAllInstrumentations()
+    junit3_runners = [
+        x for x in all_instrumentations if ('true' not in x.get(
+            'chromium-junit4', ''))]
+    junit4_runners = [
+        x for x in all_instrumentations if ('true' in x.get(
+            'chromium-junit4', ''))]
+
+    if len(junit3_runners) > 1:
+      logging.warning('This test apk has more than one JUnit3 instrumentation')
+    if len(junit4_runners) > 1:
+      logging.warning('This test apk has more than one JUnit4 instrumentation')
+
+    self._test_runner = (
+      junit3_runners[0]['android:name'] if junit3_runners else
+      self.test_apk.GetInstrumentationName())
+    self._test_runner_junit4 = (
+      junit4_runners[0]['android:name'] if junit4_runners else None)
 
     self._package_info = None
     if self._apk_under_test:
@@ -724,6 +752,10 @@
     return self._test_runner
 
   @property
+  def test_runner_junit4(self):
+    return self._test_runner_junit4
+
+  @property
   def timeout_scale(self):
     return self._timeout_scale
 
@@ -745,6 +777,9 @@
     else:
       tests = GetAllTestsFromApk(self.test_apk.path)
     inflated_tests = self._ParametrizeTestsWithFlags(self._InflateTests(tests))
+    if self._test_runner_junit4 is None and any(
+        t['is_junit4'] for t in inflated_tests):
+      raise MissingJUnit4RunnerException()
     filtered_tests = FilterTests(
         inflated_tests, self._test_filter, self._annotations,
         self._excluded_annotations)
@@ -765,6 +800,7 @@
             'class': c['class'],
             'method': m['method'],
             'annotations': a,
+            'is_junit4': c['superclass'] == 'java.lang.Object'
         })
     return inflated_tests
 
diff --git a/build/android/pylib/instrumentation/instrumentation_test_instance_test.py b/build/android/pylib/instrumentation/instrumentation_test_instance_test.py
index 10fe95c..386f289 100755
--- a/build/android/pylib/instrumentation/instrumentation_test_instance_test.py
+++ b/build/android/pylib/instrumentation/instrumentation_test_instance_test.py
@@ -44,6 +44,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -58,6 +59,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -75,6 +77,7 @@
         },
         'class': 'org.chromium.test.SampleTest',
         'method': 'testMethod1',
+        'is_junit4': True,
       },
       {
         'annotations': {
@@ -83,6 +86,7 @@
         },
         'class': 'org.chromium.test.SampleTest',
         'method': 'testMethod2',
+        'is_junit4': True,
       },
       {
         'annotations': {
@@ -91,10 +95,12 @@
         },
         'class': 'org.chromium.test.SampleTest2',
         'method': 'testMethod1',
+        'is_junit4': True,
       },
     ]
 
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -107,6 +113,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -127,12 +134,14 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest',
+        'is_junit4': True,
         'method': 'testMethod1',
       },
     ]
 
     o._test_filter = 'org.chromium.test.SampleTest.testMethod1'
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -145,6 +154,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -159,6 +169,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -175,12 +186,14 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest2',
+        'is_junit4': True,
         'method': 'testMethod1',
       },
     ]
 
     o._test_filter = 'org.chromium.test.SampleTest2.*'
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -193,6 +206,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -207,6 +221,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -223,6 +238,7 @@
           'MediumTest': None,
         },
         'class': 'org.chromium.test.SampleTest',
+        'is_junit4': True,
         'method': 'testMethod2',
       },
       {
@@ -231,12 +247,14 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest2',
+        'is_junit4': True,
         'method': 'testMethod1',
       },
     ]
 
     o._test_filter = '*-org.chromium.test.SampleTest.testMethod1'
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -249,6 +267,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -263,6 +282,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -279,6 +299,7 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest',
+        'is_junit4': True,
         'method': 'testMethod1',
       },
       {
@@ -287,12 +308,14 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest2',
+        'is_junit4': True,
         'method': 'testMethod1',
       },
     ]
 
     o._annotations = [('SmallTest', None)]
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -305,6 +328,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'junit.framework.TestCase',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -319,6 +343,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'junit.framework.TestCase',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -335,12 +360,14 @@
           'MediumTest': None,
         },
         'class': 'org.chromium.test.SampleTest',
+        'is_junit4': False,
         'method': 'testMethod2',
       },
     ]
 
     o._excluded_annotations = [('SmallTest', None)]
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -353,6 +380,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'junit.framework.TestCase',
         'methods': [
           {
             'annotations': {
@@ -373,6 +401,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'junit.framework.TestCase',
         'methods': [
           {
             'annotations': {
@@ -393,12 +422,14 @@
           'TestValue': '1',
         },
         'class': 'org.chromium.test.SampleTest',
+        'is_junit4': False,
         'method': 'testMethod1',
       },
     ]
 
     o._annotations = [('TestValue', '1')]
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -411,6 +442,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -425,6 +457,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'java.lang.Object',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -441,12 +474,14 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest2',
+        'is_junit4': True,
         'method': 'testMethod1',
       },
     ]
 
     o._annotations = [('Feature', 'Bar')]
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
@@ -459,6 +494,7 @@
       {
         'annotations': {'Feature': {'value': ['Foo']}},
         'class': 'org.chromium.test.SampleTest',
+        'superclass': 'junit.framework.TestCase',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -476,6 +512,7 @@
       {
         'annotations': {'Feature': {'value': ['Bar']}},
         'class': 'org.chromium.test.SampleTest2',
+        'superclass': 'junit.framework.TestCase',
         'methods': [
           {
             'annotations': {'SmallTest': None},
@@ -492,6 +529,7 @@
           'MediumTest': None,
         },
         'class': 'org.chromium.test.SampleTest',
+        'is_junit4': False,
         'method': 'testMethod2',
       },
       {
@@ -500,12 +538,14 @@
           'SmallTest': None,
         },
         'class': 'org.chromium.test.SampleTest2',
+        'is_junit4': False,
         'method': 'testMethod1',
       },
     ]
 
     o._annotations = [('Feature', 'Bar'), ('Feature', 'Baz')]
     o._test_jar = 'path/to/test.jar'
+    o._test_runner_junit4 = 'J4Runner'
     with mock.patch(_INSTRUMENTATION_TEST_INSTANCE_PATH % '_GetTestsFromPickle',
                     return_value=raw_tests):
       actual_tests = o.GetTests()
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
index 645b128..2201657 100644
--- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py
+++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -204,6 +204,8 @@
       if not self._test_instance.driver_apk:
         raise Exception('driver_apk does not exist. '
                         'Please build it and try again.')
+      if any(t.get('is_junit4') for t in test):
+        raise Exception('driver apk does not support JUnit4 tests')
 
       def name_and_timeout(t):
         n = instrumentation_test_instance.GetTestName(t)
@@ -224,8 +226,13 @@
     else:
       test_name = instrumentation_test_instance.GetTestName(test)
       test_display_name = self._GetUniqueTestName(test)
-      target = '%s/%s' % (
-          self._test_instance.test_package, self._test_instance.test_runner)
+      if test['is_junit4']:
+        target = '%s/%s' % (
+            self._test_instance.test_package,
+            self._test_instance.test_runner_junit4)
+      else:
+        target = '%s/%s' % (
+            self._test_instance.test_package, self._test_instance.test_runner)
       extras['class'] = test_name
       if 'flags' in test:
         flags = test['flags']
diff --git a/build/android/pylib/utils/dexdump.py b/build/android/pylib/utils/dexdump.py
index 972a22d49..2bb11ce 100644
--- a/build/android/pylib/utils/dexdump.py
+++ b/build/android/pylib/utils/dexdump.py
@@ -67,7 +67,12 @@
   results = {}
   for child in root:
     if child.tag == 'package':
-      results[child.attrib['name']] = _ParsePackageNode(child)
+      package_name = child.attrib['name']
+      parsed_node = _ParsePackageNode(child)
+      if package_name in results:
+        results[package_name]['classes'].update(parsed_node['classes'])
+      else:
+        results[package_name] = parsed_node
   return results
 
 
@@ -107,4 +112,4 @@
   for child in class_node:
     if child.tag == 'method':
       methods.append(child.attrib['name'])
-  return {'methods': methods}
+  return {'methods': methods, 'superclass': class_node.attrib['extends']}
diff --git a/build/android/pylib/utils/dexdump_test.py b/build/android/pylib/utils/dexdump_test.py
index b8b7964..6b2c4542 100755
--- a/build/android/pylib/utils/dexdump_test.py
+++ b/build/android/pylib/utils/dexdump_test.py
@@ -78,9 +78,11 @@
         'classes': {
           'Class1': {
             'methods': ['class1Method1', 'class1Method2'],
+            'superclass': 'java.lang.Object',
           },
           'Class2': {
             'methods': ['class2Method1'],
+            'superclass': 'java.lang.Object',
           }
         },
       },
@@ -92,9 +94,9 @@
   def testParsePackageNode(self):
     example_xml_string = (
         '<package name="com.foo.bar">'
-        '<class name="Class1">'
+        '<class name="Class1" extends="java.lang.Object">'
         '</class>'
-        '<class name="Class2">'
+        '<class name="Class2" extends="java.lang.Object">'
         '</class>'
         '</package>')
 
@@ -106,9 +108,11 @@
       'classes': {
         'Class1': {
           'methods': [],
+          'superclass': 'java.lang.Object',
         },
         'Class2': {
           'methods': [],
+          'superclass': 'java.lang.Object',
         },
       },
     }
@@ -116,7 +120,7 @@
 
   def testParseClassNode(self):
     example_xml_string = (
-        '<class name="Class1">'
+        '<class name="Class1" extends="java.lang.Object">'
         '<method name="method1">'
         '</method>'
         '<method name="method2">'
@@ -128,6 +132,7 @@
 
     expected = {
       'methods': ['method1', 'method2'],
+      'superclass': 'java.lang.Object',
     }
     self.assertEquals(expected, actual)
 
diff --git a/build/config/sanitizers/OWNERS b/build/config/sanitizers/OWNERS
new file mode 100644
index 0000000..4116061
--- /dev/null
+++ b/build/config/sanitizers/OWNERS
@@ -0,0 +1 @@
+ochang@chromium.org
diff --git a/cc/BUILD.gn b/cc/BUILD.gn
index e611f47..d4c84029 100644
--- a/cc/BUILD.gn
+++ b/cc/BUILD.gn
@@ -263,6 +263,7 @@
     "playback/float_clip_display_item.h",
     "playback/image_hijack_canvas.cc",
     "playback/image_hijack_canvas.h",
+    "playback/image_id.h",
     "playback/largest_display_item.cc",
     "playback/largest_display_item.h",
     "playback/raster_source.cc",
diff --git a/cc/playback/discardable_image_map.cc b/cc/playback/discardable_image_map.cc
index 29201d6f..7e1abd6 100644
--- a/cc/playback/discardable_image_map.cc
+++ b/cc/playback/discardable_image_map.cc
@@ -62,9 +62,11 @@
   DiscardableImagesMetadataCanvas(
       int width,
       int height,
-      std::vector<std::pair<DrawImage, gfx::Rect>>* image_set)
+      std::vector<std::pair<DrawImage, gfx::Rect>>* image_set,
+      std::unordered_map<ImageId, gfx::Rect>* image_id_to_rect)
       : SkNWayCanvas(width, height),
         image_set_(image_set),
+        image_id_to_rect_(image_id_to_rect),
         canvas_bounds_(SkRect::MakeIWH(width, height)),
         canvas_size_(width, height) {}
 
@@ -198,9 +200,12 @@
 
     SkIRect src_irect;
     src_rect.roundOut(&src_irect);
+    gfx::Rect image_rect = SafeClampPaintRectToSize(paint_rect, canvas_size_);
+
+    (*image_id_to_rect_)[image->uniqueID()].Union(image_rect);
     image_set_->push_back(std::make_pair(
         DrawImage(std::move(image), src_irect, filter_quality, matrix),
-        SafeClampPaintRectToSize(paint_rect, canvas_size_)));
+        image_rect));
   }
 
   // Currently this function only handles extracting images from SkImageShaders
@@ -224,6 +229,7 @@
   }
 
   std::vector<std::pair<DrawImage, gfx::Rect>>* image_set_;
+  std::unordered_map<ImageId, gfx::Rect>* image_id_to_rect_;
   const SkRect canvas_bounds_;
   const gfx::Size canvas_size_;
   std::vector<SkPaint> saved_paints_;
@@ -239,7 +245,7 @@
     const gfx::Size& bounds) {
   DCHECK(all_images_.empty());
   return base::MakeUnique<DiscardableImagesMetadataCanvas>(
-      bounds.width(), bounds.height(), &all_images_);
+      bounds.width(), bounds.height(), &all_images_, &image_id_to_rect_);
 }
 
 void DiscardableImageMap::EndGeneratingMetadata() {
@@ -259,6 +265,11 @@
     images->push_back(all_images_[index].first.ApplyScale(contents_scale));
 }
 
+gfx::Rect DiscardableImageMap::GetRectForImage(ImageId image_id) const {
+  const auto& it = image_id_to_rect_.find(image_id);
+  return it == image_id_to_rect_.end() ? gfx::Rect() : it->second;
+}
+
 DiscardableImageMap::ScopedMetadataGenerator::ScopedMetadataGenerator(
     DiscardableImageMap* image_map,
     const gfx::Size& bounds)
diff --git a/cc/playback/discardable_image_map.h b/cc/playback/discardable_image_map.h
index b521fff..abbf08bc 100644
--- a/cc/playback/discardable_image_map.h
+++ b/cc/playback/discardable_image_map.h
@@ -5,12 +5,14 @@
 #ifndef CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_
 #define CC_PLAYBACK_DISCARDABLE_IMAGE_MAP_H_
 
+#include <unordered_map>
 #include <utility>
 #include <vector>
 
 #include "cc/base/cc_export.h"
 #include "cc/base/rtree.h"
 #include "cc/playback/draw_image.h"
+#include "cc/playback/image_id.h"
 #include "third_party/skia/include/core/SkCanvas.h"
 #include "third_party/skia/include/core/SkRefCnt.h"
 #include "ui/gfx/geometry/rect.h"
@@ -46,6 +48,7 @@
   void GetDiscardableImagesInRect(const gfx::Rect& rect,
                                   float contents_scale,
                                   std::vector<DrawImage>* images) const;
+  gfx::Rect GetRectForImage(ImageId image_id) const;
 
  private:
   friend class ScopedMetadataGenerator;
@@ -55,6 +58,8 @@
   void EndGeneratingMetadata();
 
   std::vector<std::pair<DrawImage, gfx::Rect>> all_images_;
+  std::unordered_map<ImageId, gfx::Rect> image_id_to_rect_;
+
   RTree images_rtree_;
 };
 
diff --git a/cc/playback/discardable_image_map_unittest.cc b/cc/playback/discardable_image_map_unittest.cc
index e56f158..926d8aea 100644
--- a/cc/playback/discardable_image_map_unittest.cc
+++ b/cc/playback/discardable_image_map_unittest.cc
@@ -111,6 +111,8 @@
                                                                 << y;
         EXPECT_EQ(gfx::Rect(x * 512 + 6, y * 512 + 6, 500, 500),
                   images[0].image_rect);
+        EXPECT_EQ(images[0].image_rect,
+                  image_map.GetRectForImage(images[0].image->uniqueID()));
       } else {
         EXPECT_EQ(0u, images.size()) << x << " " << y;
       }
@@ -121,16 +123,28 @@
   std::vector<PositionScaleDrawImage> images =
       GetDiscardableImagesInRect(image_map, gfx::Rect(512, 512, 2048, 2048));
   EXPECT_EQ(4u, images.size());
+
   EXPECT_TRUE(images[0].image == discardable_image[1][2]);
   EXPECT_EQ(gfx::Rect(2 * 512 + 6, 512 + 6, 500, 500), images[0].image_rect);
+  EXPECT_EQ(images[0].image_rect,
+            image_map.GetRectForImage(images[0].image->uniqueID()));
+
   EXPECT_TRUE(images[1].image == discardable_image[2][1]);
   EXPECT_EQ(gfx::Rect(512 + 6, 2 * 512 + 6, 500, 500), images[1].image_rect);
+  EXPECT_EQ(images[1].image_rect,
+            image_map.GetRectForImage(images[1].image->uniqueID()));
+
   EXPECT_TRUE(images[2].image == discardable_image[2][3]);
   EXPECT_EQ(gfx::Rect(3 * 512 + 6, 2 * 512 + 6, 500, 500),
             images[2].image_rect);
+  EXPECT_EQ(images[2].image_rect,
+            image_map.GetRectForImage(images[2].image->uniqueID()));
+
   EXPECT_TRUE(images[3].image == discardable_image[3][2]);
   EXPECT_EQ(gfx::Rect(2 * 512 + 6, 3 * 512 + 6, 500, 500),
             images[3].image_rect);
+  EXPECT_EQ(images[3].image_rect,
+            image_map.GetRectForImage(images[3].image->uniqueID()));
 }
 
 TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectNonZeroLayer) {
@@ -184,6 +198,8 @@
                                                                 << y;
         EXPECT_EQ(gfx::Rect(1024 + x * 512 + 6, y * 512 + 6, 500, 500),
                   images[0].image_rect);
+        EXPECT_EQ(images[0].image_rect,
+                  image_map.GetRectForImage(images[0].image->uniqueID()));
       } else {
         EXPECT_EQ(0u, images.size()) << x << " " << y;
       }
@@ -194,18 +210,30 @@
     std::vector<PositionScaleDrawImage> images = GetDiscardableImagesInRect(
         image_map, gfx::Rect(1024 + 512, 512, 2048, 2048));
     EXPECT_EQ(4u, images.size());
+
     EXPECT_TRUE(images[0].image == discardable_image[1][2]);
     EXPECT_EQ(gfx::Rect(1024 + 2 * 512 + 6, 512 + 6, 500, 500),
               images[0].image_rect);
+    EXPECT_EQ(images[0].image_rect,
+              image_map.GetRectForImage(images[0].image->uniqueID()));
+
     EXPECT_TRUE(images[1].image == discardable_image[2][1]);
     EXPECT_EQ(gfx::Rect(1024 + 512 + 6, 2 * 512 + 6, 500, 500),
               images[1].image_rect);
+    EXPECT_EQ(images[1].image_rect,
+              image_map.GetRectForImage(images[1].image->uniqueID()));
+
     EXPECT_TRUE(images[2].image == discardable_image[2][3]);
     EXPECT_EQ(gfx::Rect(1024 + 3 * 512 + 6, 2 * 512 + 6, 500, 500),
               images[2].image_rect);
+    EXPECT_EQ(images[2].image_rect,
+              image_map.GetRectForImage(images[2].image->uniqueID()));
+
     EXPECT_TRUE(images[3].image == discardable_image[3][2]);
     EXPECT_EQ(gfx::Rect(1024 + 2 * 512 + 6, 3 * 512 + 6, 500, 500),
               images[3].image_rect);
+    EXPECT_EQ(images[3].image_rect,
+              image_map.GetRectForImage(images[3].image->uniqueID()));
   }
 
   // Non intersecting rects
@@ -229,6 +257,12 @@
         image_map, gfx::Rect(3500, 1100, 1000, 1000));
     EXPECT_EQ(0u, images.size());
   }
+
+  // Image not present in the list.
+  {
+    sk_sp<SkImage> image = CreateDiscardableImage(gfx::Size(500, 500));
+    EXPECT_EQ(gfx::Rect(), image_map.GetRectForImage(image->uniqueID()));
+  }
 }
 
 TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectOnePixelQuery) {
@@ -280,6 +314,8 @@
                                                                 << y;
         EXPECT_EQ(gfx::Rect(x * 512 + 6, y * 512 + 6, 500, 500),
                   images[0].image_rect);
+        EXPECT_EQ(images[0].image_rect,
+                  image_map.GetRectForImage(images[0].image->uniqueID()));
       } else {
         EXPECT_EQ(0u, images.size()) << x << " " << y;
       }
@@ -313,6 +349,8 @@
   EXPECT_EQ(1u, images.size());
   EXPECT_TRUE(images[0].image == discardable_image);
   EXPECT_EQ(gfx::Rect(0, 0, 2048, 2048), images[0].image_rect);
+  EXPECT_EQ(images[0].image_rect,
+            image_map.GetRectForImage(images[0].image->uniqueID()));
 }
 
 TEST_F(DiscardableImageMapTest, PaintDestroyedWhileImageIsDrawn) {
@@ -368,6 +406,8 @@
   EXPECT_EQ(1u, images.size());
   EXPECT_TRUE(images[0].image == discardable_image);
   EXPECT_EQ(gfx::Rect(42, 42, 2006, 2006), images[0].image_rect);
+  EXPECT_EQ(images[0].image_rect,
+            image_map.GetRectForImage(images[0].image->uniqueID()));
 }
 
 TEST_F(DiscardableImageMapTest, GetDiscardableImagesInRectMaxImageMaxLayer) {
@@ -423,6 +463,9 @@
   EXPECT_EQ(gfx::Rect(0, 500, expected10k, dimension - 500),
             images[1].image_rect);
   EXPECT_EQ(gfx::Rect(0, 0, dimension, dimension), images[0].image_rect);
+
+  EXPECT_EQ(gfx::Rect(0, 0, dimension, dimension),
+            image_map.GetRectForImage(discardable_image->uniqueID()));
 }
 
 TEST_F(DiscardableImageMapTest, GetDiscardableImagesRectInBounds) {
@@ -465,6 +508,15 @@
   images = GetDiscardableImagesInRect(image_map, gfx::Rect(0, 500, 1, 1));
   EXPECT_EQ(1u, images.size());
   EXPECT_EQ(gfx::Rect(0, 500, 1000, 100), images[0].image_rect);
+
+  gfx::Rect discardable_image_rect;
+  discardable_image_rect.Union(gfx::Rect(0, 0, 90, 89));
+  discardable_image_rect.Union(gfx::Rect(950, 951, 50, 49));
+  EXPECT_EQ(discardable_image_rect,
+            image_map.GetRectForImage(discardable_image->uniqueID()));
+
+  EXPECT_EQ(gfx::Rect(0, 500, 1000, 100),
+            image_map.GetRectForImage(long_discardable_image->uniqueID()));
 }
 
 TEST_F(DiscardableImageMapTest, GetDiscardableImagesInShader) {
diff --git a/cc/playback/display_item_list.cc b/cc/playback/display_item_list.cc
index 69ed70df..722d6230 100644
--- a/cc/playback/display_item_list.cc
+++ b/cc/playback/display_item_list.cc
@@ -262,4 +262,8 @@
   image_map_.GetDiscardableImagesInRect(rect, contents_scale, images);
 }
 
+gfx::Rect DisplayItemList::GetRectForImage(ImageId image_id) const {
+  return image_map_.GetRectForImage(image_id);
+}
+
 }  // namespace cc
diff --git a/cc/playback/display_item_list.h b/cc/playback/display_item_list.h
index fcfccd9f..d2b194c 100644
--- a/cc/playback/display_item_list.h
+++ b/cc/playback/display_item_list.h
@@ -19,6 +19,7 @@
 #include "cc/base/rtree.h"
 #include "cc/playback/discardable_image_map.h"
 #include "cc/playback/display_item.h"
+#include "cc/playback/image_id.h"
 #include "third_party/skia/include/core/SkPicture.h"
 #include "ui/gfx/color_space.h"
 #include "ui/gfx/geometry/rect.h"
@@ -149,6 +150,7 @@
   void GetDiscardableImagesInRect(const gfx::Rect& rect,
                                   float contents_scale,
                                   std::vector<DrawImage>* images);
+  gfx::Rect GetRectForImage(ImageId image_id) const;
 
   void SetRetainVisualRectsForTesting(bool retain) {
     retain_visual_rects_ = retain;
diff --git a/cc/playback/image_id.h b/cc/playback/image_id.h
new file mode 100644
index 0000000..c29810b
--- /dev/null
+++ b/cc/playback/image_id.h
@@ -0,0 +1,14 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_PLAYBACK_IMAGE_ID_H_
+#define CC_PLAYBACK_IMAGE_ID_H_
+
+namespace cc {
+
+using ImageId = uint32_t;
+
+}  // namespace cc
+
+#endif  // CC_PLAYBACK_IMAGE_ID_H_
diff --git a/cc/playback/raster_source.cc b/cc/playback/raster_source.cc
index e108be3..06b6788 100644
--- a/cc/playback/raster_source.cc
+++ b/cc/playback/raster_source.cc
@@ -247,6 +247,10 @@
   display_list_->GetDiscardableImagesInRect(layer_rect, contents_scale, images);
 }
 
+gfx::Rect RasterSource::GetRectForImage(ImageId image_id) const {
+  return display_list_->GetRectForImage(image_id);
+}
+
 bool RasterSource::CoversRect(const gfx::Rect& layer_rect) const {
   if (size_.IsEmpty())
     return false;
diff --git a/cc/playback/raster_source.h b/cc/playback/raster_source.h
index 471f7ba..29ca3889 100644
--- a/cc/playback/raster_source.h
+++ b/cc/playback/raster_source.h
@@ -13,6 +13,7 @@
 #include "base/macros.h"
 #include "cc/base/cc_export.h"
 #include "cc/debug/rendering_stats_instrumentation.h"
+#include "cc/playback/image_id.h"
 #include "cc/playback/recording_source.h"
 #include "skia/ext/analysis_canvas.h"
 #include "third_party/skia/include/core/SkPicture.h"
@@ -107,6 +108,8 @@
   // Valid rectangle in which everything is recorded and can be rastered from.
   virtual gfx::Rect RecordedViewport() const;
 
+  gfx::Rect GetRectForImage(ImageId image_id) const;
+
   // Tracing functionality.
   virtual void DidBeginTracing();
   virtual void AsValueInto(base::trace_event::TracedValue* array) const;
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index 0ecc9f76..4fe0d58 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -1344,6 +1344,7 @@
     "//chrome/browser/resources:options_resources",
     "//chrome/browser/resources:password_manager_internals_resources",
     "//chrome/browser/resources:policy_resources",
+    "//chrome/browser/resources:quota_internals_resources",
     "//chrome/browser/resources:settings_resources",
     "//chrome/browser/resources:task_scheduler_internals_resources",
     "//chrome/browser/resources:translate_internals_resources",
@@ -1355,10 +1356,8 @@
   }
 
   if (enable_extensions) {
-    public_deps += [
-      "//chrome/browser/resources:quota_internals_resources",
-      "//chrome/browser/resources:sync_file_system_internals_resources",
-    ]
+    public_deps +=
+        [ "//chrome/browser/resources:sync_file_system_internals_resources" ]
   }
 }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
index d3449c2..f7d8794d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -76,6 +76,7 @@
     protected static final String PENDING_OMA_DOWNLOADS = "PendingOMADownloads";
     private static final String UNKNOWN_MIME_TYPE = "application/unknown";
     private static final String DOWNLOAD_UMA_ENTRY = "DownloadUmaEntry";
+    private static final String DOWNLOAD_RETRY_COUNT_FILE_NAME = "DownloadRetryCount";
     private static final long UPDATE_DELAY_MILLIS = 1000;
     // Wait 10 seconds to resume all downloads, so that we won't impact tab loading.
     private static final long RESUME_DELAY_MILLIS = 10000;
@@ -132,6 +133,7 @@
     private NetworkChangeNotifierAutoDetect mNetworkChangeNotifier;
     // Flag to track if we need to post a task to update download notifications.
     private boolean mIsUIUpdateScheduled;
+    private int mAutoResumptionLimit = -1;
 
     /**
      * Class representing progress of a download.
@@ -287,6 +289,13 @@
         }
     }
 
+    /**
+     * Pre-load shared prefs to avoid being blocked on the disk access async task in the future.
+     */
+    public static void warmUpSharedPrefs(Context context) {
+        getAutoRetryCountSharedPreference(context);
+    }
+
     public DownloadNotifier getDownloadNotifier() {
         return mDownloadNotifier;
     }
@@ -751,6 +760,7 @@
             case DOWNLOAD_STATUS_CANCELLED:
                 recordDownloadFinishedUMA(downloadStatus, downloadItem.getId(),
                         downloadItem.getDownloadInfo().getBytesReceived());
+                clearDownloadRetryCount(downloadItem.getId());
                 break;
             case DOWNLOAD_STATUS_INTERRUPTED:
                 entry = getUmaStatsEntry(downloadItem.getId());
@@ -1106,11 +1116,6 @@
         }
     }
 
-    /**
-     * Called to resume a paused download.
-     * @param item Download item to resume.
-     * @param hasUserGesture Whether the resumption is triggered by user gesture.
-     */
     @Override
     public void resumeDownload(DownloadItem item, boolean hasUserGesture) {
         DownloadProgress progress = mDownloadProgressMap.get(item.getId());
@@ -1136,6 +1141,14 @@
             if (!progress.mCanDownloadWhileMetered) {
                 progress.mCanDownloadWhileMetered = isActiveNetworkMetered(mContext);
             }
+            clearDownloadRetryCount(item.getId());
+        } else {
+            int count = incrementAndReturnDownloadRetryCount(item.getId());
+            if (count > getAutoResumptionLimit()) {
+                removeAutoResumableDownload(item.getId());
+                onDownloadInterrupted(item.getDownloadInfo(), false);
+                return;
+            }
         }
         nativeResumeDownload(getNativeDownloadManagerService(), item.getId(),
                 item.getDownloadInfo().isOffTheRecord());
@@ -1676,6 +1689,49 @@
         }
     }
 
+    /**
+     * Returns the SharedPreferences for download retry count.
+     * @return The SharedPreferences to use.
+     */
+    private static SharedPreferences getAutoRetryCountSharedPreference(Context context) {
+        return context.getSharedPreferences(DOWNLOAD_RETRY_COUNT_FILE_NAME, Context.MODE_PRIVATE);
+    }
+
+    /**
+     * Increments the interruption count for a download. If the interruption count reaches a certain
+     * threshold, the download will no longer auto resume unless user click the resume button
+     * to clear the count.
+     * @param downloadGuid Download GUID.
+     * @return The interruption count of the download, after incrementation.
+     */
+    private int incrementAndReturnDownloadRetryCount(String downloadGuid) {
+        SharedPreferences sharedPrefs = getAutoRetryCountSharedPreference(mContext);
+        int count = sharedPrefs.getInt(downloadGuid, 0);
+        count++;
+        SharedPreferences.Editor editor = sharedPrefs.edit();
+        editor.putInt(downloadGuid, count);
+        editor.apply();
+        return count;
+    }
+
+    /**
+     * clears the interruption count for a download.
+     * @param downloadGuid Download GUID.
+     */
+    private void clearDownloadRetryCount(String downloadGuid) {
+        SharedPreferences sharedPrefs = getAutoRetryCountSharedPreference(mContext);
+        SharedPreferences.Editor editor = sharedPrefs.edit();
+        editor.remove(downloadGuid);
+        editor.apply();
+    }
+
+    int getAutoResumptionLimit() {
+        if (mAutoResumptionLimit < 0) {
+            mAutoResumptionLimit = nativeGetAutoResumptionLimit();
+        }
+        return mAutoResumptionLimit;
+    }
+
     @Override
     public void onMaxBandwidthChanged(double maxBandwidthMbps) {}
 
@@ -1692,6 +1748,7 @@
     public void purgeActiveNetworkList(long[] activeNetIds) {}
 
     private static native boolean nativeIsSupportedMimeType(String mimeType);
+    private static native int nativeGetAutoResumptionLimit();
 
     private native long nativeInit();
     private native void nativeResumeDownload(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
index f1a96ad..963f68f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -37,6 +37,7 @@
 import org.chromium.chrome.browser.FileProviderHelper;
 import org.chromium.chrome.browser.crash.MinidumpDirectoryObserver;
 import org.chromium.chrome.browser.device.DeviceClassManager;
+import org.chromium.chrome.browser.download.DownloadManagerService;
 import org.chromium.chrome.browser.services.GoogleServicesManager;
 import org.chromium.chrome.browser.tabmodel.document.DocumentTabModelImpl;
 import org.chromium.chrome.browser.webapps.ActivityAssigner;
@@ -169,6 +170,7 @@
                     ContextUtils.getAppSharedPreferences();
                     DocumentTabModelImpl.warmUpSharedPrefs(mApplication);
                     ActivityAssigner.warmUpSharedPrefs(mApplication);
+                    DownloadManagerService.warmUpSharedPrefs(mApplication);
                     return null;
                 }
             }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@@ -176,6 +178,7 @@
             ContextUtils.getAppSharedPreferences();
             DocumentTabModelImpl.warmUpSharedPrefs(mApplication);
             ActivityAssigner.warmUpSharedPrefs(mApplication);
+            DownloadManagerService.warmUpSharedPrefs(mApplication);
         }
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
index 5006857..537b8695 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/LocationBarPhone.java
@@ -214,7 +214,9 @@
             //     by a command line intent)
             // 3.) Simultaneously moving one of the selection handles left and right.  This will
             //     occasionally throw an AssertionError on the bounds of the selection.
-            Selection.setSelection(mUrlBar.getText(), 0);
+            if (!mUrlBar.scrollToTLD()) {
+                Selection.setSelection(mUrlBar.getText(), 0);
+            }
 
             // The animation rendering may not yet be 100% complete and hiding the keyboard makes
             // the animation quite choppy.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
index 4130191..696693b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
@@ -845,21 +845,18 @@
         mAccessibilityTextOverride = accessibilityOverride;
     }
 
-    private void scrollToTLD() {
+    /**
+     * Scroll to ensure the TLD is visible.
+     * @return Whether the TLD was discovered and successfully scrolled to.
+     */
+    public boolean scrollToTLD() {
         Editable url = getText();
-        if (url == null || url.length() < 1) return;
+        if (url == null || url.length() < 1) return false;
         String urlString = url.toString();
-        URL javaUrl;
-        try {
-            javaUrl = new URL(urlString);
-        } catch (MalformedURLException mue) {
-            return;
-        }
-        String host = javaUrl.getHost();
-        if (host == null || host.isEmpty()) return;
-        int hostStart = urlString.indexOf(host);
-        int hostEnd = hostStart + host.length();
-        setSelection(hostEnd);
+        String prePath = LocationBarLayout.splitPathFromUrlDisplayText(urlString).first;
+        if (prePath == null || prePath.isEmpty()) return false;
+        setSelection(prePath.length());
+        return true;
     }
 
     @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index acead93..57a2da59 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -439,9 +439,6 @@
             mRequestedWebVR = false;
         }
 
-        // TODO(bshe): Ideally, we do not need two gvr context exist at the same time. We can
-        // probably shutdown non presenting gvr when presenting and create a new one after exit
-        // presenting. See crbug.com/655242
         StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
         try {
             nativeOnResume(mNativeVrShellDelegate);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
index e32b4bb..f61883f8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/BottomSheet.java
@@ -21,6 +21,7 @@
 import android.view.animation.Interpolator;
 import android.widget.FrameLayout;
 
+import org.chromium.base.ApiCompatibilityUtils;
 import org.chromium.chrome.R;
 import org.chromium.chrome.browser.suggestions.SuggestionsBottomSheetContent;
 import org.chromium.chrome.browser.tabmodel.TabModelSelector;
@@ -113,6 +114,9 @@
     /** A handle to the toolbar control container. */
     private View mControlContainer;
 
+    /** A placeholder for if there is no content in the bottom sheet. */
+    private View mPlaceholder;
+
     /** A handle to the FrameLayout that holds the content of the bottom sheet. */
     private FrameLayout mBottomSheetContentContainer;
 
@@ -342,6 +346,13 @@
                 setSheetState(mCurrentState, false);
             }
         });
+
+        mPlaceholder = new View(getContext());
+        LayoutParams placeHolderParams =
+                new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+        mPlaceholder.setBackgroundColor(
+                ApiCompatibilityUtils.getColor(getResources(), android.R.color.white));
+        mBottomSheetContentContainer.addView(mPlaceholder, placeHolderParams);
     }
 
     /**
@@ -384,8 +395,12 @@
             mSheetContent = null;
         }
 
-        if (content == null) return;
+        if (content == null) {
+            mBottomSheetContentContainer.addView(mPlaceholder);
+            return;
+        }
 
+        mBottomSheetContentContainer.removeView(mPlaceholder);
         mSheetContent = content;
         mBottomSheetContentContainer.addView(mSheetContent.getScrollingContentView());
     }
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
index e0a921bf..529b73e 100644
--- a/chrome/android/java/strings/android_chrome_strings.grd
+++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -743,10 +743,10 @@
       <message name="IDS_WEBSITE_SETTINGS_PERMISSIONS_ALLOW_DSE_ADDRESS_BAR" desc="Summary text explaining that Chrome will allow the default search engine to access the user's location, but only when the user searches directly from the address bar. e.g. Location access: Allow (for address bar searches)">
         Allow (for address bar searches)
       </message>
-      <message name="IDS_WEBSITE_SETTINGS_PERMISSIONS_ALLOW_DSE" desc="Summary text explaining that Chrome will allow the default search engine to access the user's location, both when performed from the address bar and from Google search result pages. e.g. Location access: Allow for Google searches">
+      <message name="IDS_WEBSITE_SETTINGS_PERMISSIONS_ALLOW_DSE" desc="Summary text explaining that Chrome will allow the default search engine to access the user's location, both when performed from the address bar and from search result pages. e.g. Location access: Allow for current search engine">
         Allow for current search engine
       </message>
-      <message name="IDS_WEBSITE_SETTINGS_PERMISSIONS_BLOCK_DSE" desc="Summary text explaining that Chrome will allow the default search engine to access the user's location, both when performed from the address bar and from Google search result pages. e.g. Location access: Allow for Google searches">
+      <message name="IDS_WEBSITE_SETTINGS_PERMISSIONS_BLOCK_DSE" desc="Summary text explaining that Chrome will block the default search engine from accessing the user's location, both when performed from the address bar and from search result pages. e.g. Location access: Block for current search engine">
         Block for current search engine
       </message>
       <message name="IDS_WEBSITE_RESET" desc="The label for the button allowing users to clear all data and reset the permissions for a website.">
diff --git a/chrome/app/DEPS b/chrome/app/DEPS
index 417fa0e..cab9bd2 100644
--- a/chrome/app/DEPS
+++ b/chrome/app/DEPS
@@ -34,7 +34,5 @@
   "+remoting/client/plugin",
   "+sandbox",
   "+services/service_manager/runner/common/client_util.h",
-  "+syzygy/kasko/api",
   "+third_party/crashpad/crashpad",
-  "+third_party/kasko",
 ]
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index ccf4d0a4..9cfc2acd 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7498,9 +7498,6 @@
       <message name="IDS_ACCNAME_ZOOM" desc="The accessible name for the zoom button.">
         Zoom
       </message>
-      <message name="IDS_ACCNAME_OPEN_PDF_IN_READER" desc="The accessible name for the Open PDF in Reader button.">
-        Open PDF in Reader
-      </message>
       <message name="IDS_ACCNAME_FIND" desc="The accessible name for the find button.">
         Find
       </message>
@@ -12850,54 +12847,6 @@
         Ignore
       </message>
 
-      <!-- PDF reader related strings. Not used on Android -->
-      <if expr="not is_android">
-        <!-- PDF with unsupported feature bubble -->
-        <message name="IDS_PDF_BUBBLE_MESSAGE" desc="Message for the bubble when a user views a PDF with an unsupported feature">
-          Parts of this PDF document could not be displayed.
-        </message>
-        <message name="IDS_PDF_BUBBLE_OPEN_IN_READER_LINK" desc="Title of the link to open a PDF with an unsupported feature in Adobe Reader">
-          Open in Adobe Reader
-        </message>
-        <message name="IDS_PDF_BUBBLE_INSTALL_READER_LINK" desc="Title of the link to open a PDF with an unsupported feature in Adobe Reader">
-          Install Adobe Reader
-        </message>
-        <if expr="is_win">
-          <message name="IDS_PDF_BUBBLE_METRO_MODE_LINK" desc="Title of the link to restart Chrome on Windows 8 in metro mode when viewing a PDF with an unsupported feature.">
-            Relaunch Chrome on the desktop
-          </message>
-        </if>
-        <message name="IDS_PDF_INFOBAR_QUESTION_ALWAYS_USE_READER" desc="Question asked on the info bar when a user opens a PDF with Reader and we want to ask them if they always want to use it for viewing PDF files.">
-          Use Adobe Reader as your default PDF viewer?
-        </message>
-        <message name="IDS_PDF_INFOBAR_ALWAYS_USE_READER_BUTTON" desc="The label of the 'always' button on the infobar that asks the user if they want to set Adobe Reader as default.">
-          Always
-        </message>
-        <message name="IDS_PDF_PASSWORD_DIALOG_TITLE" desc="The title of the dialog requesting a password to open a protected PDF.">
-          Password required
-        </message>
-
-        <!-- Adobe Reader is out of date Blocking Page -->
-        <message name="IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_TITLE" desc="The title of the Adobe Reader out of date blocking page.">
-          Adobe Reader Out Of Date
-        </message>
-        <message name="IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_BODY" desc="The body of the Adobe Reader out of date blocking page.">
-          Adobe Reader is out of date and may be insecure.
-        </message>
-        <message name="IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_UPDATE" desc="The name of the radio button option to go to the Adobe Reader installer website.">
-          Update Adobe Reader now
-        </message>
-        <message name="IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_PROCEED" desc="The name of the radio button to proceed to open the PDF with the out of date Adobe Reader.">
-          Proceed without updating Adobe Reader (not recommended)
-        </message>
-        <message name="IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_OK" desc="OK button text of the Adobe Reader out of date blocking page.">
-          OK
-        </message>
-        <message name="IDS_READER_OUT_OF_DATE_BLOCKING_PAGE_CANCEL" desc="Cancel button text of the Adobe Reader out of date blocking page.">
-          Cancel
-        </message>
-      </if>
-
       <!-- Media Capture messages -->
       <message name="IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO" desc="Question asked on the info bar whenever a web page requests access to the computer's microphone and camera.">
         <ph name="HOST">$1<ex>html5rocks.com</ex></ph> wants to use your camera and microphone.
diff --git a/chrome/app/mash/BUILD.gn b/chrome/app/mash/BUILD.gn
index c738779..2e2b7b3 100644
--- a/chrome/app/mash/BUILD.gn
+++ b/chrome/app/mash/BUILD.gn
@@ -29,6 +29,7 @@
     "//services/service_manager/runner/common",
     "//services/service_manager/runner/host:lib",
     "//services/service_manager/standalone",
+    "//services/ui/public/interfaces:constants",
     "//url",
   ]
 
diff --git a/chrome/app/mash/chrome_mash_manifest.json b/chrome/app/mash/chrome_mash_manifest.json
index f550255..c3a87d2a 100644
--- a/chrome/app/mash/chrome_mash_manifest.json
+++ b/chrome/app/mash/chrome_mash_manifest.json
@@ -18,7 +18,8 @@
         "service_manager": [ "service_manager:instance_per_child" ],
         "catalog": [ "control" ],
         "ash": [ "app" ],
-        "quick_launch": [ "app" ]
+        "quick_launch": [ "app" ],
+        "ui": [ "app" ]
       }
     }
   }
diff --git a/chrome/app/mash/mash_runner.cc b/chrome/app/mash/mash_runner.cc
index cf7c891..e05f7ecf 100644
--- a/chrome/app/mash/mash_runner.cc
+++ b/chrome/app/mash/mash_runner.cc
@@ -50,6 +50,7 @@
 #include "services/service_manager/runner/common/client_util.h"
 #include "services/service_manager/runner/common/switches.h"
 #include "services/service_manager/runner/init.h"
+#include "services/ui/public/interfaces/constants.mojom.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/base/ui_base_paths.h"
 #include "ui/base/ui_base_switches.h"
@@ -155,13 +156,13 @@
   DCHECK(exit_value);
   DCHECK(run_loop);
 
-  // TODO(jamescook): Also shut down if the window server dies.
-  if (identity.name() != mash::common::GetWindowManagerServiceName())
+  if (identity.name() != mash::common::GetWindowManagerServiceName() &&
+      identity.name() != ui::mojom::kServiceName) {
     return;
+  }
 
-  if (!run_loop->running())
-    return;
-
+  LOG(ERROR) << "Main process exiting because service " << identity.name()
+             << " quit unexpectedly.";
   *exit_value = 1;
   run_loop->Quit();
 }
@@ -224,8 +225,9 @@
   background_service_manager.SetInstanceQuitCallback(
       base::Bind(&OnInstanceQuitInMain, &run_loop, &exit_value));
 
-  // Ping services that we know we want to launch on startup.
-  // TODO(jamescook): Start the window server / ui service explicitly.
+  // Ping services that we know we want to launch on startup (UI service,
+  // window manager, quick launch app).
+  context_->connector()->Connect(ui::mojom::kServiceName);
   context_->connector()->Connect(mash::common::GetWindowManagerServiceName());
   context_->connector()->Connect(mash::quick_launch::mojom::kServiceName);
 
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
index cf3abaf..955fd64 100644
--- a/chrome/app/settings_strings.grdp
+++ b/chrome/app/settings_strings.grdp
@@ -1458,6 +1458,9 @@
   <message name="IDS_SETTINGS_LANGUAGES_OFFER_TO_TRANSLATE_IN_THIS_LANGUAGE" desc="The label for a checkbox which indicates whether or not pages in this language should be translated by default.">
     Offer to translate pages in this language
   </message>
+  <message name="IDS_SETTINGS_LANGUAGES_OFFER_TO_ENABLE_TRANSLATE" desc="The label of the check-box that enables the prompt to translate a page.">
+    Offer to translate pages that aren't in a language you read.
+  </message>
   <if expr="chromeos">
     <message name="IDS_SETTINGS_LANGUAGES_INPUT_METHODS_LIST_TITLE" desc="Title for the current input method in the header for the collapsible list of enabled input methods (keyboard layouts and input method editors).">
       Input method
diff --git a/chrome/app/version_assembly/version_assembly_manifest.template b/chrome/app/version_assembly/version_assembly_manifest.template
index 4ed10ad..9bd1fc5 100644
--- a/chrome/app/version_assembly/version_assembly_manifest.template
+++ b/chrome/app/version_assembly/version_assembly_manifest.template
@@ -5,5 +5,4 @@
       version='@MAJOR@.@MINOR@.@BUILD@.@PATCH@'
       type='win32'/>
   <file name='chrome_elf.dll'/>
-  <file name='kasko.dll'/>
-</assembly>
\ No newline at end of file
+</assembly>
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 118bea9..efb12a13 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -1560,7 +1560,6 @@
     "//third_party/WebKit/public:resources",
     "//third_party/cacheinvalidation",
     "//third_party/icu",
-    "//third_party/kasko",
     "//third_party/leveldatabase",
     "//third_party/libaddressinput",
     "//third_party/libjingle",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index f71b3df..f0ab41b 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -51,11 +51,9 @@
   "+services/shape_detection/public/interfaces",
   "+services/ui/public",
   "+skia/ext",
-  "+syzygy/kasko",
   "+third_party/boringssl/src/include",
   "+third_party/crashpad",
   "+third_party/cros_system_api",
-  "+third_party/kasko",
 
   # chrome only needs switches from cc. All usage of the compositor is from
   # content. Definitely don't include generic stuff from cc/base here, if this
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc
index 9854124..b2d6c90 100644
--- a/chrome/browser/android/chrome_feature_list.cc
+++ b/chrome/browser/android/chrome_feature_list.cc
@@ -95,6 +95,9 @@
 const base::Feature kContextualSearchSingleActions{
     "ContextualSearchSingleActions", base::FEATURE_DISABLED_BY_DEFAULT};
 
+const base::Feature kDownloadAutoResumptionThrottling{
+    "DownloadAutoResumptionThrottling", base::FEATURE_ENABLED_BY_DEFAULT};
+
 const base::Feature kImportantSitesInCBD{"ImportantSitesInCBD",
                                          base::FEATURE_DISABLED_BY_DEFAULT};
 
diff --git a/chrome/browser/android/chrome_feature_list.h b/chrome/browser/android/chrome_feature_list.h
index c702a3c6..47b5de4 100644
--- a/chrome/browser/android/chrome_feature_list.h
+++ b/chrome/browser/android/chrome_feature_list.h
@@ -20,6 +20,7 @@
 extern const base::Feature kCCTPostMessageAPI;
 extern const base::Feature kChromeHomeFeature;
 extern const base::Feature kContextualSearchSingleActions;
+extern const base::Feature kDownloadAutoResumptionThrottling;
 extern const base::Feature kImportantSitesInCBD;
 extern const base::Feature kImprovedA2HS;
 extern const base::Feature kNativeAndroidHistoryManager;
diff --git a/chrome/browser/android/download/download_manager_service.cc b/chrome/browser/android/download/download_manager_service.cc
index d274f2b6..65ebf67 100644
--- a/chrome/browser/android/download/download_manager_service.cc
+++ b/chrome/browser/android/download/download_manager_service.cc
@@ -7,19 +7,23 @@
 #include "base/android/jni_string.h"
 #include "base/location.h"
 #include "base/single_thread_task_runner.h"
+#include "base/strings/string_number_conversions.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/time/time.h"
+#include "chrome/browser/android/chrome_feature_list.h"
 #include "chrome/browser/android/download/download_controller.h"
 #include "chrome/browser/download/download_service.h"
 #include "chrome/browser/download/download_service_factory.h"
 #include "chrome/browser/profiles/profile_manager.h"
 #include "chrome/grit/generated_resources.h"
 #include "components/mime_util/mime_util.h"
+#include "components/variations/variations_associated_data.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/download_item.h"
 #include "jni/DownloadInfo_jni.h"
 #include "jni/DownloadItem_jni.h"
 #include "jni/DownloadManagerService_jni.h"
+
 #include "ui/base/l10n/l10n_util.h"
 
 using base::android::JavaParamRef;
@@ -32,6 +36,10 @@
 // The remaining time for a download item if it cannot be calculated.
 long kUnknownRemainingTime = -1;
 
+// Finch flag for controlling auto resumption limit.
+int kDefaultAutoResumptionLimit = 5;
+const char kAutoResumptionLimitVariation[] = "AutoResumptionLimit";
+
 bool ShouldShowDownloadItem(content::DownloadItem* item) {
   return !item->IsTemporary();
 }
@@ -445,3 +453,18 @@
   std::string mime_type = ConvertJavaStringToUTF8(env, jmime_type);
   return mime_util::IsSupportedMimeType(mime_type);
 }
+
+// static
+jint GetAutoResumptionLimit(JNIEnv* env,
+                            const JavaParamRef<jclass>& clazz) {
+  std::string variation = variations::GetVariationParamValueByFeature(
+      chrome::android::kDownloadAutoResumptionThrottling,
+      kAutoResumptionLimitVariation);
+  int auto_resumption_limit;
+  if (!variation.empty() &&
+      base::StringToInt(variation, &auto_resumption_limit)) {
+    return auto_resumption_limit;
+  }
+
+  return kDefaultAutoResumptionLimit;
+}
diff --git a/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc b/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
index 4374579..fc19572 100644
--- a/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
+++ b/chrome/browser/android/search_geolocation/search_geolocation_disclosure_tab_helper.cc
@@ -87,11 +87,6 @@
   if (!ShouldShowDisclosureForUrl(gurl))
     return;
 
-  // Check that the Chrome app has geolocation permission.
-  JNIEnv* env = base::android::AttachCurrentThread();
-  if (!Java_GeolocationHeader_hasGeolocationPermission(env))
-    return;
-
   // Don't show the infobar if the user has dismissed it, or they've seen it
   // enough times already.
   PrefService* prefs = GetProfile()->GetPrefs();
@@ -135,6 +130,11 @@
   if (!service->GetDSEGeolocationSetting())
     return;
 
+  // Check that the Chrome app has geolocation permission.
+  JNIEnv* env = base::android::AttachCurrentThread();
+  if (!Java_GeolocationHeader_hasGeolocationPermission(env))
+    return;
+
   // All good, let's show the disclosure and increment the shown count.
   SearchGeolocationDisclosureInfoBarDelegate::Create(web_contents(), gurl);
   shown_count++;
diff --git a/chrome/browser/android/vr_shell/BUILD.gn b/chrome/browser/android/vr_shell/BUILD.gn
index 0d0abfb..067601f 100644
--- a/chrome/browser/android/vr_shell/BUILD.gn
+++ b/chrome/browser/android/vr_shell/BUILD.gn
@@ -71,6 +71,7 @@
       "//components/security_state/core",
       "//content/public/browser",
       "//content/public/common",
+      "//device/gamepad",
       "//device/vr",
       "//ui/android",
       "//ui/base",
diff --git a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
index 8a095d2d..7f3a2a2 100644
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
@@ -6,6 +6,7 @@
 
 #include "base/callback_helpers.h"
 #include "chrome/browser/android/vr_shell/vr_shell.h"
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h"
 
 namespace vr_shell {
 
@@ -13,25 +14,17 @@
 static constexpr long kPredictionTimeWithoutVsyncNanos = 50000000;
 }  // namespace
 
-NonPresentingGvrDelegate::NonPresentingGvrDelegate(long context)
+NonPresentingGvrDelegate::NonPresentingGvrDelegate(gvr_context* context)
     : task_runner_(base::ThreadTaskRunnerHandle::Get()),
       binding_(this),
       weak_ptr_factory_(this) {
-  gvr_api_ = gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context));
+  gvr_api_ = gvr::GvrApi::WrapNonOwned(context);
 }
 
 NonPresentingGvrDelegate::~NonPresentingGvrDelegate() {
   StopVSyncLoop();
 }
 
-gvr::Sizei NonPresentingGvrDelegate::GetWebVRCompositorSurfaceSize() {
-   return device::kInvalidRenderTargetSize;
-}
-
-gvr::GvrApi* NonPresentingGvrDelegate::gvr_api() {
-  return gvr_api_.get();
-}
-
 void NonPresentingGvrDelegate::OnVRVsyncProviderRequest(
     device::mojom::VRVSyncProviderRequest request) {
   binding_.Close();
@@ -142,4 +135,22 @@
   callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, -1);
 }
 
+bool NonPresentingGvrDelegate::SupportsPresentation() {
+  return false;
+}
+
+void NonPresentingGvrDelegate::ResetPose() {
+  // Should never call RecenterTracking when using with Daydream viewers. On
+  // those devices recentering should only be done via the controller.
+  if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD)
+    gvr_api_->RecenterTracking();
+}
+
+void NonPresentingGvrDelegate::CreateVRDisplayInfo(
+    const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+    uint32_t device_id) {
+  callback.Run(VrShell::CreateVRDisplayInfo(
+      gvr_api_.get(), device::kInvalidRenderTargetSize, device_id));
+}
+
 }  // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
index bf6d4d10..107be75 100644
--- a/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
+++ b/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
@@ -12,6 +12,7 @@
 #include "device/vr/android/gvr/gvr_delegate.h"
 #include "device/vr/vr_service.mojom.h"
 #include "mojo/public/cpp/bindings/binding.h"
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
 
 namespace vr_shell {
 
@@ -19,7 +20,7 @@
 class NonPresentingGvrDelegate : public device::GvrDelegate,
                                  public device::mojom::VRVSyncProvider {
  public:
-  explicit NonPresentingGvrDelegate(long context);
+  explicit NonPresentingGvrDelegate(gvr_context* context);
 
   ~NonPresentingGvrDelegate() override;
 
@@ -29,13 +30,15 @@
   void UpdateWebVRTextureBounds(int16_t frame_index,
                                 const gvr::Rectf& left_bounds,
                                 const gvr::Rectf& right_bounds) override {}
-  void SetWebVRRenderSurfaceSize(int width, int height) override {}
-  gvr::Sizei GetWebVRCompositorSurfaceSize() override;
-  gvr::GvrApi* gvr_api() override;
   void OnVRVsyncProviderRequest(
       device::mojom::VRVSyncProviderRequest request) override;
   void UpdateVSyncInterval(long timebase_nanos,
                            double interval_seconds) override;
+  bool SupportsPresentation() override;
+  void ResetPose() override;
+  void CreateVRDisplayInfo(
+      const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+      uint32_t device_id) override;
 
   void Pause();
   void Resume();
diff --git a/chrome/browser/android/vr_shell/vr_compositor.cc b/chrome/browser/android/vr_shell/vr_compositor.cc
index e386d90..f22271a 100644
--- a/chrome/browser/android/vr_shell/vr_compositor.cc
+++ b/chrome/browser/android/vr_shell/vr_compositor.cc
@@ -59,8 +59,7 @@
 }
 
 void VrCompositor::SetWindowBounds(gfx::Size size) {
-  bounds_ = size;
-  compositor_->SetWindowBounds(bounds_);
+  compositor_->SetWindowBounds(size);
 }
 
 void VrCompositor::SurfaceChanged(jobject surface) {
diff --git a/chrome/browser/android/vr_shell/vr_compositor.h b/chrome/browser/android/vr_shell/vr_compositor.h
index 7238ad8..20aac81 100644
--- a/chrome/browser/android/vr_shell/vr_compositor.h
+++ b/chrome/browser/android/vr_shell/vr_compositor.h
@@ -36,7 +36,6 @@
 
   void SurfaceDestroyed();
   void SetWindowBounds(gfx::Size size);
-  gfx::Size GetWindowBounds() { return bounds_; }
   void SurfaceChanged(jobject surface);
   void SetLayer(content::WebContents* web_contents);
 
@@ -48,7 +47,6 @@
   void RestoreLayer();
 
   std::unique_ptr<content::Compositor> compositor_;
-  gfx::Size bounds_;
 
   cc::Layer* layer_ = nullptr;
   cc::Layer* layer_parent_ = nullptr;
diff --git a/chrome/browser/android/vr_shell/vr_gl_thread.h b/chrome/browser/android/vr_shell/vr_gl_thread.h
index 0fcb754..763174d6b 100644
--- a/chrome/browser/android/vr_shell/vr_gl_thread.h
+++ b/chrome/browser/android/vr_shell/vr_gl_thread.h
@@ -31,7 +31,6 @@
 
   ~VrGLThread() override;
   base::WeakPtr<VrShellGl> GetVrShellGl() { return weak_vr_shell_gl_; }
-  VrShellGl* GetVrShellGlUnsafe() { return vr_shell_gl_.get(); }
 
  protected:
   void Init() override;
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
index d02f727..32da700 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -30,6 +30,7 @@
 #include "content/public/browser/render_widget_host_view.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/referrer.h"
+#include "device/vr/android/gvr/gvr_device.h"
 #include "device/vr/android/gvr/gvr_device_provider.h"
 #include "jni/VrShellImpl_jni.h"
 #include "third_party/WebKit/public/platform/WebInputEvent.h"
@@ -78,6 +79,7 @@
       metrics_helper_(base::MakeUnique<VrMetricsHelper>(main_contents_)),
       main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
       reprojected_rendering_(reprojected_rendering),
+      gvr_api_(gvr_api),
       weak_ptr_factory_(this) {
   DCHECK(g_instance == nullptr);
   g_instance = this;
@@ -240,16 +242,6 @@
   html_interface_->SetLoadProgress(progress);
 }
 
-void VrShell::SetWebVRRenderSurfaceSize(int width, int height) {
-  // TODO(klausw,crbug.com/655722): Change the GVR render size and set the WebVR
-  // render surface size.
-}
-
-gvr::Sizei VrShell::GetWebVRCompositorSurfaceSize() {
-  const gfx::Size& size = content_compositor_->GetWindowBounds();
-  return {size.width(), size.height()};
-}
-
 void VrShell::SetWebVRSecureOrigin(bool secure_origin) {
   // TODO(cjgrant): Align this state with the logic that drives the omnibox.
   html_interface_->SetWebVRSecureOrigin(secure_origin);
@@ -265,14 +257,21 @@
                                      left_bounds, right_bounds));
 }
 
-// TODO(mthiesse): Do not expose GVR API outside of GL thread.
-// It's not thread-safe.
-gvr::GvrApi* VrShell::gvr_api() {
-  if (gl_thread_->GetVrShellGlUnsafe()) {
-    return gl_thread_->GetVrShellGlUnsafe()->gvr_api();
-  }
-  CHECK(false);
-  return nullptr;
+bool VrShell::SupportsPresentation() {
+  return true;
+}
+
+void VrShell::ResetPose() {
+  gl_thread_->task_runner()->PostTask(
+      FROM_HERE, base::Bind(&VrShellGl::ResetPose, gl_thread_->GetVrShellGl()));
+}
+
+void VrShell::CreateVRDisplayInfo(
+    const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+    uint32_t device_id) {
+  PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo,
+                                     gl_thread_->GetVrShellGl(),
+                                     callback, device_id));
 }
 
 void VrShell::SurfacesChanged(jobject content_surface, jobject ui_surface) {
@@ -281,7 +280,7 @@
 }
 
 void VrShell::GvrDelegateReady() {
-  delegate_provider_->SetDelegate(this);
+  delegate_provider_->SetDelegate(this, gvr_api_);
 }
 
 void VrShell::AppButtonPressed() {
@@ -293,9 +292,9 @@
   if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) {
     if (delegate_provider_->device_provider()) {
       if (html_interface_->GetMenuMode()) {
-        delegate_provider_->device_provider()->OnDisplayBlur();
+        delegate_provider_->device_provider()->Device()->OnBlur();
       } else {
-        delegate_provider_->device_provider()->OnDisplayFocus();
+        delegate_provider_->device_provider()->Device()->OnFocus();
       }
     }
   }
@@ -498,6 +497,55 @@
   return pose;
 }
 
+device::mojom::VRDisplayInfoPtr VrShell::CreateVRDisplayInfo(
+    gvr::GvrApi* gvr_api, gvr::Sizei compositor_size, uint32_t device_id) {
+  TRACE_EVENT0("input", "GvrDevice::GetVRDevice");
+
+  device::mojom::VRDisplayInfoPtr device = device::mojom::VRDisplayInfo::New();
+
+  device->index = device_id;
+
+  device->capabilities = device::mojom::VRDisplayCapabilities::New();
+  device->capabilities->hasOrientation = true;
+  device->capabilities->hasPosition = false;
+  device->capabilities->hasExternalDisplay = false;
+  device->capabilities->canPresent = true;
+
+  std::string vendor = gvr_api->GetViewerVendor();
+  std::string model = gvr_api->GetViewerModel();
+  device->displayName = vendor + " " + model;
+
+  gvr::BufferViewportList gvr_buffer_viewports =
+      gvr_api->CreateEmptyBufferViewportList();
+  gvr_buffer_viewports.SetToRecommendedBufferViewports();
+
+  device->leftEye = device::mojom::VREyeParameters::New();
+  device->rightEye = device::mojom::VREyeParameters::New();
+  for (auto eye : {GVR_LEFT_EYE, GVR_RIGHT_EYE}) {
+    device::mojom::VREyeParametersPtr& eye_params =
+        (eye == GVR_LEFT_EYE) ? device->leftEye : device->rightEye;
+    eye_params->fieldOfView = device::mojom::VRFieldOfView::New();
+    eye_params->offset.resize(3);
+    eye_params->renderWidth = compositor_size.width / 2;
+    eye_params->renderHeight = compositor_size.height;
+
+    gvr::BufferViewport eye_viewport = gvr_api->CreateBufferViewport();
+    gvr_buffer_viewports.GetBufferViewport(eye, &eye_viewport);
+    gvr::Rectf eye_fov = eye_viewport.GetSourceFov();
+    eye_params->fieldOfView->upDegrees = eye_fov.top;
+    eye_params->fieldOfView->downDegrees = eye_fov.bottom;
+    eye_params->fieldOfView->leftDegrees = eye_fov.left;
+    eye_params->fieldOfView->rightDegrees = eye_fov.right;
+
+    gvr::Mat4f eye_mat = gvr_api->GetEyeFromHeadMatrix(eye);
+    eye_params->offset[0] = -eye_mat.m[0][3];
+    eye_params->offset[1] = -eye_mat.m[1][3];
+    eye_params->offset[2] = -eye_mat.m[2][3];
+  }
+
+  return device;
+}
+
 // ----------------------------------------------------------------------------
 // Native JNI methods
 // ----------------------------------------------------------------------------
@@ -514,7 +562,7 @@
       reinterpret_cast<ui::WindowAndroid*>(content_window_android),
       content::WebContents::FromJavaWebContents(ui_web_contents),
       reinterpret_cast<ui::WindowAndroid*>(ui_window_android),
-      for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate),
+      for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
       reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
 }
 
diff --git a/chrome/browser/android/vr_shell/vr_shell.h b/chrome/browser/android/vr_shell/vr_shell.h
index 6a4eb6b..a6a5429 100644
--- a/chrome/browser/android/vr_shell/vr_shell.h
+++ b/chrome/browser/android/vr_shell/vr_shell.h
@@ -137,7 +137,12 @@
   void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event);
   void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
 
+  // TODO(mthiesse): Find a better place for these functions to live.
   static device::mojom::VRPosePtr VRPosePtrFromGvrPose(gvr::Mat4f head_mat);
+  static device::mojom::VRDisplayInfoPtr CreateVRDisplayInfo(
+      gvr::GvrApi* gvr_api,
+      gvr::Sizei compositor_size,
+      uint32_t device_id);
 
  private:
   ~VrShell() override;
@@ -155,13 +160,15 @@
   void UpdateWebVRTextureBounds(int16_t frame_index,
                                 const gvr::Rectf& left_bounds,
                                 const gvr::Rectf& right_bounds) override;
-  gvr::GvrApi* gvr_api() override;
-  void SetWebVRRenderSurfaceSize(int width, int height) override;
-  gvr::Sizei GetWebVRCompositorSurfaceSize() override;
   void OnVRVsyncProviderRequest(
       device::mojom::VRVSyncProviderRequest request) override;
   void UpdateVSyncInterval(long timebase_nanos,
                            double interval_seconds) override;
+  bool SupportsPresentation() override;
+  void ResetPose() override;
+  void CreateVRDisplayInfo(
+      const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+      uint32_t device_id) override;
 
   std::unique_ptr<UiInterface> html_interface_;
 
@@ -183,6 +190,10 @@
   std::unique_ptr<VrGLThread> gl_thread_;
   bool reprojected_rendering_;
 
+  // TODO(mthiesse): Remove the need for this to be stored here.
+  // crbug.com/674594
+  gvr_context* gvr_api_;
+
   base::WeakPtrFactory<VrShell> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(VrShell);
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
index 2d1a5088..6a0cc04 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc
@@ -6,7 +6,9 @@
 
 #include "base/android/jni_android.h"
 #include "chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h"
+#include "device/vr/android/gvr/gvr_device.h"
 #include "device/vr/android/gvr/gvr_device_provider.h"
+#include "device/vr/android/gvr/gvr_gamepad_data_fetcher.h"
 #include "jni/VrShellDelegate_jni.h"
 
 using base::android::JavaParamRef;
@@ -23,35 +25,49 @@
 VrShellDelegate::~VrShellDelegate() {
   GvrDelegateProvider::SetInstance(nullptr);
   if (device_provider_) {
-    device_provider_->OnNonPresentingDelegateRemoved();
+    device_provider_->Device()->OnDelegateChanged();
   }
 }
 
-VrShellDelegate* VrShellDelegate::GetNativeDelegate(
+VrShellDelegate* VrShellDelegate::GetNativeVrShellDelegate(
     JNIEnv* env, jobject jdelegate) {
   long native_delegate = Java_VrShellDelegate_getNativePointer(env, jdelegate);
   return reinterpret_cast<VrShellDelegate*>(native_delegate);
 }
 
-void VrShellDelegate::SetDelegate(device::GvrDelegate* delegate) {
+void VrShellDelegate::SetDelegate(device::GvrDelegate* delegate,
+                                  gvr_context* context) {
+  context_ = context;
   delegate_ = delegate;
+  // Clean up the non-presenting delegate.
   if (non_presenting_delegate_) {
     device::mojom::VRVSyncProviderRequest request =
         non_presenting_delegate_->OnSwitchToPresentingDelegate();
     if (request.is_pending())
       delegate->OnVRVsyncProviderRequest(std::move(request));
+    non_presenting_delegate_ = nullptr;
+    JNIEnv* env = AttachCurrentThread();
+    Java_VrShellDelegate_shutdownNonPresentingNativeContext(
+        env, j_vr_shell_delegate_.obj());
   }
   if (device_provider_) {
-    device_provider_->OnGvrDelegateReady(delegate_);
+    device::GvrDevice* device = device_provider_->Device();
+    device::GamepadDataFetcherManager::GetInstance()->AddFactory(
+        new device::GvrGamepadDataFetcher::Factory(context, device->id()));
+    device->OnDelegateChanged();
   }
+
   delegate_->UpdateVSyncInterval(timebase_nanos_, interval_seconds_);
 }
 
 void VrShellDelegate::RemoveDelegate() {
-  if (device_provider_) {
-    device_provider_->OnGvrDelegateRemoved();
-  }
   delegate_ = nullptr;
+  device::GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
+        device::GAMEPAD_SOURCE_GVR);
+  if (device_provider_) {
+    CreateNonPresentingDelegate();
+    device_provider_->Device()->OnDelegateChanged();
+  }
 }
 
 void VrShellDelegate::SetPresentResult(JNIEnv* env,
@@ -65,7 +81,8 @@
 void VrShellDelegate::DisplayActivate(JNIEnv* env,
                                       const JavaParamRef<jobject>& obj) {
   if (device_provider_) {
-    device_provider_->OnDisplayActivate();
+    device_provider_->Device()->OnActivate(
+        device::mojom::VRDisplayEventReason::MOUNTED);
   }
 }
 
@@ -101,10 +118,20 @@
 
 void VrShellDelegate::SetDeviceProvider(
     device::GvrDeviceProvider* device_provider) {
+  CHECK(!device_provider_);
   device_provider_ = device_provider;
-  if (device_provider_ && delegate_) {
-    device_provider_->OnGvrDelegateReady(delegate_);
-  }
+  if (!delegate_)
+    CreateNonPresentingDelegate();
+  device_provider_->Device()->OnDelegateChanged();
+}
+
+void VrShellDelegate::ClearDeviceProvider() {
+  non_presenting_delegate_ = nullptr;
+  JNIEnv* env = AttachCurrentThread();
+  Java_VrShellDelegate_shutdownNonPresentingNativeContext(
+      env, j_vr_shell_delegate_.obj());
+  device_provider_->Device()->OnDelegateChanged();
+  device_provider_ = nullptr;
 }
 
 void VrShellDelegate::RequestWebVRPresent(
@@ -141,33 +168,29 @@
 
 void VrShellDelegate::OnVRVsyncProviderRequest(
     device::mojom::VRVSyncProviderRequest request) {
-  GetNonPresentingDelegate()->OnVRVsyncProviderRequest(std::move(request));
+  GetDelegate()->OnVRVsyncProviderRequest(std::move(request));
 }
 
-device::GvrDelegate* VrShellDelegate::GetNonPresentingDelegate() {
-  if (!non_presenting_delegate_) {
-    JNIEnv* env = AttachCurrentThread();
-    jlong context = Java_VrShellDelegate_createNonPresentingNativeContext(
-        env, j_vr_shell_delegate_.obj());
-    if (!context)
-      return nullptr;
+void VrShellDelegate::CreateNonPresentingDelegate() {
+  JNIEnv* env = AttachCurrentThread();
+  gvr_context* context = reinterpret_cast<gvr_context*>(
+      Java_VrShellDelegate_createNonPresentingNativeContext(
+          env, j_vr_shell_delegate_.obj()));
+  if (!context)
+    return;
+  context_ = context;
+  non_presenting_delegate_ =
+      base::MakeUnique<NonPresentingGvrDelegate>(context);
+  non_presenting_delegate_->UpdateVSyncInterval(timebase_nanos_,
+                                                interval_seconds_);
+}
 
-    non_presenting_delegate_.reset(new NonPresentingGvrDelegate(context));
-    non_presenting_delegate_->UpdateVSyncInterval(timebase_nanos_,
-                                                  interval_seconds_);
-  }
+device::GvrDelegate* VrShellDelegate::GetDelegate() {
+  if (delegate_)
+    return delegate_;
   return non_presenting_delegate_.get();
 }
 
-void VrShellDelegate::DestroyNonPresentingDelegate() {
-  if (non_presenting_delegate_) {
-    non_presenting_delegate_.reset(nullptr);
-    JNIEnv* env = AttachCurrentThread();
-    Java_VrShellDelegate_shutdownNonPresentingNativeContext(
-        env, j_vr_shell_delegate_.obj());
-  }
-}
-
 void VrShellDelegate::SetListeningForActivate(bool listening) {
   JNIEnv* env = AttachCurrentThread();
   Java_VrShellDelegate_setListeningForWebVrActivate(
diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.h b/chrome/browser/android/vr_shell/vr_shell_delegate.h
index 8067a41..de0e2c0 100644
--- a/chrome/browser/android/vr_shell/vr_shell_delegate.h
+++ b/chrome/browser/android/vr_shell/vr_shell_delegate.h
@@ -25,9 +25,10 @@
   VrShellDelegate(JNIEnv* env, jobject obj);
   ~VrShellDelegate() override;
 
-  static VrShellDelegate* GetNativeDelegate(JNIEnv* env, jobject jdelegate);
+  static VrShellDelegate* GetNativeVrShellDelegate(JNIEnv* env,
+                                                   jobject jdelegate);
 
-  void SetDelegate(device::GvrDelegate* delegate);
+  void SetDelegate(device::GvrDelegate* delegate, gvr_context* context);
   void RemoveDelegate();
 
   void SetPresentResult(JNIEnv* env,
@@ -49,12 +50,14 @@
  private:
   // device::GvrDelegateProvider implementation
   void SetDeviceProvider(device::GvrDeviceProvider* device_provider) override;
+  void ClearDeviceProvider() override;
   void RequestWebVRPresent(const base::Callback<void(bool)>& callback) override;
   void ExitWebVRPresent() override;
-  device::GvrDelegate* GetNonPresentingDelegate() override;
-  void DestroyNonPresentingDelegate() override;
+  device::GvrDelegate* GetDelegate() override;
   void SetListeningForActivate(bool listening) override;
 
+  void CreateNonPresentingDelegate();
+
   std::unique_ptr<NonPresentingGvrDelegate> non_presenting_delegate_;
   base::android::ScopedJavaGlobalRef<jobject> j_vr_shell_delegate_;
   device::GvrDeviceProvider* device_provider_ = nullptr;
@@ -63,6 +66,10 @@
   long timebase_nanos_ = 0;
   double interval_seconds_ = 0;
 
+  // TODO(mthiesse): Remove the need for this to be stored here.
+  // crbug.com/674594
+  gvr_context* context_ = nullptr;
+
   base::WeakPtrFactory<VrShellDelegate> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(VrShellDelegate);
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 78bc7f8..55a451927 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -154,6 +154,12 @@
       std::chrono::steady_clock::now().time_since_epoch()).count();
 }
 
+void RunVRDisplayInfoCallback(
+    const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+    device::mojom::VRDisplayInfoPtr info) {
+  callback.Run(std::move(info));
+}
+
 }  // namespace
 
 VrShellGl::VrShellGl(
@@ -946,10 +952,6 @@
   }
 }
 
-gvr::GvrApi* VrShellGl::gvr_api() {
-  return gvr_api_.get();
-}
-
 void VrShellGl::ContentBoundsChanged(int width, int height) {
   TRACE_EVENT0("gpu", "VrShellGl::ContentBoundsChanged");
   content_tex_css_width_ = width;
@@ -1057,4 +1059,21 @@
   callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index);
 }
 
+void VrShellGl::ResetPose() {
+  // Should never call RecenterTracking when using with Daydream viewers. On
+  // those devices recentering should only be done via the controller.
+  if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD)
+    gvr_api_->RecenterTracking();
+}
+
+void VrShellGl::CreateVRDisplayInfo(
+    const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+    uint32_t device_id) {
+  device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
+      gvr_api_.get(), content_tex_physical_size_, device_id);
+  main_thread_task_runner_->PostTask(
+      FROM_HERE,
+      base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
+}
+
 }  // namespace vr_shell
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.h b/chrome/browser/android/vr_shell/vr_shell_gl.h
index cc9a2e72..55236b7 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.h
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.h
@@ -80,7 +80,6 @@
   void UpdateWebVRTextureBounds(int16_t frame_index,
                                 const gvr::Rectf& left_bounds,
                                 const gvr::Rectf& right_bounds);
-  gvr::GvrApi* gvr_api();
   void SetGvrPoseForWebVr(const gvr::Mat4f& pose, uint32_t pose_num);
   gvr::Sizei GetWebVRCompositorSurfaceSize();
 
@@ -89,6 +88,10 @@
   void UpdateVSyncInterval(long timebase_nanos, double interval_seconds);
 
   void OnRequest(device::mojom::VRVSyncProviderRequest request);
+  void ResetPose();
+  void CreateVRDisplayInfo(
+      const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+      uint32_t device_id);
 
  private:
   void GvrInit(gvr_context* gvr_api);
diff --git a/chrome/browser/chrome_browser_main_win.cc b/chrome/browser/chrome_browser_main_win.cc
index dd3a9b6..1e0113dc 100644
--- a/chrome/browser/chrome_browser_main_win.cc
+++ b/chrome/browser/chrome_browser_main_win.cc
@@ -77,10 +77,6 @@
 #include "chrome/browser/google/did_run_updater_win.h"
 #endif
 
-#if BUILDFLAG(ENABLE_KASKO)
-#include "syzygy/kasko/api/reporter.h"
-#endif
-
 namespace {
 
 typedef HRESULT (STDAPICALLTYPE* RegisterApplicationRestartProc)(
@@ -114,41 +110,6 @@
   base::string16 GetLocalizedString(int installer_string_id) override;
 };
 
-#if BUILDFLAG(ENABLE_KASKO)
-void ObserveFailedCrashReportDirectory(const base::FilePath& path, bool error) {
-  DCHECK(!error);
-  if (error)
-    return;
-  base::FileEnumerator enumerator(path, true, base::FileEnumerator::FILES);
-  for (base::FilePath report_file = enumerator.Next(); !report_file.empty();
-       report_file = enumerator.Next()) {
-    if (report_file.Extension() ==
-        kasko::api::kPermanentFailureMinidumpExtension) {
-      UMA_HISTOGRAM_BOOLEAN("CrashReport.PermanentUploadFailure", true);
-    }
-    bool result = base::DeleteFile(report_file, false);
-    DCHECK(result);
-  }
-}
-
-void StartFailedKaskoCrashReportWatcher(base::FilePathWatcher* watcher) {
-  base::FilePath watcher_data_directory;
-  if (!PathService::Get(chrome::DIR_WATCHER_DATA, &watcher_data_directory)) {
-    NOTREACHED();
-  } else {
-    base::FilePath permanent_failure_directory =
-        watcher_data_directory.Append(kPermanentlyFailedReportsSubdir);
-    if (!watcher->Watch(permanent_failure_directory, true,
-                        base::Bind(&ObserveFailedCrashReportDirectory))) {
-      NOTREACHED();
-    }
-
-    // Call it once to observe any files present prior to the Watch() call.
-    ObserveFailedCrashReportDirectory(permanent_failure_directory, false);
-  }
-}
-#endif  // BUILDFLAG(ENABLE_KASKO)
-
 void DetectFaultTolerantHeap() {
   enum FTHFlags {
     FTH_HKLM = 1,
@@ -406,18 +367,6 @@
 
   InitializeChromeElf();
 
-#if BUILDFLAG(ENABLE_KASKO)
-  content::BrowserThread::PostDelayedTask(
-      content::BrowserThread::FILE, FROM_HERE,
-      base::Bind(&StartFailedKaskoCrashReportWatcher,
-                 base::Unretained(&failed_kasko_crash_report_watcher_)),
-      base::TimeDelta::FromMinutes(5));
-#endif  // BUILDFLAG(ENABLE_KASKO)
-
-#if defined(GOOGLE_CHROME_BUILD)
-  did_run_updater_.reset(new DidRunUpdater);
-#endif
-
   // Record UMA data about whether the fault-tolerant heap is enabled.
   // Use a delayed task to minimize the impact on startup time.
   content::BrowserThread::PostDelayedTask(
diff --git a/chrome/browser/chrome_browser_main_win.h b/chrome/browser/chrome_browser_main_win.h
index 68ad182..22b29f0 100644
--- a/chrome/browser/chrome_browser_main_win.h
+++ b/chrome/browser/chrome_browser_main_win.h
@@ -10,7 +10,6 @@
 #include "base/files/file_path_watcher.h"
 #include "base/macros.h"
 #include "chrome/browser/chrome_browser_main.h"
-#include "third_party/kasko/kasko_features.h"
 
 class DidRunUpdater;
 class ModuleWatcher;
@@ -74,10 +73,6 @@
 #if defined(GOOGLE_CHROME_BUILD)
   std::unique_ptr<DidRunUpdater> did_run_updater_;
 #endif
-#if BUILDFLAG(ENABLE_KASKO)
-  // Cleans up Kasko crash reports that exceeded the maximum upload attempts.
-  base::FilePathWatcher failed_kasko_crash_report_watcher_;
-#endif
 
   std::unique_ptr<ModuleWatcher> module_watcher_;
 
diff --git a/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc b/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc
index 5a989cbd..7b345b23 100644
--- a/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc
+++ b/chrome/browser/component_updater/subresource_filter_component_installer_unittest.cc
@@ -170,7 +170,7 @@
   base::FieldTrialList field_trial_list(nullptr);
   subresource_filter::testing::ScopedSubresourceFilterFeatureToggle
       scoped_feature_toggle(base::FeatureList::OVERRIDE_DISABLE_FEATURE,
-                            subresource_filter::kActivationStateEnabled,
+                            subresource_filter::kActivationLevelEnabled,
                             subresource_filter::kActivationScopeNoSites);
   std::unique_ptr<SubresourceFilterMockComponentUpdateService>
       component_updater(new SubresourceFilterMockComponentUpdateService());
@@ -184,7 +184,7 @@
   base::FieldTrialList field_trial_list(nullptr);
   subresource_filter::testing::ScopedSubresourceFilterFeatureToggle
       scoped_feature_toggle(base::FeatureList::OVERRIDE_ENABLE_FEATURE,
-                            subresource_filter::kActivationStateDisabled,
+                            subresource_filter::kActivationLevelDisabled,
                             subresource_filter::kActivationScopeNoSites);
   std::unique_ptr<SubresourceFilterMockComponentUpdateService>
       component_updater(new SubresourceFilterMockComponentUpdateService());
diff --git a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc
index c5b2f3d..45b6c3b 100644
--- a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc
+++ b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.cc
@@ -132,15 +132,14 @@
     evaluator->TrackForWebContents(contents);
 }
 
-void ChromeContentRulesRegistry::DidNavigateMainFrame(
+void ChromeContentRulesRegistry::DidFinishNavigation(
     content::WebContents* contents,
-    const content::LoadCommittedDetails& details,
-    const content::FrameNavigateParams& params) {
+    content::NavigationHandle* navigation_handle) {
   if (base::ContainsKey(active_rules_, contents)) {
     EvaluationScope evaluation_scope(this);
     for (const std::unique_ptr<ContentPredicateEvaluator>& evaluator :
          evaluators_)
-      evaluator->OnWebContentsNavigation(contents, details, params);
+      evaluator->OnWebContentsNavigation(contents, navigation_handle);
   }
 }
 
diff --git a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h
index f8f52063..09ded34 100644
--- a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h
+++ b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry.h
@@ -28,8 +28,6 @@
 namespace content {
 class BrowserContext;
 class WebContents;
-struct FrameNavigateParams;
-struct LoadCommittedDetails;
 }
 
 namespace extensions {
@@ -69,10 +67,9 @@
   // ContentRulesRegistry:
   void MonitorWebContentsForRuleEvaluation(
       content::WebContents* contents) override;
-  void DidNavigateMainFrame(
+  void DidFinishNavigation(
       content::WebContents* tab,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override;
+      content::NavigationHandle* navigation_handle) override;
 
   // RulesRegistry:
   std::string AddRulesImpl(
diff --git a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc
index 7dff9dea..ad3be5b 100644
--- a/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/chrome_content_rules_registry_unittest.cc
@@ -12,7 +12,7 @@
 #include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
 #include "chrome/browser/extensions/test_extension_environment.h"
 #include "chrome/test/base/testing_profile.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/frame_navigate_params.h"
 #include "extensions/common/extension.h"
@@ -77,8 +77,7 @@
 
   void OnWebContentsNavigation(
       content::WebContents* contents,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override {
+      content::NavigationHandle* navigation_handle) override {
     RequestEvaluationIfSpecified();
   }
 
@@ -151,8 +150,11 @@
 
   std::unique_ptr<content::WebContents> tab = env()->MakeTab();
   registry->MonitorWebContentsForRuleEvaluation(tab.get());
-  registry->DidNavigateMainFrame(tab.get(), content::LoadCommittedDetails(),
-                                 content::FrameNavigateParams());
+  std::unique_ptr<content::NavigationHandle> navigation_handle =
+      content::NavigationHandle::CreateNavigationHandleForTesting(
+          GURL(), tab->GetMainFrame(), true);
+
+  registry->DidFinishNavigation(tab.get(), navigation_handle.get());
   EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting());
 
   // Add a rule.
@@ -179,25 +181,27 @@
       "{\"page_action\": {}}"));
   registry->AddRulesImpl(extension->id(), rules);
 
-  registry->DidNavigateMainFrame(tab.get(), content::LoadCommittedDetails(),
-                                 content::FrameNavigateParams());
+  registry->DidFinishNavigation(tab.get(), navigation_handle.get());
   EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting());
 
   evaluator->RequestImmediateEvaluation(tab.get(), true);
   EXPECT_EQ(1u, registry->GetActiveRulesCountForTesting());
 
   // Closing the tab should erase its entry from active_rules_.
+  navigation_handle.reset();
   tab.reset();
   EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting());
 
   tab = env()->MakeTab();
+  navigation_handle =
+      content::NavigationHandle::CreateNavigationHandleForTesting(
+          GURL(), tab->GetMainFrame(), true);
   registry->MonitorWebContentsForRuleEvaluation(tab.get());
   evaluator->RequestImmediateEvaluation(tab.get(), true);
   EXPECT_EQ(1u, registry->GetActiveRulesCountForTesting());
 
   evaluator->RequestEvaluationOnNextOperation(tab.get(), false);
-  registry->DidNavigateMainFrame(tab.get(), content::LoadCommittedDetails(),
-                                 content::FrameNavigateParams());
+  registry->DidFinishNavigation(tab.get(), navigation_handle.get());
   EXPECT_EQ(0u, registry->GetActiveRulesCountForTesting());
 }
 
diff --git a/chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h b/chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h
index 283d418..dd1b86b 100644
--- a/chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h
+++ b/chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h
@@ -13,8 +13,7 @@
 
 namespace content {
 class BrowserContext;
-struct FrameNavigateParams;
-struct LoadCommittedDetails;
+class NavigationHandle;
 class WebContents;
 }  // namespace content
 
@@ -92,8 +91,7 @@
   // would still be evaluated based on the previous URL.
   virtual void OnWebContentsNavigation(
       content::WebContents* contents,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) = 0;
+      content::NavigationHandle* navigation_handle) = 0;
 
   // Returns true if |predicate| evaluates to true on the state associated with
   // |tab|. It must be the case that predicate->GetEvaluator() == this object,
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
index 82c25da..2f52275a 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.cc
@@ -14,7 +14,7 @@
 #include "chrome/browser/extensions/api/declarative_content/content_constants.h"
 #include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
 #include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_source.h"
 #include "content/public/browser/render_process_host.h"
@@ -98,9 +98,8 @@
 }
 
 void DeclarativeContentCssConditionTracker::PerWebContentsTracker::
-OnWebContentsNavigation(const content::LoadCommittedDetails& details,
-                        const content::FrameNavigateParams& params) {
-  if (details.is_in_page) {
+OnWebContentsNavigation(content::NavigationHandle* navigation_handle) {
+  if (navigation_handle->IsSamePage()) {
     // Within-page navigations don't change the set of elements that
     // exist, and we only support filtering on the top-level URL, so
     // this can't change which rules match.
@@ -232,10 +231,10 @@
 
 void DeclarativeContentCssConditionTracker::OnWebContentsNavigation(
     content::WebContents* contents,
-    const content::LoadCommittedDetails& details,
-    const content::FrameNavigateParams& params) {
+    content::NavigationHandle* navigation_handle) {
   DCHECK(base::ContainsKey(per_web_contents_tracker_, contents));
-  per_web_contents_tracker_[contents]->OnWebContentsNavigation(details, params);
+  per_web_contents_tracker_[contents]->OnWebContentsNavigation(
+      navigation_handle);
 }
 
 bool DeclarativeContentCssConditionTracker::EvaluatePredicate(
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
index bf0fc7b..e4845c1 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker.h
@@ -24,13 +24,6 @@
 class Value;
 }
 
-namespace content {
-struct FrameNavigateParams;
-struct LoadCommittedDetails;
-class RenderProcessHost;
-class WebContents;
-}
-
 namespace extensions {
 
 class Extension;
@@ -86,8 +79,7 @@
   void TrackForWebContents(content::WebContents* contents) override;
   void OnWebContentsNavigation(
       content::WebContents* contents,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override;
+      content::NavigationHandle* navigation_handle) override;
   bool EvaluatePredicate(const ContentPredicate* predicate,
                          content::WebContents* tab) const override;
 
@@ -106,8 +98,7 @@
         const WebContentsDestroyedCallback& web_contents_destroyed);
     ~PerWebContentsTracker() override;
 
-    void OnWebContentsNavigation(const content::LoadCommittedDetails& details,
-                                 const content::FrameNavigateParams& params);
+    void OnWebContentsNavigation(content::NavigationHandle* navigation_handle);
 
     const base::hash_set<std::string>& matching_css_selectors() const {
       return matching_css_selectors_;
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
index d183f57..3f6ee17 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
@@ -11,7 +11,7 @@
 #include "base/test/values_test_util.h"
 #include "chrome/browser/extensions/api/declarative_content/content_predicate_evaluator.h"
 #include "chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/test/mock_render_process_host.h"
 #include "extensions/common/extension_messages.h"
@@ -301,10 +301,10 @@
 
   // Check that an in-page navigation has no effect on the matching selectors.
   {
-    content::LoadCommittedDetails details;
-    details.is_in_page = true;
-    content::FrameNavigateParams params;
-    tracker_.OnWebContentsNavigation(tab.get(), details, params);
+    std::unique_ptr<content::NavigationHandle> navigation_handle =
+        content::NavigationHandle::CreateNavigationHandleForTesting(
+            GURL(), tab->GetMainFrame(), true, net::OK, true);
+    tracker_.OnWebContentsNavigation(tab.get(), navigation_handle.get());
     EXPECT_TRUE(tracker_.EvaluatePredicate(predicate.get(), tab.get()));
     EXPECT_EQ(expected_evaluation_requests, delegate_.evaluation_requests());
   }
@@ -312,10 +312,10 @@
   // Check that a non in-page navigation clears the matching selectors and
   // requests condition evaluation.
   {
-    content::LoadCommittedDetails details;
-    details.is_in_page = false;
-    content::FrameNavigateParams params;
-    tracker_.OnWebContentsNavigation(tab.get(), details, params);
+    std::unique_ptr<content::NavigationHandle> navigation_handle =
+        content::NavigationHandle::CreateNavigationHandleForTesting(
+            GURL(), tab->GetMainFrame(), true);
+    tracker_.OnWebContentsNavigation(tab.get(), navigation_handle.get());
     EXPECT_FALSE(tracker_.EvaluatePredicate(predicate.get(), tab.get()));
     EXPECT_EQ(++expected_evaluation_requests, delegate_.evaluation_requests());
   }
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
index 884a756..da63f2f 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.cc
@@ -200,8 +200,7 @@
 
 void DeclarativeContentIsBookmarkedConditionTracker::OnWebContentsNavigation(
     content::WebContents* contents,
-    const content::LoadCommittedDetails& details,
-    const content::FrameNavigateParams& params) {
+    content::NavigationHandle* navigation_handle) {
   DCHECK(base::ContainsKey(per_web_contents_tracker_, contents));
   per_web_contents_tracker_[contents]->UpdateState(true);
 }
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
index 88cc0806..e8307fc5 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker.h
@@ -22,13 +22,6 @@
 class Value;
 }
 
-namespace content {
-class BrowserContext;
-struct FrameNavigateParams;
-struct LoadCommittedDetails;
-class WebContents;
-}
-
 namespace extensions {
 
 // Tests the bookmarked state of the page.
@@ -89,8 +82,7 @@
   void TrackForWebContents(content::WebContents* contents) override;
   void OnWebContentsNavigation(
       content::WebContents* contents,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override;
+      content::NavigationHandle* navigation_handle) override;
   bool EvaluatePredicate(const ContentPredicate* predicate,
                          content::WebContents* tab) const override;
 
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
index 44fcb66..7e2218c 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
@@ -22,7 +22,7 @@
 #include "components/bookmarks/browser/scoped_group_bookmark_actions.h"
 #include "components/bookmarks/test/bookmark_test_helpers.h"
 #include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/web_contents.h"
 #include "extensions/common/extension.h"
 #include "extensions/common/extension_builder.h"
@@ -238,9 +238,10 @@
   // Navigate the first tab to a URL that we will bookmark.
   delegate_.evaluation_requests().clear();
   LoadURL(tabs[0].get(), GURL("http://bookmarked/"));
-  tracker_->OnWebContentsNavigation(tabs[0].get(),
-                                    content::LoadCommittedDetails(),
-                                    content::FrameNavigateParams());
+  std::unique_ptr<content::NavigationHandle> navigation_handle =
+      content::NavigationHandle::CreateNavigationHandleForTesting(
+          GURL(), tabs[0]->GetMainFrame(), true);
+  tracker_->OnWebContentsNavigation(tabs[0].get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tabs[0].get()));
   EXPECT_TRUE(CheckPredicates(tabs[0].get(), false));
@@ -283,9 +284,10 @@
   // Navigate the first tab to a URL that we will bookmark.
   delegate_.evaluation_requests().clear();
   LoadURL(tabs[0].get(), GURL("http://bookmarked/"));
-  tracker_->OnWebContentsNavigation(tabs[0].get(),
-                                    content::LoadCommittedDetails(),
-                                    content::FrameNavigateParams());
+  std::unique_ptr<content::NavigationHandle> navigation_handle =
+      content::NavigationHandle::CreateNavigationHandleForTesting(
+          GURL(), tabs[0]->GetMainFrame(), true);
+  tracker_->OnWebContentsNavigation(tabs[0].get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tabs[0].get()));
   EXPECT_TRUE(CheckPredicates(tabs[0].get(), false));
@@ -386,9 +388,10 @@
   // Navigate the first tab to one bookmarked URL.
   delegate_.evaluation_requests().clear();
   LoadURL(tabs[0].get(), GURL("http://bookmarked1/"));
-  tracker_->OnWebContentsNavigation(tabs[0].get(),
-                                    content::LoadCommittedDetails(),
-                                    content::FrameNavigateParams());
+  std::unique_ptr<content::NavigationHandle> navigation_handle =
+      content::NavigationHandle::CreateNavigationHandleForTesting(
+          GURL(), tabs[0]->GetMainFrame(), true);
+  tracker_->OnWebContentsNavigation(tabs[0].get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tabs[0].get()));
   EXPECT_TRUE(CheckPredicates(tabs[0].get(), true));
@@ -399,9 +402,7 @@
   // bookmarked state hasn't.
   delegate_.evaluation_requests().clear();
   LoadURL(tabs[0].get(), GURL("http://bookmarked2/"));
-  tracker_->OnWebContentsNavigation(tabs[0].get(),
-                                    content::LoadCommittedDetails(),
-                                    content::FrameNavigateParams());
+  tracker_->OnWebContentsNavigation(tabs[0].get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tabs[0].get()));
   EXPECT_TRUE(CheckPredicates(tabs[0].get(), true));
@@ -410,9 +411,7 @@
   // Navigate the first tab to a non-bookmarked URL.
   delegate_.evaluation_requests().clear();
   LoadURL(tabs[0].get(), GURL("http://not-bookmarked1/"));
-  tracker_->OnWebContentsNavigation(tabs[0].get(),
-                                    content::LoadCommittedDetails(),
-                                    content::FrameNavigateParams());
+  tracker_->OnWebContentsNavigation(tabs[0].get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tabs[0].get()));
   EXPECT_TRUE(CheckPredicates(tabs[0].get(), false));
@@ -423,9 +422,7 @@
   // bookmarked state hasn't.
   delegate_.evaluation_requests().clear();
   LoadURL(tabs[0].get(), GURL("http://not-bookmarked2/"));
-  tracker_->OnWebContentsNavigation(tabs[0].get(),
-                                    content::LoadCommittedDetails(),
-                                    content::FrameNavigateParams());
+  tracker_->OnWebContentsNavigation(tabs[0].get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tabs[0].get()));
   EXPECT_TRUE(CheckPredicates(tabs[0].get(), false));
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc
index e6271fe..ef185b0a 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.cc
@@ -192,8 +192,7 @@
 
 void DeclarativeContentPageUrlConditionTracker::OnWebContentsNavigation(
     content::WebContents* contents,
-    const content::LoadCommittedDetails& details,
-    const content::FrameNavigateParams& params) {
+    content::NavigationHandle* navigation_handle) {
   DCHECK(base::ContainsKey(per_web_contents_tracker_, contents));
   per_web_contents_tracker_[contents]->UpdateMatchesForCurrentUrl(true);
 }
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h
index e8226bd..82fe962 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker.h
@@ -20,12 +20,6 @@
 class Value;
 }
 
-namespace content {
-struct FrameNavigateParams;
-struct LoadCommittedDetails;
-class WebContents;
-}
-
 namespace extensions {
 
 class Extension;
@@ -85,8 +79,7 @@
   void TrackForWebContents(content::WebContents* contents) override;
   void OnWebContentsNavigation(
       content::WebContents* contents,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override;
+      content::NavigationHandle* navigation_handle) override;
   bool EvaluatePredicate(const ContentPredicate* predicate,
                          content::WebContents* tab) const override;
 
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
index a719121..88bcc92 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
@@ -15,7 +15,7 @@
 #include "chrome/browser/extensions/api/declarative_content/declarative_content_condition_tracker_test.h"
 #include "components/url_matcher/url_matcher.h"
 #include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/web_contents.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
@@ -252,8 +252,10 @@
   // evaluation request.
   LoadURL(tab.get(), GURL("http://test1/"));
   delegate_.evaluation_requests().clear();
-  tracker_.OnWebContentsNavigation(tab.get(), content::LoadCommittedDetails(),
-                                  content::FrameNavigateParams());
+  std::unique_ptr<content::NavigationHandle> navigation_handle =
+      content::NavigationHandle::CreateNavigationHandleForTesting(
+          GURL(), tab->GetMainFrame(), true);
+  tracker_.OnWebContentsNavigation(tab.get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tab.get()));
 
@@ -261,8 +263,7 @@
   // URL results in an evaluation request.
   LoadURL(tab.get(), GURL("http://test1/a"));
   delegate_.evaluation_requests().clear();
-  tracker_.OnWebContentsNavigation(tab.get(), content::LoadCommittedDetails(),
-                                  content::FrameNavigateParams());
+  tracker_.OnWebContentsNavigation(tab.get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tab.get()));
 
@@ -270,8 +271,7 @@
   // URL results in an evaluation request.
   delegate_.evaluation_requests().clear();
   LoadURL(tab.get(), GURL("http://test2/"));
-  tracker_.OnWebContentsNavigation(tab.get(), content::LoadCommittedDetails(),
-                                  content::FrameNavigateParams());
+  tracker_.OnWebContentsNavigation(tab.get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tab.get()));
 
@@ -279,8 +279,7 @@
   // non-matching URL results in an evaluation request.
   delegate_.evaluation_requests().clear();
   LoadURL(tab.get(), GURL("http://test2/a"));
-  tracker_.OnWebContentsNavigation(tab.get(), content::LoadCommittedDetails(),
-                                  content::FrameNavigateParams());
+  tracker_.OnWebContentsNavigation(tab.get(), navigation_handle.get());
   EXPECT_THAT(delegate_.evaluation_requests(),
               UnorderedElementsAre(tab.get()));
 
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc
index 47188646..a6352bd 100644
--- a/chrome/browser/extensions/tab_helper.cc
+++ b/chrome/browser/extensions/tab_helper.cc
@@ -40,8 +40,8 @@
 #include "chrome/common/url_constants.h"
 #include "content/public/browser/invalidate_type.h"
 #include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/navigation_details.h"
 #include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_source.h"
 #include "content/public/browser/notification_types.h"
@@ -316,12 +316,14 @@
   SetTabId(host);
 }
 
-void TabHelper::DidNavigateMainFrame(
-    const content::LoadCommittedDetails& details,
-    const content::FrameNavigateParams& params) {
+void TabHelper::DidFinishNavigation(
+    content::NavigationHandle* navigation_handle) {
+  if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
+    return;
+
   InvokeForContentRulesRegistries(
-      [this, &details, &params](ContentRulesRegistry* registry) {
-    registry->DidNavigateMainFrame(web_contents(), details, params);
+      [this, navigation_handle](ContentRulesRegistry* registry) {
+    registry->DidFinishNavigation(web_contents(), navigation_handle);
   });
 
   content::BrowserContext* context = web_contents()->GetBrowserContext();
@@ -338,14 +340,15 @@
         SetExtensionApp(extension);
     } else {
       UpdateExtensionAppIcon(
-          enabled_extensions.GetExtensionOrAppByURL(params.url));
+          enabled_extensions.GetExtensionOrAppByURL(
+              navigation_handle->GetURL()));
     }
   } else {
     UpdateExtensionAppIcon(
-        enabled_extensions.GetExtensionOrAppByURL(params.url));
+        enabled_extensions.GetExtensionOrAppByURL(navigation_handle->GetURL()));
   }
 
-  if (!details.is_in_page)
+  if (!navigation_handle->IsSamePage())
     ExtensionActionAPI::Get(context)->ClearAllValuesForTab(web_contents());
 }
 
diff --git a/chrome/browser/extensions/tab_helper.h b/chrome/browser/extensions/tab_helper.h
index 3079485..7e35391 100644
--- a/chrome/browser/extensions/tab_helper.h
+++ b/chrome/browser/extensions/tab_helper.h
@@ -30,11 +30,6 @@
 #include "extensions/common/stack_frame.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 
-namespace content {
-struct LoadCommittedDetails;
-class RenderFrameHost;
-}
-
 namespace gfx {
 class Image;
 }
@@ -149,9 +144,8 @@
 
   // content::WebContentsObserver overrides.
   void RenderFrameCreated(content::RenderFrameHost* host) override;
-  void DidNavigateMainFrame(
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override;
+  void DidFinishNavigation(
+      content::NavigationHandle* navigation_handle) override;
   bool OnMessageReceived(const IPC::Message& message) override;
   bool OnMessageReceived(const IPC::Message& message,
                          content::RenderFrameHost* render_frame_host) override;
diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc
index 2491fef..cb0ffcc 100644
--- a/chrome/browser/printing/print_dialog_cloud.cc
+++ b/chrome/browser/printing/print_dialog_cloud.cc
@@ -17,6 +17,7 @@
 #include "components/signin/core/browser/signin_metrics.h"
 #include "components/signin/core/common/profile_management_switches.h"
 #include "content/public/browser/browser_thread.h"
+#include "content/public/browser/navigation_handle.h"
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_observer.h"
 
@@ -35,10 +36,14 @@
 
  private:
   // Overridden from content::WebContentsObserver:
-  void DidNavigateMainFrame(
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override {
-    if (cloud_devices::IsCloudPrintURL(params.url)) {
+  void DidFinishNavigation(
+      content::NavigationHandle* navigation_handle) override {
+    if (!navigation_handle->IsInMainFrame() ||
+        !navigation_handle->HasCommitted()) {
+      return;
+    }
+
+    if (cloud_devices::IsCloudPrintURL(navigation_handle->GetURL())) {
       base::ThreadTaskRunnerHandle::Get()->PostTask(
           FROM_HERE, base::Bind(&SignInObserver::OnSignIn,
                                 weak_ptr_factory_.GetWeakPtr()));
diff --git a/chrome/browser/resources/md_bookmarks/item.html b/chrome/browser/resources/md_bookmarks/item.html
index 56a27dc6..a00cb8f 100644
--- a/chrome/browser/resources/md_bookmarks/item.html
+++ b/chrome/browser/resources/md_bookmarks/item.html
@@ -16,10 +16,6 @@
         height: 40px;
       }
 
-      :host(:not(:last-of-type)) {
-        border-bottom: var(--cr-separator-line);
-      }
-
       #website-title {
         color: var(--primary-text-color);
         cursor: pointer;
diff --git a/chrome/browser/resources/md_bookmarks/shared_vars.html b/chrome/browser/resources/md_bookmarks/shared_vars.html
index 1889a0e..efae3f43 100644
--- a/chrome/browser/resources/md_bookmarks/shared_vars.html
+++ b/chrome/browser/resources/md_bookmarks/shared_vars.html
@@ -1,5 +1,3 @@
-<link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html">
-
 <style is="custom-style">
   :root {
     --card-max-width: 960px;
diff --git a/chrome/browser/resources/settings/languages_page/languages_page.html b/chrome/browser/resources/settings/languages_page/languages_page.html
index 9a9d646..9ceaba4 100644
--- a/chrome/browser/resources/settings/languages_page/languages_page.html
+++ b/chrome/browser/resources/settings/languages_page/languages_page.html
@@ -87,16 +87,16 @@
           </cr-expand-button>
         </div>
         <iron-collapse id="languagesCollapse" opened="[[languagesOpened_]]">
-          <div class="list-frame vertical-list">
-            <span class="list-item"
-                hidden="[[isHelpTextHidden_(languages.enabled.*)]]">
-              <span>$i18n{orderLanguagesInstructions}</span>
+          <span class="settings-box first"
+              hidden="[[isHelpTextHidden_(languages.enabled.*)]]">
+            <span>$i18n{orderLanguagesInstructions}</span>
 <if expr="chromeos">
-              <a href="$i18n{languagesLearnMoreURL}" target="_blank">
-                $i18n{learnMore}
-              </a>
+            <a href="$i18n{languagesLearnMoreURL}" target="_blank">
+              $i18n{learnMore}
+            </a>
 </if>
-            </span>
+          </span>
+          <div class="list-frame vertical-list">
             <template is="dom-repeat" items="[[languages.enabled]]">
               <div class$="list-item [[getLanguageItemClass_(
                   item.language.code, language.prospectiveUILanguage)]]">
@@ -133,6 +133,12 @@
               </a>
             </div>
           </div>
+          <div class="settings-box first">
+            <settings-toggle-button id="offerTranslateOtherLangs" class="start"
+                pref="{{prefs.translate.enabled}}"
+                label="$i18n{offerToEnableTranslate}">
+            </settings-toggle-button>
+          </div>
         </iron-collapse>
 <if expr="chromeos">
         <div id="manageInputMethodsSubpageTrigger"
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service.cc b/chrome/browser/safe_browsing/certificate_reporting_service.cc
index ad70493..7c013f5 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_service.cc
@@ -21,7 +21,8 @@
 // a client seeing an invalid cert might not be able to make an HTTPS connection
 // to report it.
 const char kExtendedReportingUploadUrl[] =
-    "http://safebrowsing.googleusercontent.com/safebrowsing/clientreport/";
+    "http://safebrowsing.googleusercontent.com/safebrowsing/clientreport/"
+    "chrome-certs";
 
 // Compare function that orders Reports in reverse chronological order (i.e.
 // oldest item is last).
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index 1dfefce..40f5ef4 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -113,7 +113,7 @@
   ~MockSubresourceFilterDriver() override = default;
 
   MOCK_METHOD3(ActivateForProvisionalLoad,
-               void(subresource_filter::ActivationState, const GURL&, bool));
+               void(subresource_filter::ActivationLevel, const GURL&, bool));
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockSubresourceFilterDriver);
@@ -938,7 +938,7 @@
   subresource_filter::testing::ScopedSubresourceFilterFeatureToggle
       scoped_feature_toggle(
           base::FeatureList::OVERRIDE_ENABLE_FEATURE,
-          subresource_filter::kActivationStateEnabled,
+          subresource_filter::kActivationLevelEnabled,
           subresource_filter::kActivationScopeActivationList,
           subresource_filter::kActivationListSocialEngineeringAdsInterstitial);
   // Tests that when Safe Browsing gets hit which is corresponding to the
@@ -985,7 +985,7 @@
   subresource_filter::testing::ScopedSubresourceFilterFeatureToggle
       scoped_feature_toggle(
           base::FeatureList::OVERRIDE_ENABLE_FEATURE,
-          subresource_filter::kActivationStateEnabled,
+          subresource_filter::kActivationLevelEnabled,
           subresource_filter::kActivationScopeNoSites,
           subresource_filter::kActivationListSocialEngineeringAdsInterstitial);
 
diff --git a/chrome/browser/safe_browsing/ui_manager_unittest.cc b/chrome/browser/safe_browsing/ui_manager_unittest.cc
index 30b7cf8..b652b91 100644
--- a/chrome/browser/safe_browsing/ui_manager_unittest.cc
+++ b/chrome/browser/safe_browsing/ui_manager_unittest.cc
@@ -12,6 +12,7 @@
 #include "chrome/test/base/testing_profile.h"
 #include "components/safe_browsing_db/safe_browsing_prefs.h"
 #include "components/safe_browsing_db/util.h"
+#include "components/security_interstitials/core/safe_browsing_error_ui.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_view_host.h"
@@ -343,7 +344,13 @@
             web_contents,
             main_frame_url,
             unsafe_resources,
-            BaseBlockingPage::CreateDefaultDisplayOptions(unsafe_resources)) {
+            SafeBrowsingErrorUI::SBErrorDisplayOptions(
+                BaseBlockingPage::IsMainPageLoadBlocked(unsafe_resources),
+                false,
+                false,
+                false,
+                false,
+                false)) {
     // Don't delay details at all for the unittest.
     threat_details_proceed_delay_ms_ = 0;
     DontCreateViewForTesting();
diff --git a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
index 44d5dd8..5eb1a17 100644
--- a/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
+++ b/chrome/browser/subresource_filter/subresource_filter_browsertest.cc
@@ -29,7 +29,7 @@
 #include "components/security_interstitials/content/unsafe_resource.h"
 #include "components/subresource_filter/core/browser/subresource_filter_features.h"
 #include "components/subresource_filter/core/browser/subresource_filter_features_test_support.h"
-#include "components/subresource_filter/core/common/activation_state.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 #include "components/subresource_filter/core/common/scoped_timers.h"
 #include "components/subresource_filter/core/common/test_ruleset_utils.h"
 #include "content/public/browser/browser_thread.h"
@@ -52,8 +52,8 @@
     "subresource_filter/frame_set.html";
 
 // Names of DocumentLoad histograms.
-constexpr const char kDocumentLoadActivationState[] =
-    "SubresourceFilter.DocumentLoad.ActivationState";
+constexpr const char kDocumentLoadActivationLevel[] =
+    "SubresourceFilter.DocumentLoad.ActivationLevel";
 constexpr const char kSubresourceLoadsTotal[] =
     "SubresourceFilter.DocumentLoad.NumSubresourceLoads.Total";
 constexpr const char kSubresourceLoadsEvaluated[] =
@@ -232,7 +232,7 @@
 
   void SetUpOnMainThread() override {
     scoped_feature_toggle_.reset(new ScopedSubresourceFilterFeatureToggle(
-        base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+        base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
         kActivationScopeActivationList, kActivationListPhishingInterstitial,
         measure_performance_ ? "1" : "0"));
 
@@ -545,8 +545,8 @@
   // The only frames where filtering was (even considered to be) activated
   // should be the main frame, and the child that was navigated to an HTTP URL.
   histogram_tester.ExpectUniqueSample(
-      "SubresourceFilter.DocumentLoad.ActivationState",
-      static_cast<base::Histogram::Sample>(ActivationState::ENABLED), 2);
+      "SubresourceFilter.DocumentLoad.ActivationLevel",
+      static_cast<base::Histogram::Sample>(ActivationLevel::ENABLED), 2);
 }
 
 IN_PROC_BROWSER_TEST_F(SubresourceFilterBrowserTest,
@@ -640,8 +640,8 @@
   tester.ExpectTotalCount(kActivationCPUDuration, 6);
 
   tester.ExpectUniqueSample(
-      kDocumentLoadActivationState,
-      static_cast<base::Histogram::Sample>(ActivationState::ENABLED), 6);
+      kDocumentLoadActivationLevel,
+      static_cast<base::Histogram::Sample>(ActivationLevel::ENABLED), 6);
 
   EXPECT_THAT(tester.GetAllSamples(kSubresourceLoadsTotal),
               ::testing::ElementsAre(base::Bucket(0, 3), base::Bucket(2, 3)));
@@ -722,8 +722,8 @@
 
   // Although SubresourceFilterAgents still record the activation decision.
   tester.ExpectUniqueSample(
-      kDocumentLoadActivationState,
-      static_cast<base::Histogram::Sample>(ActivationState::DISABLED), 6);
+      kDocumentLoadActivationLevel,
+      static_cast<base::Histogram::Sample>(ActivationLevel::DISABLED), 6);
 }
 
 }  // namespace subresource_filter
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index 1c7d649..c8db967b 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -48,7 +48,7 @@
 // theme packs that aren't int-equal to this. Increment this number if you
 // change default theme assets or if you need themes to recreate their generated
 // images (which are cached).
-const int kThemePackVersion = 45;
+const int kThemePackVersion = 46;
 
 // IDs that are in the DataPack won't clash with the positive integer
 // uint16_t. kHeaderID should always have the maximum value because we want the
@@ -235,13 +235,7 @@
   { "ntp_background", ThemeProperties::COLOR_NTP_BACKGROUND },
   { "ntp_text", ThemeProperties::COLOR_NTP_TEXT },
   { "ntp_link", ThemeProperties::COLOR_NTP_LINK },
-  { "ntp_link_underline", ThemeProperties::COLOR_NTP_LINK_UNDERLINE },
   { "ntp_header", ThemeProperties::COLOR_NTP_HEADER },
-  { "ntp_section", ThemeProperties::COLOR_NTP_SECTION },
-  { "ntp_section_text", ThemeProperties::COLOR_NTP_SECTION_TEXT },
-  { "ntp_section_link", ThemeProperties::COLOR_NTP_SECTION_LINK },
-  { "ntp_section_link_underline",
-    ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE },
   { "button_background", ThemeProperties::COLOR_BUTTON_BACKGROUND },
 };
 const size_t kColorTableLength = arraysize(kColorTable);
@@ -969,9 +963,16 @@
           color = SkColorSetRGB(r, g, b);
         }
 
-        int id = GetIntForString(iter.key(), kColorTable, kColorTableLength);
-        if (id != -1) {
-          (*temp_colors)[id] = color;
+        if (iter.key() == "ntp_section") {
+          // We no longer use ntp_section, but to support legacy
+          // themes we still need to use it as a fallback for
+          // ntp_header.
+          if (!temp_colors->count(ThemeProperties::COLOR_NTP_HEADER))
+            (*temp_colors)[ThemeProperties::COLOR_NTP_HEADER] = color;
+        } else {
+          int id = GetIntForString(iter.key(), kColorTable, kColorTableLength);
+          if (id != -1)
+            (*temp_colors)[id] = color;
         }
       }
     }
@@ -980,28 +981,6 @@
 
 void BrowserThemePack::GenerateMissingColors(
     std::map<int, SkColor>* colors) {
-  // Generate link colors, if missing. (See GetColor()).
-  if (!colors->count(ThemeProperties::COLOR_NTP_HEADER) &&
-      colors->count(ThemeProperties::COLOR_NTP_SECTION)) {
-    (*colors)[ThemeProperties::COLOR_NTP_HEADER] =
-        (*colors)[ThemeProperties::COLOR_NTP_SECTION];
-  }
-
-  if (!colors->count(ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE) &&
-      colors->count(ThemeProperties::COLOR_NTP_SECTION_LINK)) {
-    SkColor color_section_link =
-        (*colors)[ThemeProperties::COLOR_NTP_SECTION_LINK];
-    (*colors)[ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE] =
-        SkColorSetA(color_section_link, SkColorGetA(color_section_link) / 3);
-  }
-
-  if (!colors->count(ThemeProperties::COLOR_NTP_LINK_UNDERLINE) &&
-      colors->count(ThemeProperties::COLOR_NTP_LINK)) {
-    SkColor color_link = (*colors)[ThemeProperties::COLOR_NTP_LINK];
-    (*colors)[ThemeProperties::COLOR_NTP_LINK_UNDERLINE] =
-        SkColorSetA(color_link, SkColorGetA(color_link) / 3);
-  }
-
   // Generate frame colors, if missing. (See GenerateFrameColors()).
   SkColor frame;
   std::map<int, SkColor>::const_iterator it =
diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc
index f31dc4e..a2dd82f 100644
--- a/chrome/browser/themes/browser_theme_pack_unittest.cc
+++ b/chrome/browser/themes/browser_theme_pack_unittest.cc
@@ -370,47 +370,11 @@
   scoped_refptr<BrowserThemePack> theme_pack_;
 };
 
-
-TEST_F(BrowserThemePackTest, DeriveUnderlineLinkColor) {
-  // If we specify a link color, but don't specify the underline color, the
-  // theme provider should create one.
-  std::string color_json = "{ \"ntp_link\": [128, 128, 128],"
-                           "  \"ntp_section_link\": [128, 128, 128] }";
-  LoadColorJSON(color_json);
-
-  std::map<int, SkColor> colors = GetDefaultColorMap();
-  SkColor link_color = SkColorSetRGB(128, 128, 128);
-  colors[ThemeProperties::COLOR_NTP_LINK] = link_color;
-  colors[ThemeProperties::COLOR_NTP_LINK_UNDERLINE] =
-      BuildThirdOpacity(link_color);
-  colors[ThemeProperties::COLOR_NTP_SECTION_LINK] = link_color;
-  colors[ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE] =
-      BuildThirdOpacity(link_color);
-
-  VerifyColorMap(colors);
-}
-
-TEST_F(BrowserThemePackTest, ProvideUnderlineLinkColor) {
-  // If we specify the underline color, it shouldn't try to generate one.
-  std::string color_json = "{ \"ntp_link\": [128, 128, 128],"
-                           "  \"ntp_link_underline\": [255, 255, 255],"
-                           "  \"ntp_section_link\": [128, 128, 128],"
-                           "  \"ntp_section_link_underline\": [255, 255, 255]"
-                           "}";
-  LoadColorJSON(color_json);
-
-  std::map<int, SkColor> colors = GetDefaultColorMap();
-  SkColor link_color = SkColorSetRGB(128, 128, 128);
-  SkColor underline_color = SkColorSetRGB(255, 255, 255);
-  colors[ThemeProperties::COLOR_NTP_LINK] = link_color;
-  colors[ThemeProperties::COLOR_NTP_LINK_UNDERLINE] = underline_color;
-  colors[ThemeProperties::COLOR_NTP_SECTION_LINK] = link_color;
-  colors[ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE] =
-      underline_color;
-
-  VerifyColorMap(colors);
-}
-
+// 'ntp_section' used to correspond to ThemeProperties::COLOR_NTP_SECTION,
+// but COLOR_NTP_SECTION was since removed because it was never used.
+// While it was in use, COLOR_NTP_HEADER used 'ntp_section' as a fallback when
+// 'ntp_header' was absent.  We still preserve this fallback for themes that
+// relied on this.
 TEST_F(BrowserThemePackTest, UseSectionColorAsNTPHeader) {
   std::string color_json = "{ \"ntp_section\": [190, 190, 190] }";
   LoadColorJSON(color_json);
@@ -418,7 +382,6 @@
   std::map<int, SkColor> colors = GetDefaultColorMap();
   SkColor ntp_color = SkColorSetRGB(190, 190, 190);
   colors[ThemeProperties::COLOR_NTP_HEADER] = ntp_color;
-  colors[ThemeProperties::COLOR_NTP_SECTION] = ntp_color;
   VerifyColorMap(colors);
 }
 
@@ -429,7 +392,6 @@
 
   std::map<int, SkColor> colors = GetDefaultColorMap();
   colors[ThemeProperties::COLOR_NTP_HEADER] = SkColorSetRGB(120, 120, 120);
-  colors[ThemeProperties::COLOR_NTP_SECTION] = SkColorSetRGB(190, 190, 190);
   VerifyColorMap(colors);
 }
 
diff --git a/chrome/browser/themes/theme_properties.cc b/chrome/browser/themes/theme_properties.cc
index 3d09033..dd1d9f4e 100644
--- a/chrome/browser/themes/theme_properties.cc
+++ b/chrome/browser/themes/theme_properties.cc
@@ -66,9 +66,6 @@
 #endif  // OS_WIN
 
 const SkColor kDefaultColorNTPHeader = SkColorSetRGB(0x96, 0x96, 0x96);
-const SkColor kDefaultColorNTPSection = SkColorSetRGB(0xE5, 0xE5, 0xE5);
-constexpr SkColor kDefaultColorNTPSectionText = SK_ColorBLACK;
-const SkColor kDefaultColorNTPSectionLink = SkColorSetRGB(0x06, 0x37, 0x74);
 constexpr SkColor kDefaultColorButtonBackground = SK_ColorTRANSPARENT;
 
 // Default tints.
@@ -132,10 +129,6 @@
 constexpr char kTilingRepeatY[] = "repeat-y";
 constexpr char kTilingRepeat[] = "repeat";
 
-SkColor TintForUnderline(SkColor input) {
-  return SkColorSetA(input, SkColorGetA(input) / 3);
-}
-
 }  // namespace
 
 // static
@@ -249,18 +242,8 @@
       return kDefaultColorNTPText;
     case COLOR_NTP_LINK:
       return kDefaultColorNTPLink;
-    case COLOR_NTP_LINK_UNDERLINE:
-      return TintForUnderline(kDefaultColorNTPLink);
     case COLOR_NTP_HEADER:
       return kDefaultColorNTPHeader;
-    case COLOR_NTP_SECTION:
-      return kDefaultColorNTPSection;
-    case COLOR_NTP_SECTION_TEXT:
-      return kDefaultColorNTPSectionText;
-    case COLOR_NTP_SECTION_LINK:
-      return kDefaultColorNTPSectionLink;
-    case COLOR_NTP_SECTION_LINK_UNDERLINE:
-      return TintForUnderline(kDefaultColorNTPSectionLink);
     case COLOR_BUTTON_BACKGROUND:
       return kDefaultColorButtonBackground;
 
diff --git a/chrome/browser/themes/theme_properties.h b/chrome/browser/themes/theme_properties.h
index 573d8590..3e328d7 100644
--- a/chrome/browser/themes/theme_properties.h
+++ b/chrome/browser/themes/theme_properties.h
@@ -40,12 +40,7 @@
     COLOR_NTP_BACKGROUND,
     COLOR_NTP_TEXT,
     COLOR_NTP_LINK,
-    COLOR_NTP_LINK_UNDERLINE,
     COLOR_NTP_HEADER,
-    COLOR_NTP_SECTION,
-    COLOR_NTP_SECTION_TEXT,
-    COLOR_NTP_SECTION_LINK,
-    COLOR_NTP_SECTION_LINK_UNDERLINE,
     COLOR_BUTTON_BACKGROUND,
 
     TINT_BUTTONS,
@@ -124,10 +119,6 @@
 
     // These colors don't have constant default values. They are derived from
     // the runtime value of other colors.
-    COLOR_NTP_SECTION_HEADER_TEXT,
-    COLOR_NTP_SECTION_HEADER_TEXT_HOVER,
-    COLOR_NTP_SECTION_HEADER_RULE,
-    COLOR_NTP_SECTION_HEADER_RULE_LIGHT,
     COLOR_NTP_TEXT_LIGHT,
 #if BUILDFLAG(ENABLE_SUPERVISED_USERS)
     COLOR_SUPERVISED_USER_LABEL,
diff --git a/chrome/browser/themes/theme_service.cc b/chrome/browser/themes/theme_service.cc
index 9f5b82a..8c8103e 100644
--- a/chrome/browser/themes/theme_service.cc
+++ b/chrome/browser/themes/theme_service.cc
@@ -487,14 +487,6 @@
       // Use 50% of bookmark text color as separator color.
       return SkColorSetA(
           GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT, incognito), 128);
-    case ThemeProperties::COLOR_NTP_SECTION_HEADER_TEXT:
-      return IncreaseLightness(GetColor(kNtpText, incognito), 0.30);
-    case ThemeProperties::COLOR_NTP_SECTION_HEADER_TEXT_HOVER:
-      return GetColor(kNtpText, incognito);
-    case ThemeProperties::COLOR_NTP_SECTION_HEADER_RULE:
-      return IncreaseLightness(GetColor(kNtpText, incognito), 0.70);
-    case ThemeProperties::COLOR_NTP_SECTION_HEADER_RULE_LIGHT:
-      return IncreaseLightness(GetColor(kNtpText, incognito), 0.86);
     case ThemeProperties::COLOR_NTP_TEXT_LIGHT:
       return IncreaseLightness(GetColor(kNtpText, incognito), 0.40);
     case ThemeProperties::COLOR_TAB_THROBBER_SPINNING:
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 35f819a6..414c959 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -396,6 +396,14 @@
     "webui/predictors/predictors_ui.h",
     "webui/profiler_ui.cc",
     "webui/profiler_ui.h",
+    "webui/quota_internals/quota_internals_handler.cc",
+    "webui/quota_internals/quota_internals_handler.h",
+    "webui/quota_internals/quota_internals_proxy.cc",
+    "webui/quota_internals/quota_internals_proxy.h",
+    "webui/quota_internals/quota_internals_types.cc",
+    "webui/quota_internals/quota_internals_types.h",
+    "webui/quota_internals/quota_internals_ui.cc",
+    "webui/quota_internals/quota_internals_ui.h",
     "webui/signin_internals_ui.cc",
     "webui/signin_internals_ui.h",
     "webui/supervised_user_internals_message_handler.cc",
@@ -1065,14 +1073,6 @@
       "webui/profile_helper.h",
       "webui/profile_info_watcher.cc",
       "webui/profile_info_watcher.h",
-      "webui/quota_internals/quota_internals_handler.cc",
-      "webui/quota_internals/quota_internals_handler.h",
-      "webui/quota_internals/quota_internals_proxy.cc",
-      "webui/quota_internals/quota_internals_proxy.h",
-      "webui/quota_internals/quota_internals_types.cc",
-      "webui/quota_internals/quota_internals_types.h",
-      "webui/quota_internals/quota_internals_ui.cc",
-      "webui/quota_internals/quota_internals_ui.h",
       "webui/set_as_default_browser_ui_win.cc",
       "webui/set_as_default_browser_ui_win.h",
       "webui/settings/about_handler.cc",
@@ -1761,8 +1761,6 @@
         "views/location_bar/location_bar_view.h",
         "views/location_bar/location_icon_view.cc",
         "views/location_bar/location_icon_view.h",
-        "views/location_bar/open_pdf_in_reader_view.cc",
-        "views/location_bar/open_pdf_in_reader_view.h",
         "views/location_bar/page_action_image_view.cc",
         "views/location_bar/page_action_image_view.h",
         "views/location_bar/page_action_with_badge_view.cc",
@@ -1781,8 +1779,6 @@
         "views/omnibox/omnibox_result_view.h",
         "views/omnibox/omnibox_view_views.cc",
         "views/omnibox/omnibox_view_views.h",
-        "views/open_pdf_in_reader_bubble_view.cc",
-        "views/open_pdf_in_reader_bubble_view.h",
         "views/outdated_upgrade_bubble_view.cc",
         "views/outdated_upgrade_bubble_view.h",
         "views/passwords/account_chooser_dialog_view.cc",
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
index abb965ba..58d8413 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h
@@ -70,7 +70,6 @@
   void UpdateLocationBarVisibility(bool visible, bool animate) override;
   bool ShowPageActionPopup(const extensions::Extension* extension,
                            bool grant_active_tab) override;
-  void UpdateOpenPDFInReaderPrompt() override;
   void SaveStateToContents(content::WebContents* contents) override;
   void Revert() override;
   const OmniboxView* GetOmniboxView() const override;
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index 429101a6..5c4a91e 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -256,10 +256,6 @@
   return false;
 }
 
-void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() {
-  // Not implemented on Mac.
-}
-
 void LocationBarViewMac::SaveStateToContents(WebContents* contents) {
   // TODO(shess): Why SaveStateToContents vs SaveStateToTab?
   omnibox_view_->SaveStateToTab(contents);
diff --git a/chrome/browser/ui/extensions/extension_action_view_controller.cc b/chrome/browser/ui/extensions/extension_action_view_controller.cc
index ccefa92d..7ce2454 100644
--- a/chrome/browser/ui/extensions/extension_action_view_controller.cc
+++ b/chrome/browser/ui/extensions/extension_action_view_controller.cc
@@ -155,7 +155,7 @@
 }
 
 ui::MenuModel* ExtensionActionViewController::GetContextMenu() {
-  if (!ExtensionIsValid() || !extension()->ShowConfigureContextMenus())
+  if (!ExtensionIsValid())
     return nullptr;
 
   extensions::ExtensionContextMenuModel::ButtonVisibility visibility =
diff --git a/chrome/browser/ui/location_bar/location_bar.h b/chrome/browser/ui/location_bar/location_bar.h
index ad2b220..f566d39 100644
--- a/chrome/browser/ui/location_bar/location_bar.h
+++ b/chrome/browser/ui/location_bar/location_bar.h
@@ -76,9 +76,6 @@
   virtual bool ShowPageActionPopup(const extensions::Extension* extension,
                                    bool grant_active_tab) = 0;
 
-  // Updates the state of the button to open a PDF in Adobe Reader.
-  virtual void UpdateOpenPDFInReaderPrompt() = 0;
-
   // Saves the state of the location bar to the specified WebContents, so that
   // it can be restored later. (Done when switching tabs).
   virtual void SaveStateToContents(content::WebContents* contents) = 0;
diff --git a/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.cc b/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.cc
index 2fedeac..a478c9b 100644
--- a/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.cc
+++ b/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.cc
@@ -7,8 +7,6 @@
 #include "chrome/browser/download/download_stats.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_finder.h"
-#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/location_bar/location_bar.h"
 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
 
@@ -33,23 +31,6 @@
 ChromePDFWebContentsHelperClient::~ChromePDFWebContentsHelperClient() {
 }
 
-void ChromePDFWebContentsHelperClient::UpdateLocationBar(
-    content::WebContents* contents) {
-  Browser* browser = chrome::FindBrowserWithWebContents(contents);
-  if (!browser)
-    return;
-
-  BrowserWindow* window = browser->window();
-  if (!window)
-    return;
-
-  LocationBar* location_bar = window->GetLocationBar();
-  if (!location_bar)
-    return;
-
-  location_bar->UpdateOpenPDFInReaderPrompt();
-}
-
 void ChromePDFWebContentsHelperClient::UpdateContentRestrictions(
     content::WebContents* contents,
     int content_restrictions) {
diff --git a/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h b/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h
index 9d1df6d..96192cf 100644
--- a/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h
+++ b/chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h
@@ -16,8 +16,6 @@
 
  private:
   // pdf::PDFWebContentsHelperClient:
-  void UpdateLocationBar(content::WebContents* contents) override;
-
   void UpdateContentRestrictions(content::WebContents* contents,
                                  int content_restrictions) override;
 
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index 1a36534..4735f87 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -11,6 +11,7 @@
 #include "ash/common/frame/default_header_painter.h"
 #include "ash/common/frame/frame_border_hit_test.h"
 #include "ash/common/frame/header_painter_util.h"
+#include "ash/common/material_design/material_design_controller.h"
 #include "ash/common/wm_lookup.h"
 #include "ash/common/wm_shell.h"
 #include "ash/common/wm_window.h"
@@ -262,8 +263,15 @@
   header_painter_->LayoutHeader();
 
   int painted_height = GetTopInset(false);
-  if (browser_view()->IsTabStripVisible())
-    painted_height += browser_view()->tabstrip()->GetPreferredSize().height();
+  if (browser_view()->IsTabStripVisible()) {
+    const ImmersiveModeController* const immersive_controller =
+        browser_view()->immersive_mode_controller();
+    if (!immersive_controller->IsEnabled() ||
+        immersive_controller->IsRevealed() ||
+        !ash::MaterialDesignController::IsImmersiveModeMaterial()) {
+      painted_height += browser_view()->tabstrip()->GetPreferredSize().height();
+    }
+  }
 
   header_painter_->SetHeaderHeightForPainting(painted_height);
 
@@ -384,6 +392,9 @@
 }
 
 bool BrowserNonClientFrameViewAsh::UseImmersiveLightbarHeaderStyle() const {
+  if (ash::MaterialDesignController::IsImmersiveModeMaterial())
+    return false;
+
   const ImmersiveModeController* const immersive_controller =
       browser_view()->immersive_mode_controller();
   return immersive_controller->IsEnabled() &&
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index 3b3b4dd..9bca895b 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -147,13 +147,13 @@
 #include "ui/views/widget/widget.h"
 #include "ui/views/window/dialog_delegate.h"
 
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/ui/ash/ash_util.h"
+#endif  // defined(OS_CHROMEOS)
+
 #if !defined(OS_CHROMEOS)
 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
-#endif
-
-#if defined(USE_ASH)
-#include "chrome/browser/ui/ash/ash_util.h"
-#endif
+#endif  // !defined(OS_CHROMEOS)
 
 #if defined(USE_AURA)
 #include "ui/aura/client/window_parenting_client.h"
@@ -526,11 +526,6 @@
 }
 
 bool BrowserView::IsTabStripVisible() const {
-  if (immersive_mode_controller_->ShouldHideTopViews() &&
-      immersive_mode_controller_->ShouldHideTabIndicators()) {
-    return false;
-  }
-
   // Return false if this window does not normally display a tabstrip.
   if (!browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP))
     return false;
@@ -593,10 +588,10 @@
 // BrowserView, BrowserWindow implementation:
 
 void BrowserView::Show() {
-#if !defined(OS_WIN) && !defined(USE_ASH)
+#if !defined(OS_WIN) && !defined(OS_CHROMEOS)
   // The Browser associated with this browser window must become the active
   // browser at the time |Show()| is called. This is the natural behavior under
-  // Windows and Ash, but other platforms will not trigger
+  // Windows and Chrome OS, but other platforms will not trigger
   // OnWidgetActivationChanged() until we return to the runloop. Therefore any
   // calls to Browser::GetLastActive() will return the wrong result if we do not
   // explicitly set it here.
@@ -992,12 +987,11 @@
 }
 
 void BrowserView::SetFocusToLocationBar(bool select_all) {
-  // On Windows, changing focus to the location bar causes the browser
-  // window to become active. This can steal focus if the user has
-  // another window open already. On ChromeOS, changing focus makes a
-  // view believe it has a focus even if the widget doens't have a
-  // focus. Either cases, we need to ignore this when the browser
-  // window isn't active.
+  // On Windows, changing focus to the location bar causes the browser window to
+  // become active. This can steal focus if the user has another window open
+  // already. On Chrome OS, changing focus makes a view believe it has a focus
+  // even if the widget doens't have a focus. Either cases, we need to ignore
+  // this when the browser window isn't active.
 #if defined(OS_WIN) || defined(OS_CHROMEOS)
   if (!force_location_bar_focus_ && !IsActive())
     return;
@@ -1658,12 +1652,12 @@
 }
 
 bool BrowserView::ShouldShowWindowTitle() const {
-#if defined(USE_ASH)
-  // For Ash only, trusted windows (apps and settings) do not show a title,
-  // crbug.com/119411. Child windows (i.e. popups) do show a title.
+#if defined(OS_CHROMEOS)
+  // For Chrome OS only, trusted windows (apps and settings) do not show a
+  // title, crbug.com/119411. Child windows (i.e. popups) do show a title.
   if (browser_->is_trusted_source())
     return false;
-#endif  // USE_ASH
+#endif  // OS_CHROMEOS
 
   return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
 }
@@ -1692,12 +1686,12 @@
 }
 
 bool BrowserView::ShouldShowWindowIcon() const {
-#if defined(USE_ASH)
-  // For Ash only, trusted windows (apps and settings) do not show an icon,
-  // crbug.com/119411. Child windows (i.e. popups) do show an icon.
+#if defined(OS_CHROMEOS)
+  // For Chrome OS only, trusted windows (apps and settings) do not show an
+  // icon, crbug.com/119411. Child windows (i.e. popups) do show an icon.
   if (browser_->is_trusted_source())
     return false;
-#endif  // USE_ASH
+#endif  // OS_CHROMEOS
 
   return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR);
 }
@@ -2352,16 +2346,16 @@
 }
 
 bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
-#if defined(USE_ASH)
+#if defined(OS_CHROMEOS)
   // Kiosk mode needs the whole screen.
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode))
     return false;
 
   return url.is_empty();
 #else
-  // No immersive except in Ash.
+  // No immersive except in Chrome OS.
   return false;
-#endif  // !USE_ASH
+#endif
 }
 
 void BrowserView::LoadAccelerators() {
diff --git a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
index 5e986a69..9fb9c7a 100644
--- a/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
+++ b/chrome/browser/ui/views/frame/immersive_mode_controller_ash_unittest.cc
@@ -131,16 +131,13 @@
   EXPECT_TRUE(controller()->IsEnabled());
   EXPECT_FALSE(controller()->IsRevealed());
   EXPECT_FALSE(toolbar->visible());
-  // For MD, the browser's top chrome is completely hidden in immersive
-  // fullscreen mode.
+  // For MD, the browser's top chrome is completely offscreen with tapstrip
+  // visible.
+  EXPECT_TRUE(tabstrip->visible());
   bool is_using_material_design =
       ash::MaterialDesignController::IsImmersiveModeMaterial();
-  if (is_using_material_design) {
-    EXPECT_FALSE(tabstrip->visible());
-  } else {
-    EXPECT_TRUE(tabstrip->visible());
+  if (!is_using_material_design)
     EXPECT_TRUE(tabstrip->IsImmersiveStyle());
-  }
 
   // The tab indicators should be flush with the top of the widget.
   EXPECT_EQ(0, GetBoundsInWidget(tabstrip).y());
@@ -195,12 +192,11 @@
   // both immersive and tab fullscreen.
   EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
 
-  // Hide the top-of-window views. Both the tab strip and the toolbar should
-  // hide when in both immersive and tab fullscreen.
+  // Hide the top-of-window views. Tabstrip is still considered as visible.
   AttemptUnreveal();
   EXPECT_FALSE(controller()->IsRevealed());
-  EXPECT_FALSE(tabstrip->visible());
   EXPECT_FALSE(toolbar->visible());
+  EXPECT_TRUE(tabstrip->visible());
 
   // The web contents should still be flush with the edge of the widget.
   EXPECT_EQ(0, GetBoundsInWidget(contents_web_view).y());
@@ -351,7 +347,8 @@
   EXPECT_FALSE(controller()->IsRevealed());
 
   // Entering immersive fullscreen should make the web contents flush with the
-  // top of the widget.
+  // top of the widget. The popup browser type doesn't support tabstrip and
+  // toolbar feature, thus invisible.
   EXPECT_FALSE(tabstrip->visible());
   EXPECT_FALSE(toolbar->visible());
   EXPECT_TRUE(top_container->GetVisibleBounds().IsEmpty());
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 6fa564c..0fcbb434a 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -40,7 +40,6 @@
 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
-#include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
@@ -131,7 +130,6 @@
       selected_keyword_view_(nullptr),
       keyword_hint_view_(nullptr),
       zoom_view_(nullptr),
-      open_pdf_in_reader_view_(nullptr),
       manage_passwords_icon_view_(nullptr),
       save_credit_card_icon_view_(nullptr),
       translate_icon_view_(nullptr),
@@ -251,9 +249,6 @@
   zoom_view_->Init();
   AddChildView(zoom_view_);
 
-  open_pdf_in_reader_view_ = new OpenPDFInReaderView();
-  AddChildView(open_pdf_in_reader_view_);
-
   manage_passwords_icon_view_ = new ManagePasswordsIconViews(command_updater());
   manage_passwords_icon_view_->Init();
   AddChildView(manage_passwords_icon_view_);
@@ -475,7 +470,6 @@
   int trailing_width = edge_thickness;
   trailing_width += IncrementalMinimumWidth(star_view_) +
                     IncrementalMinimumWidth(translate_icon_view_) +
-                    IncrementalMinimumWidth(open_pdf_in_reader_view_) +
                     IncrementalMinimumWidth(save_credit_card_icon_view_) +
                     IncrementalMinimumWidth(manage_passwords_icon_view_) +
                     IncrementalMinimumWidth(zoom_view_);
@@ -555,10 +549,6 @@
     trailing_decorations.AddDecoration(vertical_padding, location_height,
                                        translate_icon_view_);
   }
-  if (open_pdf_in_reader_view_->visible()) {
-    trailing_decorations.AddDecoration(vertical_padding, location_height,
-                                       open_pdf_in_reader_view_);
-  }
   if (save_credit_card_icon_view_->visible()) {
     trailing_decorations.AddDecoration(vertical_padding, location_height,
                                        save_credit_card_icon_view_);
@@ -654,9 +644,6 @@
   RefreshTranslateIcon();
   RefreshSaveCreditCardIconView();
   RefreshManagePasswordsIconView();
-  WebContents* web_contents_for_sub_views =
-      GetToolbarModel()->input_in_progress() ? nullptr : GetWebContents();
-  open_pdf_in_reader_view_->Update(web_contents_for_sub_views);
 
   if (star_view_)
     UpdateBookmarkStarVisibility();
@@ -780,9 +767,7 @@
       page_action_views_.push_back(std::move(page_action_view));
     }
 
-    View* right_anchor = open_pdf_in_reader_view_;
-    if (!right_anchor)
-      right_anchor = star_view_;
+    View* right_anchor = star_view_;
     DCHECK(right_anchor);
 
     // |page_action_views_| are ordered right-to-left.  Add them as children in
@@ -1038,13 +1023,6 @@
   return extension_action_view_controller->ExecuteAction(grant_tab_permissions);
 }
 
-void LocationBarView::UpdateOpenPDFInReaderPrompt() {
-  open_pdf_in_reader_view_->Update(
-      GetToolbarModel()->input_in_progress() ? nullptr : GetWebContents());
-  Layout();
-  SchedulePaint();
-}
-
 void LocationBarView::SaveStateToContents(WebContents* contents) {
   omnibox_view_->SaveStateToTab(contents);
 }
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 1d9b7a4..310a3c3 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -36,7 +36,6 @@
 class GURL;
 class KeywordHintView;
 class LocationIconView;
-class OpenPDFInReaderView;
 class ManagePasswordsIconViews;
 class PageActionWithBadgeView;
 class PageActionImageView;
@@ -351,7 +350,6 @@
   void UpdateLocationBarVisibility(bool visible, bool animation) override;
   bool ShowPageActionPopup(const extensions::Extension* extension,
                            bool grant_active_tab) override;
-  void UpdateOpenPDFInReaderPrompt() override;
   void SaveStateToContents(content::WebContents* contents) override;
   const OmniboxView* GetOmniboxView() const override;
   LocationBarTesting* GetLocationBarForTesting() override;
@@ -431,9 +429,6 @@
   // The zoom icon.
   ZoomView* zoom_view_;
 
-  // The icon to open a PDF in Reader.
-  OpenPDFInReaderView* open_pdf_in_reader_view_;
-
   // The manage passwords icon.
   ManagePasswordsIconViews* manage_passwords_icon_view_;
 
diff --git a/chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.cc b/chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.cc
deleted file mode 100644
index 58f9375c..0000000
--- a/chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
-
-#include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/pdf/browser/open_pdf_in_reader_prompt_client.h"
-#include "components/pdf/browser/pdf_web_contents_helper.h"
-#include "ui/accessibility/ax_node_data.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/gfx/color_utils.h"
-#include "ui/gfx/paint_vector_icon.h"
-#include "ui/gfx/vector_icons_public.h"
-#include "ui/native_theme/native_theme.h"
-#include "ui/views/widget/widget.h"
-
-OpenPDFInReaderView::OpenPDFInReaderView() : bubble_(nullptr), model_(nullptr) {
-  SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY);
-  SetTooltipText(l10n_util::GetStringUTF16(IDS_PDF_BUBBLE_OPEN_IN_READER_LINK));
-}
-
-OpenPDFInReaderView::~OpenPDFInReaderView() {
-  if (bubble_)
-    bubble_->GetWidget()->RemoveObserver(this);
-}
-
-void OpenPDFInReaderView::Update(content::WebContents* web_contents) {
-  model_ = nullptr;
-  if (web_contents) {
-    pdf::PDFWebContentsHelper* pdf_tab_helper =
-        pdf::PDFWebContentsHelper::FromWebContents(web_contents);
-    model_ = pdf_tab_helper->open_in_reader_prompt();
-  }
-
-  SetVisible(!!model_);
-
-  // Hide the bubble if it is currently shown and the icon is hidden.
-  if (!model_ && bubble_)
-    bubble_->GetWidget()->Hide();
-}
-
-void OpenPDFInReaderView::ShowBubble() {
-  if (bubble_)
-    return;
-
-  DCHECK(model_);
-  bubble_ = new OpenPDFInReaderBubbleView(this, model_);
-  views::BubbleDialogDelegateView::CreateBubble(bubble_);
-  bubble_->GetWidget()->AddObserver(this);
-  bubble_->GetWidget()->Show();
-}
-
-void OpenPDFInReaderView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
-  ImageView::GetAccessibleNodeData(node_data);
-  node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_OPEN_PDF_IN_READER));
-  node_data->role = ui::AX_ROLE_BUTTON;
-}
-
-bool OpenPDFInReaderView::OnMousePressed(const ui::MouseEvent& event) {
-  // Show the bubble on mouse release; that is standard button behavior.
-  return true;
-}
-
-void OpenPDFInReaderView::OnMouseReleased(const ui::MouseEvent& event) {
-  if (event.IsOnlyLeftMouseButton() && HitTestPoint(event.location()))
-    ShowBubble();
-}
-
-bool OpenPDFInReaderView::OnKeyPressed(const ui::KeyEvent& event) {
-  if (event.key_code() != ui::VKEY_SPACE &&
-      event.key_code() != ui::VKEY_RETURN) {
-    return false;
-  }
-
-  ShowBubble();
-  return true;
-}
-
-void OpenPDFInReaderView::OnNativeThemeChanged(
-    const ui::NativeTheme* native_theme) {
-  SetImage(gfx::CreateVectorIcon(
-      gfx::VectorIconId::PDF,
-      color_utils::DeriveDefaultIconColor(native_theme->GetSystemColor(
-          ui::NativeTheme::kColorId_TextfieldDefaultColor))));
-}
-
-void OpenPDFInReaderView::OnWidgetDestroying(views::Widget* widget) {
-  if (!bubble_)
-    return;
-
-  bubble_->GetWidget()->RemoveObserver(this);
-  bubble_ = nullptr;
-}
diff --git a/chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h b/chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h
deleted file mode 100644
index 19f53c72..0000000
--- a/chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_
-
-#include "base/macros.h"
-#include "ui/views/controls/image_view.h"
-#include "ui/views/widget/widget_observer.h"
-
-class OpenPDFInReaderBubbleView;
-
-namespace content {
-class WebContents;
-}
-
-namespace pdf {
-class OpenPDFInReaderPromptClient;
-}
-
-// A Page Action image view for the "Open PDF in Reader" bubble.
-class OpenPDFInReaderView : public views::ImageView,
-                            public views::WidgetObserver {
- public:
-  OpenPDFInReaderView();
-  ~OpenPDFInReaderView() override;
-
-  void Update(content::WebContents* web_contents);
-
- private:
-  void ShowBubble();
-
-  // views::ImageView:
-  void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
-  bool OnMousePressed(const ui::MouseEvent& event) override;
-  void OnMouseReleased(const ui::MouseEvent& event) override;
-  bool OnKeyPressed(const ui::KeyEvent& event) override;
-  void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
-
-  // views::WidgetObserver:
-  void OnWidgetDestroying(views::Widget* widget) override;
-
-  OpenPDFInReaderBubbleView* bubble_;
-
-  // Weak pointer; owned by the PDFWebContentsHelper of the currently active
-  // tab.
-  pdf::OpenPDFInReaderPromptClient* model_;
-
-  DISALLOW_COPY_AND_ASSIGN(OpenPDFInReaderView);
-};
-
-#endif  // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_OPEN_PDF_IN_READER_VIEW_H_
diff --git a/chrome/browser/ui/views/open_pdf_in_reader_bubble_view.cc b/chrome/browser/ui/views/open_pdf_in_reader_bubble_view.cc
deleted file mode 100644
index d1e78d5..0000000
--- a/chrome/browser/ui/views/open_pdf_in_reader_bubble_view.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h"
-
-#include "components/pdf/browser/open_pdf_in_reader_prompt_client.h"
-#include "ui/views/controls/button/label_button.h"
-#include "ui/views/controls/label.h"
-#include "ui/views/controls/link.h"
-#include "ui/views/controls/separator.h"
-#include "ui/views/layout/grid_layout.h"
-#include "ui/views/layout/layout_constants.h"
-
-OpenPDFInReaderBubbleView::~OpenPDFInReaderBubbleView() {}
-
-OpenPDFInReaderBubbleView::OpenPDFInReaderBubbleView(
-    views::View* anchor_view,
-    pdf::OpenPDFInReaderPromptClient* model)
-    : views::BubbleDialogDelegateView(anchor_view,
-                                      views::BubbleBorder::TOP_RIGHT),
-      model_(model),
-      open_in_reader_link_(nullptr) {
-  DCHECK(model);
-}
-
-void OpenPDFInReaderBubbleView::Init() {
-  using views::GridLayout;
-
-  GridLayout* layout = new views::GridLayout(this);
-  SetLayoutManager(layout);
-
-  const int single_column_set_id = 0;
-  views::ColumnSet* column_set = layout->AddColumnSet(single_column_set_id);
-  column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 1,
-                        GridLayout::USE_PREF, 0, 0);
-
-  base::string16 title = model_->GetMessageText();
-  views::Label* title_label = new views::Label(title);
-  layout->StartRow(0, single_column_set_id);
-  layout->AddView(title_label);
-
-  layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
-
-  base::string16 accept_text = model_->GetAcceptButtonText();
-  open_in_reader_link_ = new views::Link(accept_text);
-  open_in_reader_link_->set_listener(this);
-  layout->StartRow(0, single_column_set_id);
-  layout->AddView(open_in_reader_link_);
-}
-
-int OpenPDFInReaderBubbleView::GetDialogButtons() const {
-  return ui::DIALOG_BUTTON_CANCEL;
-}
-
-base::string16 OpenPDFInReaderBubbleView::GetDialogButtonLabel(
-    ui::DialogButton button) const {
-  return model_->GetCancelButtonText();
-}
-
-bool OpenPDFInReaderBubbleView::Cancel() {
-  model_->Cancel();
-  return true;
-}
-
-void OpenPDFInReaderBubbleView::LinkClicked(views::Link* source,
-                                            int event_flags) {
-  DCHECK_EQ(open_in_reader_link_, source);
-
-  model_->Accept();
-  GetWidget()->Close();
-}
-
diff --git a/chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h b/chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h
deleted file mode 100644
index 9ea2f75d..0000000
--- a/chrome/browser/ui/views/open_pdf_in_reader_bubble_view.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_VIEWS_OPEN_PDF_IN_READER_BUBBLE_VIEW_H_
-#define CHROME_BROWSER_UI_VIEWS_OPEN_PDF_IN_READER_BUBBLE_VIEW_H_
-
-#include "base/macros.h"
-#include "ui/views/bubble/bubble_dialog_delegate.h"
-#include "ui/views/controls/link_listener.h"
-
-namespace pdf {
-class OpenPDFInReaderPromptClient;
-}
-
-class OpenPDFInReaderBubbleView : public views::BubbleDialogDelegateView,
-                                  public views::LinkListener {
- public:
-  OpenPDFInReaderBubbleView(views::View* anchor_view,
-                            pdf::OpenPDFInReaderPromptClient* model);
-  ~OpenPDFInReaderBubbleView() override;
-
- protected:
-  // views::BubbleDialogDelegateView:
-  void Init() override;
-  bool Cancel() override;
-  int GetDialogButtons() const override;
-  base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
-
-  // views::LinkListener:
-  void LinkClicked(views::Link* source, int event_flags) override;
-
- private:
-  // Weak pointer; owned by the PDFWebContentsHelper of the currently active
-  // tab.
-  pdf::OpenPDFInReaderPromptClient* model_;
-
-  views::Link* open_in_reader_link_;
-
-  DISALLOW_COPY_AND_ASSIGN(OpenPDFInReaderBubbleView);
-};
-
-#endif  // CHROME_BROWSER_UI_VIEWS_OPEN_PDF_IN_READER_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index 860d0e3..3f0edc3d 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -63,6 +63,7 @@
 
 #if defined(USE_ASH)
 #include "ash/common/ash_switches.h"
+#include "ash/common/material_design/material_design_controller.h"
 #include "ash/common/wm/root_window_finder.h"
 #include "ash/common/wm/window_state.h"
 #include "ash/common/wm_window.h"
@@ -2098,9 +2099,15 @@
           ->controller())
       .SetupForTest();
   chrome::ToggleFullscreenMode(browser2);
+  // For MD, the browser's top chrome is completely offscreen, with tabstrip
+  // visible.
   ASSERT_TRUE(immersive_controller2->IsEnabled());
   ASSERT_FALSE(immersive_controller2->IsRevealed());
-  ASSERT_TRUE(tab_strip2->IsImmersiveStyle());
+  ASSERT_TRUE(tab_strip2->visible());
+  bool is_using_material_design =
+      ash::MaterialDesignController::IsImmersiveModeMaterial();
+  if (!is_using_material_design)
+    ASSERT_TRUE(tab_strip2->IsImmersiveStyle());
 
   // Move to the first tab and drag it enough so that it detaches, but not
   // enough that it attaches to browser2.
@@ -2121,6 +2128,7 @@
   // at normal height while user is tragging tabs_strip2's tabs.
   ASSERT_TRUE(immersive_controller2->IsRevealed());
   ASSERT_FALSE(tab_strip2->IsImmersiveStyle());
+  ASSERT_TRUE(tab_strip2->visible());
 
   // Release the mouse, stopping the drag session.
   ASSERT_TRUE(ReleaseInput());
@@ -2143,7 +2151,9 @@
 
   EXPECT_TRUE(immersive_controller2->IsEnabled());
   EXPECT_FALSE(immersive_controller2->IsRevealed());
-  EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
+  EXPECT_TRUE(tab_strip2->visible());
+  if (!is_using_material_design)
+    EXPECT_TRUE(tab_strip2->IsImmersiveStyle());
 }
 
 // Subclass of DetachToBrowserTabDragControllerTest that
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 9793463..a0c0c2580 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -50,6 +50,7 @@
 #include "chrome/browser/ui/webui/policy_ui.h"
 #include "chrome/browser/ui/webui/predictors/predictors_ui.h"
 #include "chrome/browser/ui/webui/profiler_ui.h"
+#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
 #include "chrome/browser/ui/webui/settings/md_settings_ui.h"
 #include "chrome/browser/ui/webui/settings_utils.h"
 #include "chrome/browser/ui/webui/signin_internals_ui.h"
@@ -127,7 +128,6 @@
 #include "chrome/browser/ui/webui/md_feedback/md_feedback_ui.h"
 #include "chrome/browser/ui/webui/md_history_ui.h"
 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
-#include "chrome/browser/ui/webui/quota_internals/quota_internals_ui.h"
 #include "chrome/browser/ui/webui/sync_file_system_internals/sync_file_system_internals_ui.h"
 #include "chrome/browser/ui/webui/system_info_ui.h"
 #include "chrome/browser/ui/webui/uber/uber_ui.h"
@@ -366,7 +366,9 @@
     return &NewWebUI<PredictorsUI>;
   if (url.host_piece() == chrome::kChromeUIProfilerHost)
     return &NewWebUI<ProfilerUI>;
-  if (url.host_piece() == chrome::kChromeUISignInInternalsHost)
+  if (url.host() == chrome::kChromeUIQuotaInternalsHost)
+    return &NewWebUI<QuotaInternalsUI>;
+  if (url.host() == chrome::kChromeUISignInInternalsHost)
     return &NewWebUI<SignInInternalsUI>;
   if (url.host_piece() == chrome::kChromeUISuggestionsHost)
     return &NewWebUI<suggestions::SuggestionsUI>;
@@ -441,8 +443,6 @@
       url.host_piece() == chrome::kChromeUISettingsHost) {
     return &NewWebUI<settings::MdSettingsUI>;
   }
-  if (url.host_piece() == chrome::kChromeUIQuotaInternalsHost)
-    return &NewWebUI<QuotaInternalsUI>;
   // Settings are implemented with native UI elements on Android.
   // Handle chrome://settings if settings in a window is enabled.
   if (url.host_piece() == chrome::kChromeUISettingsFrameHost ||
diff --git a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
index 8351265a..5a09946 100644
--- a/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_localized_strings_provider.cc
@@ -940,6 +940,8 @@
        IDS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE},
       {"offerToTranslateInThisLanguage",
        IDS_SETTINGS_LANGUAGES_OFFER_TO_TRANSLATE_IN_THIS_LANGUAGE},
+      {"offerToEnableTranslate",
+       IDS_SETTINGS_LANGUAGES_OFFER_TO_ENABLE_TRANSLATE},
 #if !defined(OS_MACOSX)
       {"spellCheckListTitle", IDS_SETTINGS_LANGUAGES_SPELL_CHECK_LIST_TITLE},
       {"spellCheckExpandA11yLabel",
diff --git a/chrome/chrome.isolate b/chrome/chrome.isolate
index 52704555..5ac069c 100644
--- a/chrome/chrome.isolate
+++ b/chrome/chrome.isolate
@@ -115,13 +115,6 @@
         ],
       },
     }],
-    ['OS=="win" and kasko==1', {
-      'variables': {
-        'files': [
-          '<(PRODUCT_DIR)/kasko.dll',
-        ],
-      },
-    }],
     ['OS=="win" and component=="shared_library" and (fastbuild==0 or fastbuild==1)', {
       'variables': {
         'files': [
diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni
index 27c483c..1ecd49b 100644
--- a/chrome/chrome_paks.gni
+++ b/chrome/chrome_paks.gni
@@ -96,6 +96,7 @@
       "$root_gen_dir/chrome/net_internals_resources.pak",
       "$root_gen_dir/chrome/password_manager_internals_resources.pak",
       "$root_gen_dir/chrome/policy_resources.pak",
+      "$root_gen_dir/chrome/quota_internals_resources.pak",
       "$root_gen_dir/chrome/task_scheduler_internals_resources.pak",
       "$root_gen_dir/chrome/translate_internals_resources.pak",
       "$root_gen_dir/components/components_resources.pak",
@@ -111,6 +112,7 @@
       "//chrome/browser/resources:net_internals_resources",
       "//chrome/browser/resources:password_manager_internals_resources",
       "//chrome/browser/resources:policy_resources",
+      "//chrome/browser/resources:quota_internals_resources",
       "//chrome/browser/resources:task_scheduler_internals_resources",
       "//chrome/browser/resources:translate_internals_resources",
       "//chrome/common:resources",
@@ -134,14 +136,12 @@
         "$root_gen_dir/blink/devtools_resources.pak",
         "$root_gen_dir/chrome/component_extension_resources.pak",
         "$root_gen_dir/chrome/options_resources.pak",
-        "$root_gen_dir/chrome/quota_internals_resources.pak",
         "$root_gen_dir/chrome/settings_resources.pak",
         "$root_gen_dir/chrome/sync_file_system_internals_resources.pak",
       ]
       deps += [
         "//chrome/browser/resources:component_extension_resources",
         "//chrome/browser/resources:options_resources",
-        "//chrome/browser/resources:quota_internals_resources",
         "//chrome/browser/resources:settings_resources",
         "//chrome/browser/resources:sync_file_system_internals_resources",
         "//content/browser/devtools:devtools_resources",
diff --git a/chrome/chrome_watcher/BUILD.gn b/chrome/chrome_watcher/BUILD.gn
index 4a5d77e..0668586 100644
--- a/chrome/chrome_watcher/BUILD.gn
+++ b/chrome/chrome_watcher/BUILD.gn
@@ -41,12 +41,6 @@
   ]
 }
 
-group("kasko_util") {
-  public_deps = [
-    "//third_party/kasko:kasko_features",
-  ]
-}
-
 process_version_rc_template("chrome_watcher_resources") {
   sources = [
     "chrome_watcher.ver",
@@ -64,7 +58,6 @@
   deps = [
     ":chrome_watcher_resources",
     ":client",
-    ":kasko_util",
     "//base",
     "//base:base_static",
     "//build/config/sanitizers:deps",
diff --git a/chrome/chrome_watcher/DEPS b/chrome/chrome_watcher/DEPS
index 70d347f..cded49b 100644
--- a/chrome/chrome_watcher/DEPS
+++ b/chrome/chrome_watcher/DEPS
@@ -4,7 +4,5 @@
   "+components/browser_watcher",
   "+components/crash",
   "+components/memory_pressure",
-  "+syzygy/kasko/api",
   "+testing/gtest",
-  "+third_party/kasko",
 ]
diff --git a/chrome/chrome_watcher/chrome_watcher_main.cc b/chrome/chrome_watcher/chrome_watcher_main.cc
index 180ec3c..e0b2343 100644
--- a/chrome/chrome_watcher/chrome_watcher_main.cc
+++ b/chrome/chrome_watcher/chrome_watcher_main.cc
@@ -142,8 +142,8 @@
   // This needs to run on an IO thread.
   DCHECK_NE(main_thread_, base::ThreadTaskRunnerHandle::Get());
 
-  // Signal our client now that the Kasko reporter is initialized and we have
-  // cleared all of the obstacles that might lead to an early exit.
+  // Signal our client that we have cleared all of the obstacles that might lead
+  // to an early exit.
   ::SetEvent(on_initialized_event.Get());
   on_initialized_event.Close();
 
diff --git a/chrome/chrome_watcher/chrome_watcher_main_api.cc b/chrome/chrome_watcher/chrome_watcher_main_api.cc
index e8b29e16..513aa73 100644
--- a/chrome/chrome_watcher/chrome_watcher_main_api.cc
+++ b/chrome/chrome_watcher/chrome_watcher_main_api.cc
@@ -10,7 +10,3 @@
 const char kChromeWatcherDLLEntrypoint[] = "WatcherMain";
 const base::FilePath::CharType kPermanentlyFailedReportsSubdir[] =
     L"Crash Reports Fallback";
-
-base::string16 GetKaskoEndpoint(base::ProcessId client_process_id) {
-  return L"chrome_kasko_" + base::UintToString16(client_process_id);
-}
diff --git a/chrome/chrome_watcher/chrome_watcher_main_api.h b/chrome/chrome_watcher/chrome_watcher_main_api.h
index a8999556..8491d98 100644
--- a/chrome/chrome_watcher/chrome_watcher_main_api.h
+++ b/chrome/chrome_watcher/chrome_watcher_main_api.h
@@ -21,11 +21,9 @@
 // The type of the watcher DLL's main entry point.
 // Watches |parent_process|, whose main thread ID is |main_thread_id|, and
 // records its exit code under |registry_path| in HKCU. The Chrome message
-// window, owned by |parent_process|, will be monitored for responsiveness. If
-// enabled, a Kasko reporter process is also instantiated, using
-// |browser_data_directory| to store crash reports. |on_initialized_event| will
-// be signaled once the watcher process is fully initialized. Takes ownership of
-// |parent_process| and |on_initialized_event|.
+// window, owned by |parent_process|, will be monitored for responsiveness.
+// |on_initialized_event| will be signaled once the watcher process is fully
+// initialized. Takes ownership of |parent_process| and |on_initialized_event|.
 typedef int (*ChromeWatcherMainFunction)(
     const base::char16* registry_path,
     HANDLE parent_process,
@@ -33,10 +31,4 @@
     HANDLE on_initialized_event,
     const base::char16* browser_data_directory);
 
-// Returns an RPC endpoint name for the identified client process. This method
-// may be invoked in both the client and the watcher process with the PID of the
-// client process to establish communication between the two using a common
-// endpoint name.
-base::string16 GetKaskoEndpoint(base::ProcessId client_process_id);
-
 #endif  // CHROME_CHROME_WATCHER_CHROME_WATCHER_MAIN_API_H_
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn
index fb23d30..dfd8f17 100644
--- a/chrome/common/BUILD.gn
+++ b/chrome/common/BUILD.gn
@@ -222,7 +222,6 @@
     "//printing/features",
     "//skia",
     "//third_party/icu",
-    "//third_party/kasko:kasko_features",
     "//third_party/re2",
     "//third_party/widevine/cdm:headers",
     "//third_party/zlib:zip",
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index a55a1ce..10fabe5 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -37,7 +37,6 @@
   "+ppapi/thunk",
   "+sandbox/linux/services/credentials.h",
   "+third_party/boringssl/src/include",
-  "+third_party/kasko",
 
   # FIXME - refactor code and remove these dependencies
   "+chrome/installer",
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc
index c099a26..b1589f16 100644
--- a/chrome/common/crash_keys.cc
+++ b/chrome/common/crash_keys.cc
@@ -92,11 +92,6 @@
 }  // namespace mac
 #endif
 
-#if BUILDFLAG(ENABLE_KASKO)
-const char kKaskoGuid[] = "kasko-guid";
-const char kKaskoEquivalentGuid[] = "kasko-equivalent-guid";
-#endif
-
 const char kViewCount[] = "view-count";
 
 const char kZeroEncodeDetails[] = "zero-encode-details";
@@ -175,10 +170,6 @@
     { "rwhvm_window", kMediumSize },
     // media/:
 #endif
-#if BUILDFLAG(ENABLE_KASKO)
-    { kKaskoGuid, kSmallSize },
-    { kKaskoEquivalentGuid, kSmallSize },
-#endif
     { kBug464926CrashKey, kSmallSize },
     { kViewCount, kSmallSize },
 
diff --git a/chrome/common/crash_keys.h b/chrome/common/crash_keys.h
index 2b6106c..bf6bbdc 100644
--- a/chrome/common/crash_keys.h
+++ b/chrome/common/crash_keys.h
@@ -15,7 +15,6 @@
 #include "base/macros.h"
 #include "build/build_config.h"
 #include "components/crash/core/common/crash_keys.h"
-#include "third_party/kasko/kasko_features.h"
 
 namespace base {
 class CommandLine;
@@ -148,12 +147,6 @@
 }  // namespace mac
 #endif
 
-#if BUILDFLAG(ENABLE_KASKO)
-// Used to correlate a report sent via Kasko with one sent via Breakpad.
-extern const char kKaskoGuid[];
-extern const char kKaskoEquivalentGuid[];
-#endif
-
 // Numbers of active views.
 extern const char kViewCount[];
 
diff --git a/chrome/common/extensions/docs/templates/json/chrome_sidenav.json b/chrome/common/extensions/docs/templates/json/chrome_sidenav.json
index fb54e07..8147c10 100644
--- a/chrome/common/extensions/docs/templates/json/chrome_sidenav.json
+++ b/chrome/common/extensions/docs/templates/json/chrome_sidenav.json
@@ -165,20 +165,12 @@
                 "href": "/devtools/docs/debugging-clients"
               },
               {
-                "title": "Version 1.1 (Stable)",
-                "href": "/devtools/docs/protocol/1.1/index"
+                "title": "Version 1.2 (Stable)",
+                "href": "https://chromedevtools.github.io/debugger-protocol-viewer/1-2/"
               },
               {
                 "title": "Tip-of-tree (Unstable)",
-                "href": "https://chromedevtools.github.io/debugger-protocol-viewer/"
-              },
-              {
-                "title": "Version 1.0",
-                "href": "/devtools/docs/protocol/1.0/index"
-              },
-              {
-                "title": "Version .1",
-                "href": "/devtools/docs/protocol/0.1/index"
+                "href": "https://chromedevtools.github.io/debugger-protocol-viewer/tot/"
               }
             ]
           }
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index e0aa711..50bc9637 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -644,6 +644,7 @@
     kChromeUIPolicyHost,
     kChromeUIPredictorsHost,
     kChromeUIProfilerHost,
+    kChromeUIQuotaInternalsHost,
     kChromeUISignInInternalsHost,
     kChromeUISiteEngagementHost,
     kChromeUINTPTilesInternalsHost,
@@ -680,7 +681,6 @@
     kChromeUIFlashHost,
     kChromeUIHelpHost,
     kChromeUIInspectHost,
-    kChromeUIQuotaInternalsHost,
     kChromeUISettingsHost,
     kChromeUISystemInfoHost,
     kChromeUIUberHost,
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release
index d67113e..6176a03 100644
--- a/chrome/installer/mini_installer/chrome.release
+++ b/chrome/installer/mini_installer/chrome.release
@@ -27,7 +27,6 @@
 ffmpeg.dll: %(VersionDir)s\
 icudt.dll: %(VersionDir)s\
 icudtl.dat: %(VersionDir)s\
-kasko.dll: %(VersionDir)s\
 libEGL.dll: %(VersionDir)s\
 libGLESv2.dll: %(VersionDir)s\
 nacl64.exe: %(VersionDir)s\
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 8c91b053..ecd5cbe 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -4988,7 +4988,6 @@
       "//chrome/child",
       "//components/crash/core/common",
       "//components/flags_ui:switches",
-      "//third_party/kasko:kasko_features",
     ]
   }
 }
diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h
index 6411db51..d75242d 100644
--- a/chrome/test/base/test_browser_window.h
+++ b/chrome/test/base/test_browser_window.h
@@ -169,7 +169,6 @@
     void UpdateLocationBarVisibility(bool visible, bool animate) override {}
     bool ShowPageActionPopup(const extensions::Extension* extension,
                              bool grant_active_tab) override;
-    void UpdateOpenPDFInReaderPrompt() override {}
     void SaveStateToContents(content::WebContents* contents) override {}
     void Revert() override {}
     const OmniboxView* GetOmniboxView() const override;
diff --git a/chrome/test/data/profiles/profile_with_complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/manifest.json b/chrome/test/data/profiles/profile_with_complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/manifest.json
index 07a9755..2e42e61 100644
--- a/chrome/test/data/profiles/profile_with_complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/manifest.json
+++ b/chrome/test/data/profiles/profile_with_complex_theme/Default/Extensions/mblmlcbknbnfebdfjnolmcapmdofhmme/1.1/manifest.json
@@ -8,8 +8,6 @@
          "ntp_background": [ 57, 137, 194 ],
          "ntp_link": [ 0, 0, 0 ],
          "ntp_section": [ 131, 138, 146, 0.8 ],
-         "ntp_section_link": [ 255, 255, 255 ],
-         "ntp_section_text": [ 255, 255, 255 ],
          "ntp_text": [ 0, 0, 0 ],
          "tab_background_text": [ 0, 0, 0 ],
          "tab_text": [ 0, 0, 0 ],
diff --git a/chrome/test/data/profiles/profile_with_complex_theme/Default/PreferencesTemplate b/chrome/test/data/profiles/profile_with_complex_theme/Default/PreferencesTemplate
index 79128ef..2fdf1f98 100644
--- a/chrome/test/data/profiles/profile_with_complex_theme/Default/PreferencesTemplate
+++ b/chrome/test/data/profiles/profile_with_complex_theme/Default/PreferencesTemplate
@@ -20,8 +20,6 @@
                      "ntp_background": [ 57, 137, 194 ],
                      "ntp_link": [ 0, 0, 0 ],
                      "ntp_section": [ 131, 138, 146, 0.8 ],
-                     "ntp_section_link": [ 255, 255, 255 ],
-                     "ntp_section_text": [ 255, 255, 255 ],
                      "ntp_text": [ 0, 0, 0 ],
                      "tab_background_text": [ 0, 0, 0 ],
                      "tab_text": [ 0, 0, 0 ],
diff --git a/chrome/test/data/webui/settings/languages_page_browsertest.js b/chrome/test/data/webui/settings/languages_page_browsertest.js
index a7e1dd967..a7dfa66 100644
--- a/chrome/test/data/webui/settings/languages_page_browsertest.js
+++ b/chrome/test/data/webui/settings/languages_page_browsertest.js
@@ -235,7 +235,24 @@
             cr.isChromeOS || cr.isWindows ? 1 : 0, separator.offsetHeight);
       });
 
-      test('toggle translate', function(done) {
+      test('test translate.enable toggle', function() {
+        languageHelper.setPrefValue('translate.enabled', true);
+        var toggle = languagesPage.$.offerTranslateOtherLangs.root
+            .querySelectorAll('paper-toggle-button')[0];
+        assertTrue(!!toggle);
+
+        // Clicking on toggle switch it to false.
+        MockInteractions.tap(toggle);
+        var newToggleValue = languageHelper.prefs.translate.enabled.value;
+        assertFalse(newToggleValue);
+
+        // Clicking on toggle switch it to true again.
+        MockInteractions.tap(toggle);
+        newToggleValue = languageHelper.prefs.translate.enabled.value;
+        assertTrue(newToggleValue);
+      });
+
+      test('toggle translate for a specific language', function(done) {
         // Enable Translate so the menu always shows the Translate checkbox.
         languageHelper.setPrefValue('translate.enabled', true);
         languagesPage.set('languages.translateTarget', 'foo');
@@ -262,6 +279,25 @@
         }, settings.kMenuCloseDelay + 1);
       });
 
+      test('disable translate hides language-specific option', function() {
+        // Disables translate.
+        languageHelper.setPrefValue('translate.enabled', false);
+        languagesPage.set('languages.translateTarget', 'foo');
+        languagesPage.set('languages.enabled.1.supportsTranslate', true);
+
+        // Makes sure language-specific menu exists.
+        var languageOptionsDropdownTrigger =
+            languagesCollapse.querySelectorAll('paper-icon-button')[1];
+        assertTrue(!!languageOptionsDropdownTrigger);
+        MockInteractions.tap(languageOptionsDropdownTrigger);
+        assertTrue(actionMenu.open);
+
+        // The language-specific translation option should be hidden.
+        var translateOption = actionMenu.querySelector('#offerTranslations');
+        assertTrue(!!translateOption);
+        assertTrue(translateOption.hidden);
+      });
+
       test('remove language', function() {
         var numEnabled = languagesPage.languages.enabled.length;
 
diff --git a/chrome/test/kasko/OWNERS b/chrome/test/kasko/OWNERS
deleted file mode 100644
index 2b8fbc2..0000000
--- a/chrome/test/kasko/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-chrisha@chromium.org
-sebmarchand@chromium.org
\ No newline at end of file
diff --git a/chrome/test/kasko/hang_watcher_integration_test.py b/chrome/test/kasko/hang_watcher_integration_test.py
deleted file mode 100755
index 24ff958..0000000
--- a/chrome/test/kasko/hang_watcher_integration_test.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""A Windows-only end-to-end integration test for the Chrome hang watcher.
-
-This test ensures that the hang watcher is able to detect when Chrome hangs and
-to generate a Kasko report. The report is then delivered to a locally hosted
-test crash server. If a crash report is received then all is well.
-
-Note that this test only works against non-component Release and Official builds
-of Chrome with Chrome branding, and attempting to use it with anything else will
-most likely lead to constant failures.
-
-Typical usage (assuming in root 'src' directory):
-- generate project files with the following build variables:
-    GYP variables:
-      branding=Chrome kasko_hang_reports=1
-    GN variables:
-      target_cpu = "x86"
-      is_debug = false
-      is_chrome_branded = true
-      enable_kasko_hang_reports = true
-- build the release Chrome binaries:
-    ninja -C {build_dir} chrome.exe chromedriver.exe
-- run the test:
-    python chrome/test/kasko/hang_watcher_integration_test.py
-      --chrome={build_dir}\chrome.exe
-"""
-
-import logging
-import os
-import sys
-
-# Bring in the Kasko module.
-KASKO_DIR = os.path.join(os.path.dirname(__file__), 'py')
-sys.path.append(KASKO_DIR)
-import kasko
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-def Main():
-  options = kasko.config.ParseCommandLine()
-
-  kasko.integration_test.RunTest(
-      options,
-      'chrome://delayeduithreadhang',
-      120,
-      {
-        'hung-process': 'DumpHungBrowserProcess()',
-        'hung-process-is-deadlock': 'GetThreadWaitChain()',
-        'hung-process-wait-chain-00': 'GetThreadWaitChain()',
-      })
-
-  _LOGGER.info('Test passed successfully!')
-
-  return 0
-
-
-if __name__ == '__main__':
-  sys.exit(Main())
diff --git a/chrome/test/kasko/kasko_integration_test.py b/chrome/test/kasko/kasko_integration_test.py
deleted file mode 100755
index 97f2e17..0000000
--- a/chrome/test/kasko/kasko_integration_test.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2015 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.
-
-"""A Windows-only end-to-end integration test for Kasko, Chrome and Crashpad.
-
-This test ensures that the interface between Kasko and Chrome and Crashpad works
-as expected. The test causes Kasko to set certain crash keys and invoke a crash
-report, which is in turn delivered to a locally hosted test crash server. If the
-crash report is received intact with the expected crash keys then all is well.
-
-Note that this test only works against non-component Release and Official builds
-of Chrome with Chrome branding, and attempting to use it with anything else will
-most likely lead to constant failures.
-
-Typical usage (assuming in root 'src' directory):
-
-- generate project files with the following GYP variables:
-    branding=Chrome syzyasan=1 win_z7=0 chromium_win_pch=0
-- build the release Chrome binaries:
-    ninja -C out\Release chrome.exe chromedriver.exe
-- run the test:
-    python chrome/test/kasko/kasko_integration_test.py
-"""
-
-import logging
-import os
-import sys
-
-# Bring in the Kasko module.
-KASKO_DIR = os.path.join(os.path.dirname(__file__), 'py')
-sys.path.append(KASKO_DIR)
-import kasko
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-def Main():
-  try:
-    options = kasko.config.ParseCommandLine()
-
-    kasko.integration_test.RunTest(
-        options,
-        'chrome://kasko/send-report',
-        10,
-        {'kasko-set-crash-key-value-impl': 'SetCrashKeyValueImpl'})
-
-    _LOGGER.info('Test passed successfully!')
-  except Exception as e:
-    _LOGGER.error(e)
-    return 1
-
-
-if __name__ == '__main__':
-  sys.exit(Main())
diff --git a/chrome/test/kasko/py/kasko/__init__.py b/chrome/test/kasko/py/kasko/__init__.py
deleted file mode 100755
index 82c0441b..0000000
--- a/chrome/test/kasko/py/kasko/__init__.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-import config
-import crash_server
-import exceptions
-import integration_test
-import process
-import report
-import util
diff --git a/chrome/test/kasko/py/kasko/config.py b/chrome/test/kasko/py/kasko/config.py
deleted file mode 100755
index 61440b09..0000000
--- a/chrome/test/kasko/py/kasko/config.py
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Command-line configuration utilities."""
-
-import logging
-import os
-import optparse
-import sys
-
-from kasko.process import ImportSelenium
-from kasko.json_logging_handler import JSONLoggingHandler
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-def GenerateOptionParser():
-  """Generates a default OptionParser."""
-
-  """Parses the command-line and returns an options structure."""
-  self_dir = os.path.dirname(__file__)
-  src_dir = os.path.abspath(os.path.join(self_dir, '..', '..', '..', '..',
-                                         '..'))
-
-  option_parser = optparse.OptionParser()
-  option_parser.add_option('--chrome', dest='chrome', type='string',
-      default=os.path.join(src_dir, 'out', 'Release', 'chrome.exe'),
-      help='Path to chrome.exe. Defaults to $SRC/out/Release/chrome.exe')
-  option_parser.add_option('--chromedriver', dest='chromedriver',
-      type='string', help='Path to the chromedriver.exe. By default will look '
-      'alongside chrome.exe.')
-  option_parser.add_option('--keep-temp-dirs', action='store_true',
-      default=False, help='Prevents temporary directories from being deleted.')
-  option_parser.add_option('--quiet', dest='log_level', action='store_const',
-      default=logging.INFO, const=logging.ERROR,
-      help='Disables all output except for errors.')
-  option_parser.add_option('--user-data-dir', dest='user_data_dir',
-      type='string', help='User data directory to use. Defaults to using a '
-      'temporary one.')
-  option_parser.add_option('--verbose', dest='log_level', action='store_const',
-      default=logging.INFO, const=logging.DEBUG,
-      help='Enables verbose logging.')
-  option_parser.add_option('--webdriver', type='string',
-      default=os.path.join(src_dir, 'third_party', 'webdriver', 'pylib'),
-      help='Specifies the directory where the python installation of webdriver '
-           '(selenium) can be found. Specify an empty string to use the system '
-           'installation. Defaults to $SRC/third_party/webdriver/pylib')
-  option_parser.add_option('--log-to-json', type='string',
-      help='The path to the JSON file that should be used for the logging. '
-           'Defaults to logging directly to the console.')
-
-  return option_parser
-
-
-def LogParserError(message, parser, log_to_json):
-  """Log a parsing error on the command-line.
-
-  This logs the error via the logger if the '--log-to-json' flag has been
-  passed to the logger.
-  """
-  if log_to_json:
-    _LOGGER.error(message)
-    sys.exit(1)
-  else:
-    parser.error(message)
-
-
-def ParseCommandLine(option_parser=None):
-  if not option_parser:
-    option_parser = GenerateOptionParser()
-
-  options, args = option_parser.parse_args()
-
-  # Configure logging.
-  logging.basicConfig(level=options.log_level)
-
-  if options.log_to_json:
-    logging.getLogger().addHandler(JSONLoggingHandler(options.log_to_json))
-
-  if args:
-    return LogParserError('Unexpected arguments: %s' % args,
-                          option_parser, options.log_to_json)
-
-  # Validate chrome.exe exists.
-  if not os.path.isfile(options.chrome):
-    return LogParserError('chrome.exe not found',
-                          option_parser, options.log_to_json)
-
-  # Use default chromedriver.exe if necessary, and validate it exists.
-  if not options.chromedriver:
-    options.chromedriver = os.path.join(os.path.dirname(options.chrome),
-                                        'chromedriver.exe')
-  if not os.path.isfile(options.chromedriver):
-    return LogParserError('chromedriver.exe not found',
-                          option_parser, options.log_to_json)
-
-  # If specified, ensure the webdriver parameters is a directory.
-  if options.webdriver and not os.path.isdir(options.webdriver):
-    return LogParserError('Invalid webdriver directory.',
-                          option_parser, options.log_to_json)
-
-  _LOGGER.debug('Using chrome path: %s', options.chrome)
-  _LOGGER.debug('Using chromedriver path: %s', options.chromedriver)
-  _LOGGER.debug('Using webdriver path: %s', options.webdriver)
-
-  # Import webdriver and selenium.
-  ImportSelenium(options.webdriver)
-
-  return options
diff --git a/chrome/test/kasko/py/kasko/crash_server.py b/chrome/test/kasko/py/kasko/crash_server.py
deleted file mode 100755
index 625531b..0000000
--- a/chrome/test/kasko/py/kasko/crash_server.py
+++ /dev/null
@@ -1,148 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Exceptions used by the Kasko integration test module."""
-
-import BaseHTTPServer
-import cgi
-import logging
-import os
-import socket
-import threading
-import time
-import uuid
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-class _StoppableHTTPServer(BaseHTTPServer.HTTPServer):
-  """An extension of BaseHTTPServer that uses timeouts and is interruptable."""
-
-  def server_bind(self):
-    BaseHTTPServer.HTTPServer.server_bind(self)
-    self.socket.settimeout(1)
-    self.run_ = True
-
-  def get_request(self):
-    while self.run_:
-      try:
-        sock, addr = self.socket.accept()
-        sock.settimeout(None)
-        return (sock, addr)
-      except socket.timeout:
-        pass
-
-  def stop(self):
-    self.run_ = False
-
-  def serve(self):
-    while self.run_:
-      self.handle_request()
-
-
-class CrashServer(object):
-  """A simple crash server for testing."""
-
-  def __init__(self):
-    self.server_ = None
-    self.lock_ = threading.Lock()
-    self.crashes_ = []  # Under lock_.
-
-  def crash(self, index):
-    """Accessor for the list of crashes."""
-    with self.lock_:
-      if index >= len(self.crashes_):
-        return None
-      return self.crashes_[index]
-
-  @property
-  def port(self):
-    """Returns the port associated with the server."""
-    if not self.server_:
-      return 0
-    return self.server_.server_port
-
-  def start(self):
-    """Starts the server on another thread. Call from main thread only."""
-    page_handler = self.multipart_form_handler()
-    self.server_ = _StoppableHTTPServer(('127.0.0.1', 0), page_handler)
-    self.thread_ = self.server_thread()
-    self.thread_.start()
-
-  def stop(self):
-    """Stops the running server. Call from main thread only."""
-    self.server_.stop()
-    self.thread_.join()
-    self.server_ = None
-    self.thread_ = None
-
-  def wait_for_report(self, timeout):
-    """Waits until the server has received a crash report.
-
-    Returns True if the a report has been received in the given time, or False
-    if a timeout occurred. Since Python condition variables have no notion of
-    timeout this is, sadly, a busy loop on the calling thread.
-    """
-    started = time.time()
-    elapsed = 0
-    while elapsed < timeout:
-      with self.lock_:
-        if len(self.crashes_):
-          return True
-      time.sleep(0.1)
-      elapsed = time.time() - started
-
-    return False
-
-
-  def multipart_form_handler(crash_server):
-    """Returns a multi-part form handler class for use with a BaseHTTPServer."""
-
-    class MultipartFormHandler(BaseHTTPServer.BaseHTTPRequestHandler):
-      """A multi-part form handler that processes crash reports.
-
-      This class only handles multipart form POST messages, with all other
-      requests by default returning a '501 not implemented' error.
-      """
-
-      def __init__(self, request, client_address, socket_server):
-        BaseHTTPServer.BaseHTTPRequestHandler.__init__(
-          self, request, client_address, socket_server)
-
-      def log_message(self, format, *args):
-        _LOGGER.debug(format, *args)
-
-      def do_POST(self):
-        """Handles POST messages contained multipart form data."""
-        content_type, parameters = cgi.parse_header(
-            self.headers.getheader('content-type'))
-        if content_type != 'multipart/form-data':
-          raise Exception('Unsupported Content-Type: ' + content_type)
-        post_multipart = cgi.parse_multipart(self.rfile, parameters)
-
-        # Save the crash report.
-        report = dict(post_multipart.items())
-        report_id = str(uuid.uuid4())
-        report['report-id'] = [report_id]
-        with crash_server.lock_:
-          crash_server.crashes_.append(report)
-
-        # Send the response.
-        self.send_response(200)
-        self.send_header("Content-Type", "text/plain")
-        self.end_headers()
-        self.wfile.write(report_id)
-
-    return MultipartFormHandler
-
-  def server_thread(crash_server):
-    """Returns a thread that hosts the webserver."""
-
-    class ServerThread(threading.Thread):
-      def run(self):
-        crash_server.server_.serve()
-
-    return ServerThread()
\ No newline at end of file
diff --git a/chrome/test/kasko/py/kasko/exceptions.py b/chrome/test/kasko/py/kasko/exceptions.py
deleted file mode 100755
index d7ba4227..0000000
--- a/chrome/test/kasko/py/kasko/exceptions.py
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Exceptions used by the Kasko integration test module."""
-
-class TimeoutException(Exception):
-  """Exception used to indicate a timeout has occurred."""
-  pass
diff --git a/chrome/test/kasko/py/kasko/integration_test.py b/chrome/test/kasko/py/kasko/integration_test.py
deleted file mode 100755
index f2531c362..0000000
--- a/chrome/test/kasko/py/kasko/integration_test.py
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Integration test for Kasko."""
-
-import logging
-import os
-import optparse
-
-import kasko
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-def RunTest(options, url, timeout, expected_keys):
-  """Runs an integration test for Kasko crash reports.
-
-  Launches both test server and a Chrome instance and then navigates
-  to the test |url|. The visited |url| is expected to generate a
-  Kasko report within the |timeout| allowed. The report is finally
-  verified against expected crash keys.
-
-  This test raises an exception on error.
-
-  Args:
-    options The options used to modify the test behavior. Call
-       kasko.config.ParseCommandLine() to generate them.
-    url The URL that the browser will be navigated to in order to
-      cause a crash.
-    timeout The time, in seconds, in which the crash is expected to
-      be processed.
-    expected_keys A dictionary containing the keys that are expected
-      to be present in the crash keys of the report. The value is an
-      optional string to give an indication of what is the probable
-      cause of the missing key.
-  """
-
-  # Generate a temporary directory for use in the tests.
-  with kasko.util.ScopedTempDir() as temp_dir:
-    # Prevent the temporary directory from self cleaning if requested.
-    if options.keep_temp_dirs:
-      temp_dir_path = temp_dir.release()
-    else:
-      temp_dir_path = temp_dir.path
-
-    # Use the specified user data directory if requested.
-    if options.user_data_dir:
-      user_data_dir = options.user_data_dir
-    else:
-      user_data_dir = os.path.join(temp_dir_path, 'user-data-dir')
-
-    kasko_dir = os.path.join(temp_dir_path, 'kasko')
-    os.makedirs(kasko_dir)
-
-    # Launch the test server.
-    server = kasko.crash_server.CrashServer()
-    with kasko.util.ScopedStartStop(server):
-      _LOGGER.info('Started server on port %d', server.port)
-
-      # Configure the environment so Chrome can find the test crash server.
-      os.environ['KASKO_CRASH_SERVER_URL'] = (
-          'http://127.0.0.1:%d/crash' % server.port)
-
-      # Launch Chrome and navigate it to the test URL.
-      chrome = kasko.process.ChromeInstance(options.chromedriver,
-                                            options.chrome, user_data_dir)
-      with kasko.util.ScopedStartStop(chrome):
-        _LOGGER.info('Navigating to Kasko debug URL')
-        chrome.navigate_to(url)
-
-        _LOGGER.info('Waiting for Kasko report')
-        if not server.wait_for_report(timeout):
-          raise Exception('No Kasko report received.')
-
-    # Verify a few crash keys.
-    report = server.crash(0)
-    kasko.report.LogCrashKeys(report)
-    kasko.report.ValidateCrashReport(report, expected_keys)
diff --git a/chrome/test/kasko/py/kasko/json_logging_handler.py b/chrome/test/kasko/py/kasko/json_logging_handler.py
deleted file mode 100755
index 8a26c38..0000000
--- a/chrome/test/kasko/py/kasko/json_logging_handler.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Logging handler used to log into a JSON file."""
-
-import json
-import logging
-
-
-class JSONLoggingHandler(logging.Handler):
-  """A logging handler that forwards log messages into a JSON file."""
-
-  def __init__(self, json_file):
-    logging.Handler.__init__(self)
-    formatter = logging.Formatter('%(name)s:%(message)s')
-    self.setFormatter(formatter)
-    self.json_file_ = json_file
-    self.log_messages_ = []
-
-  def close(self):
-    """Dump the list of log messages into the JSON file."""
-    with open(self.json_file_, 'w') as f:
-      f.write(json.dumps(self.log_messages_))
-    logging.Handler.close(self)
-
-  def emit(self, record):
-    """Append the record to list of messages."""
-    self.log_messages_.append({record.levelname: self.format(record)})
diff --git a/chrome/test/kasko/py/kasko/process.py b/chrome/test/kasko/py/kasko/process.py
deleted file mode 100755
index 89edaf25..0000000
--- a/chrome/test/kasko/py/kasko/process.py
+++ /dev/null
@@ -1,222 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Utilities for interacting with processes on a win32 system."""
-
-import logging
-import os
-import pywintypes
-import re
-import subprocess
-import sys
-import time
-import win32api
-import win32com.client
-import win32con
-import win32event
-import win32gui
-import win32process
-
-from kasko.util import ScopedStartStop
-
-
-_DEFAULT_TIMEOUT = 10  # Seconds.
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-def ImportSelenium(webdriver_dir=None):
-  """Imports Selenium from the given path."""
-  global webdriver
-  global service
-  if webdriver_dir:
-    sys.path.append(webdriver_dir)
-  from selenium import webdriver
-  import selenium.webdriver.chrome.service as service
-
-
-def FindChromeProcessId(user_data_dir, timeout=_DEFAULT_TIMEOUT):
-  """Finds the process ID of a given Chrome instance."""
-  udd = os.path.abspath(user_data_dir)
-
-  # Find the message window.
-  started = time.time()
-  elapsed = 0
-  msg_win = None
-  while msg_win is None:
-    try:
-      win = win32gui.FindWindowEx(None, None, 'Chrome_MessageWindow', udd)
-      if win != 0:
-        msg_win = win
-        break
-    except pywintypes.error:
-      continue
-
-    time.sleep(0.1)
-    elapsed = time.time() - started
-    if elapsed >= timeout:
-      raise TimeoutException()
-
-  # Get the process ID associated with the message window.
-  tid, pid = win32process.GetWindowThreadProcessId(msg_win)
-
-  return pid
-
-
-def ShutdownProcess(process_id, timeout, force=False):
-  """Attempts to nicely close the specified process.
-
-  Returns the exit code on success. Raises an error on failure.
-  """
-
-  # Open the process in question, so we can wait for it to exit.
-  permissions = win32con.SYNCHRONIZE | win32con.PROCESS_QUERY_INFORMATION
-  process_handle = win32api.OpenProcess(permissions, False, process_id)
-
-  # Loop around to periodically retry to close Chrome.
-  started = time.time()
-  elapsed = 0
-  while True:
-    _LOGGER.debug('Shutting down process with PID=%d.', process_id)
-
-    with open(os.devnull, 'w') as f:
-      cmd = ['taskkill.exe', '/PID', str(process_id)]
-      if force:
-        cmd.append('/F')
-      subprocess.call(cmd, shell=True, stdout=f, stderr=f)
-
-    # Wait at most 2 seconds after each call to taskkill.
-    curr_timeout_ms = int(max(2, timeout - elapsed) * 1000)
-
-    _LOGGER.debug('Waiting for process with PID=%d to exit.', process_id)
-    result = win32event.WaitForSingleObject(process_handle, curr_timeout_ms)
-    # Exit the loop on successful wait.
-    if result == win32event.WAIT_OBJECT_0:
-      break
-
-    elapsed = time.time() - started
-    if elapsed > timeout:
-      _LOGGER.debug('Timeout waiting for process to exit.')
-      raise TimeoutException()
-
-  exit_status = win32process.GetExitCodeProcess(process_handle)
-  process_handle.Close()
-  _LOGGER.debug('Process exited with status %d.', exit_status)
-
-  return exit_status
-
-
-def _WmiTimeToLocalEpoch(wmitime):
-  """Converts a WMI time string to a Unix epoch time."""
-  # The format of WMI times is: yyyymmddHHMMSS.xxxxxx[+-]UUU, where
-  # UUU is the number of minutes between local time and UTC.
-  m = re.match('^(?P<year>\d{4})(?P<month>\d{2})(?P<day>\d{2})'
-                   '(?P<hour>\d{2})(?P<minutes>\d{2})(?P<seconds>\d{2}\.\d+)'
-                   '(?P<offset>[+-]\d{3})$', wmitime)
-  if not m:
-    raise Exception('Invalid WMI time string.')
-
-  # This parses the time as a local time.
-  t = time.mktime(time.strptime(wmitime[0:14], '%Y%m%d%H%M%S'))
-
-  # Add the fractional part of the seconds that wasn't parsed by strptime.
-  s = float(m.group('seconds'))
-  t += s - int(s)
-
-  return t
-
-
-def GetProcessCreationDate(pid):
-  """Returns the process creation date as local unix epoch time."""
-  wmi = win32com.client.GetObject('winmgmts:')
-  procs = wmi.ExecQuery(
-      'select CreationDate from Win32_Process where ProcessId = %s' % pid)
-  for proc in procs:
-    return _WmiTimeToLocalEpoch(proc.Properties_('CreationDate').Value)
-  raise Exception('Unable to find process with PID %d.' % pid)
-
-
-def ShutdownChildren(parent_pid, child_exe, started_after, started_before,
-                     timeout=_DEFAULT_TIMEOUT, force=False):
-  """Shuts down any lingering child processes of a given parent.
-
-  This is an inherently racy thing to do as process IDs are aggressively reused
-  on Windows. Filtering by a valid known |started_after| and |started_before|
-  timestamp, as well as by the executable of the child process resolves this
-  issue. Ugh.
-  """
-  started = time.time()
-  wmi = win32com.client.GetObject('winmgmts:')
-  _LOGGER.debug('Shutting down lingering children processes.')
-  for proc in wmi.InstancesOf('Win32_Process'):
-    if proc.Properties_('ParentProcessId').Value != parent_pid:
-      continue
-    if proc.Properties_('ExecutablePath').Value != child_exe:
-      continue
-    t = _WmiTimeToLocalEpoch(proc.Properties_('CreationDate').Value)
-    if t <= started_after or t >= started_before:
-      continue
-    pid = proc.Properties_('ProcessId').Value
-    remaining = max(0, started + timeout - time.time())
-    ShutdownProcess(pid, remaining, force=force)
-
-
-class ChromeInstance(object):
-  """A class encapsulating a running instance of Chrome for testing.
-
-  The Chrome instance is controlled via chromedriver and Selenium."""
-
-  def __init__(self, chromedriver, chrome, user_data_dir):
-    self.chromedriver_ = os.path.abspath(chromedriver)
-    self.chrome_ = os.path.abspath(chrome)
-    self.user_data_dir_ = user_data_dir
-
-  def start(self, timeout=_DEFAULT_TIMEOUT):
-    capabilities = {
-          'chromeOptions': {
-            'args': [
-              # This allows automated navigation to chrome:// URLs.
-              '--enable-gpu-benchmarking',
-              '--user-data-dir=%s' % self.user_data_dir_,
-            ],
-            'binary': self.chrome_,
-          }
-        }
-
-    # Use a _ScopedStartStop helper so the service and driver clean themselves
-    # up in case of any exceptions.
-    _LOGGER.info('Starting chromedriver')
-    with ScopedStartStop(service.Service(self.chromedriver_)) as \
-        scoped_service:
-      _LOGGER.info('Starting chrome')
-      with ScopedStartStop(webdriver.Remote(scoped_service.service.service_url,
-                                            capabilities),
-                           start=lambda x: None, stop=lambda x: x.quit()) as \
-          scoped_driver:
-        self.pid_ = FindChromeProcessId(self.user_data_dir_, timeout)
-        self.started_at_ = GetProcessCreationDate(self.pid_)
-        _LOGGER.debug('Chrome launched.')
-        self.driver_ = scoped_driver.release()
-        self.service_ = scoped_service.release()
-
-
-  def stop(self, timeout=_DEFAULT_TIMEOUT):
-    started = time.time()
-    self.driver_.quit()
-    self.stopped_at_ = time.time()
-    self.service_.stop()
-    self.driver_ = None
-    self.service = None
-
-    # Ensure that any lingering children processes are torn down as well. This
-    # is generally racy on Windows, but is gated based on parent process ID,
-    # child executable, and start time of the child process. These criteria
-    # ensure we don't go indiscriminately killing processes.
-    remaining = max(0, started + timeout - time.time())
-    ShutdownChildren(self.pid_, self.chrome_, self.started_at_,
-                     self.stopped_at_, remaining, force=True)
-
-  def navigate_to(self, url):
-    """Navigates the running Chrome instance to the provided URL."""
-    self.driver_.get(url)
diff --git a/chrome/test/kasko/py/kasko/report.py b/chrome/test/kasko/py/kasko/report.py
deleted file mode 100755
index 401d71c2..0000000
--- a/chrome/test/kasko/py/kasko/report.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Utility functions for dealing with crash reports."""
-
-import logging
-import os
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-def LogCrashKeys(report):
-  for key in sorted(report.keys()):
-    val = report[key][0]
-    if (len(val) < 64):
-      _LOGGER.debug('Got crashkey "%s": "%s"', key, val)
-    else:
-      _LOGGER.debug('Got crashkey "%s": ...%d bytes...', key, len(val))
-
-
-def ValidateCrashReport(report, expectations=None):
-  expected_keys = {}
-
-  # The following keys are all expected to be set in all crashes, and should
-  # be set by GetCrashKeysForKasko. The 'channel' crash-key doesn't need to be
-  # set as it is omitted when empty (developer builds).
-  get_crash_keys = 'GetCrashKeysForKasko'
-  for k in ['guid', 'prod', 'plat', 'ver', 'ptype']:
-    expected_keys[k] = get_crash_keys
-
-  # The following crash keys are expected to be set by the Kasko code itself.
-  kasko = 'Kasko'
-  for k in ['kasko-generated-by-version', 'kasko-uploaded-by-version']:
-    expected_keys[k] = kasko
-
-  # Merge in additional expectations.
-  if expectations:
-    for key, value in expectations.iteritems():
-      expected_keys[key] = value
-
-  # Validate the expectations.
-  missing_keys = False
-  for expected_key, error in expected_keys.iteritems():
-    if expected_key not in report:
-      _LOGGER.error('Missing expected "%s" crash key.', expected_key)
-      _LOGGER.error('"%s" integration appears broken.', error)
-      missing_keys = True
-
-  if missing_keys:
-    raise Exception('Missing expected crash keys.')
diff --git a/chrome/test/kasko/py/kasko/util.py b/chrome/test/kasko/py/kasko/util.py
deleted file mode 100755
index 4189157f..0000000
--- a/chrome/test/kasko/py/kasko/util.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Various utilities useful for performing Kasko integration tests."""
-
-import logging
-import os
-import shutil
-import tempfile
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-
-
-class ScopedTempDir(object):
-  """A class that creates a scoped temporary directory."""
-
-  def __init__(self):
-    self.path_ = None
-
-  def __enter__(self):
-    """Creates the temporary directory and initializes |path|."""
-    self.path_ = tempfile.mkdtemp(prefix='kasko_integration_')
-    return self
-
-  def __exit__(self, *args, **kwargs):
-    """Destroys the temporary directory."""
-    if self.path_ is None:
-      return
-    shutil.rmtree(self.path_)
-
-  @property
-  def path(self):
-    return self.path_
-
-  def release(self):
-    path = self.path_
-    self.path_ = None
-    return path
-
-
-class ScopedStartStop(object):
-  """Utility class for calling 'start' and 'stop' within a scope."""
-
-  def __init__(self, service, start=None, stop=None):
-    self.service_ = service
-
-    if start is None:
-      self.start_ = lambda x: x.start()
-    else:
-      self.start_ = start
-
-    if stop is None:
-      self.stop_ = lambda x: x.stop()
-    else:
-      self.stop_ = stop
-
-  def __enter__(self):
-    self.start_(self.service_)
-    return self
-
-  def __exit__(self, *args, **kwargs):
-    if self.service_:
-      self.stop_(self.service_)
-
-  @property
-  def service(self):
-    """Returns the encapsulated service, retaining ownership."""
-    return self.service_
-
-  def release(self):
-    """Relinquishes ownership of the encapsulated service and returns it."""
-    service = self.service_
-    self.service_ = None
-    return service
diff --git a/chrome/test/kasko/syzyasan_integration_test.py b/chrome/test/kasko/syzyasan_integration_test.py
deleted file mode 100755
index b423cdf..0000000
--- a/chrome/test/kasko/syzyasan_integration_test.py
+++ /dev/null
@@ -1,282 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""A Windows-only end-to-end integration test for Kasko and SyzyAsan.
-
-This test ensures that the interface between SyzyAsan, Kasko and Chrome works
-as expected. The test causes a crash that should be detected by SyzyAsan and
-delivered via Kasko to a locally hosted test crash server.
-
-Note that this test only works against non-component Release and Official builds
-of Chrome with Chrome branding, and attempting to use it with anything else will
-most likely lead to constant failures.
-
-Typical usage (assuming in root 'src' directory):
-
-- generate project files with the following GYP variables:
-    syzyasan=1 win_z7=0 chromium_win_pch=0
-- build the release Chrome binaries:
-    ninja -C out\Release chrome.exe chromedriver.exe
-- run the test:
-    python chrome/test/kasko/syzyasan_integration_test.py
-"""
-
-import logging
-import os
-import optparse
-import re
-import shutil
-import subprocess
-import sys
-
-# Bring in the Kasko module.
-KASKO_DIR = os.path.join(os.path.dirname(__file__), 'py')
-sys.path.append(KASKO_DIR)
-import kasko
-
-
-_LOGGER = logging.getLogger(os.path.basename(__file__))
-_CHROME_DLL = 'chrome.dll'
-_INSTRUMENT = 'instrument.exe'
-_SYZYASAN_RTL = 'syzyasan_rtl.dll'
-
-
-def _ParseCommandLine():
-  self_dir = os.path.dirname(__file__)
-  src_dir = os.path.abspath(os.path.join(self_dir, '..', '..', '..'))
-
-  option_parser = kasko.config.GenerateOptionParser()
-  option_parser.add_option('--instrumented-dir', dest='instrumented_dir',
-      type='string',
-      help='Path where instrumented binaries will be placed. If instrumented '
-           'binaries already exist here they will be reused.')
-  option_parser.add_option('--skip-instrumentation',
-      dest='skip_instrumentation', action='store_true', default=False,
-      help='Skips instrumentation if specified. To be used when testing '
-           'against an already instrumented build of Chrome.')
-  option_parser.add_option('--syzygy-dir', dest='syzygy_dir', type='string',
-      default=os.path.join(src_dir, 'third_party', 'syzygy', 'binaries', 'exe'),
-      help='Path to Syzygy binaries. By default will look in third_party.')
-  options = kasko.config.ParseCommandLine(option_parser)
-
-  if not os.path.isdir(options.syzygy_dir):
-    option_parser.error('Invalid syzygy directory.')
-  for basename in [_INSTRUMENT, _SYZYASAN_RTL]:
-    path = os.path.join(options.syzygy_dir, basename)
-    if not os.path.isfile(path):
-      option_parser.error('Missing syzygy binary: %s' % path)
-
-  _LOGGER.debug('Using syzygy path: %s', options.syzygy_dir)
-
-  return options
-
-
-def _DecorateFilename(name, deco):
-  """Decorates a filename, transforming 'foo.baz.bar' to 'foo.dec.baz.bar'."""
-  d = os.path.dirname(name)
-  b = os.path.basename(name)
-  b = b.split('.', 1)
-  b.insert(1, deco)
-  return os.path.join(d, '.'.join(b))
-
-
-def _BackupFile(path, dst_dir):
-  """Creates a backup of a file in the specified directory."""
-  bak = os.path.abspath(os.path.join(dst_dir, os.path.basename(path)))
-  if os.path.exists(bak):
-    os.remove(bak)
-  # Copy the file, with its permissions and timestamps, etc.
-  _LOGGER.debug('Copying "%s" to "%s".' % (path, bak))
-  shutil.copyfile(path, bak)
-  shutil.copystat(path, bak)
-  return bak
-
-
-def _RestoreFile(path, backup):
-  """Restores a file from its backup. Leaves the backup file."""
-  if not os.path.exists(backup):
-    raise Exception('Backup does not exist: %s' % backup)
-  if os.path.exists(path):
-    os.remove(path)
-  _LOGGER.debug('Restoring "%s" from "%s".' % (path, backup))
-  shutil.copyfile(backup, path)
-  shutil.copystat(backup, path)
-
-
-class _ScopedInstrumentedChrome(object):
-  """SyzyAsan Instruments a Chrome installation in-place."""
-
-  def __init__(self, chrome_dir, syzygy_dir, temp_dir, instrumented_dir=None,
-               verbose=False, skip_instrumentation=False):
-    self.chrome_dir_ = chrome_dir
-    self.syzygy_dir_ = syzygy_dir
-    self.temp_dir_ = temp_dir
-    self.instrumented_dir_ = instrumented_dir
-    self.verbose_ = verbose
-    self.skip_instrumentation_ = skip_instrumentation
-
-  def _ProduceInstrumentedBinaries(self):
-    # Generate the instrumentation command-line. This will place the
-    # instrumented binaries in the temp directory.
-    instrument = os.path.abspath(os.path.join(self.syzygy_dir_, _INSTRUMENT))
-    cmd = [instrument,
-           '--mode=asan',
-           '--input-image=%s' % self.chrome_dll_bak_,
-           '--input-pdb=%s' % self.chrome_dll_pdb_bak_,
-           '--output-image=%s' % self.chrome_dll_inst_,
-           '--output-pdb=%s' % self.chrome_dll_pdb_inst_,
-           '--no-augment-pdb']
-
-    _LOGGER.debug('Instrumenting Chrome binaries.')
-
-    # If in verbose mode then let the instrumentation produce output directly.
-    if self.verbose_:
-      result = subprocess.call(cmd)
-    else:
-      # Otherwise run the command with all output suppressed.
-      proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE)
-      stdout, stderr = proc.communicate()
-      result = proc.returncode
-      if result != 0:
-        sys.stdout.write(stdout)
-        sys.stderr.write(stderr)
-
-    if result != 0:
-      raise Exception('Failed to instrument: %s' % self.chrome_dll_)
-
-    return
-
-  def __enter__(self):
-    """In-place instruments a Chrome installation with SyzyAsan."""
-    # Do nothing if instrumentation is to be skipped entirely.
-    if self.skip_instrumentation_:
-      _LOGGER.debug('Assuming binaries already instrumented.')
-      return self
-
-    # Build paths to the original Chrome binaries.
-    self.chrome_dll_ = os.path.abspath(os.path.join(
-        self.chrome_dir_, _CHROME_DLL))
-    self.chrome_dll_pdb_ = self.chrome_dll_ + '.pdb'
-
-    # Backup the original Chrome binaries to the temp directory.
-    orig_dir = os.path.join(self.temp_dir_, 'orig')
-    os.makedirs(orig_dir)
-    self.chrome_dll_bak_ = _BackupFile(self.chrome_dll_, orig_dir)
-    self.chrome_dll_pdb_bak_ = _BackupFile(self.chrome_dll_pdb_, orig_dir)
-
-    # Generate the path to the instrumented binaries.
-    inst_dir = os.path.join(self.temp_dir_, 'inst')
-    if self.instrumented_dir_:
-      inst_dir = self.instrumented_dir_
-    if not os.path.isdir(inst_dir):
-      os.makedirs(inst_dir)
-    self.chrome_dll_inst_ = os.path.abspath(os.path.join(
-        inst_dir, _DecorateFilename(_CHROME_DLL, 'inst')))
-    self.chrome_dll_pdb_inst_ = os.path.abspath(os.path.join(
-        inst_dir, _DecorateFilename(_CHROME_DLL + '.pdb', 'inst')))
-
-    # Only generate the instrumented binaries if they don't exist.
-    if (os.path.isfile(self.chrome_dll_inst_) and
-        os.path.isfile(self.chrome_dll_pdb_inst_)):
-      _LOGGER.debug('Using existing instrumented binaries.')
-    else:
-      self._ProduceInstrumentedBinaries()
-
-    # Replace the original chrome binaries with the instrumented versions.
-    _RestoreFile(self.chrome_dll_, self.chrome_dll_inst_)
-    _RestoreFile(self.chrome_dll_pdb_, self.chrome_dll_pdb_inst_)
-
-    # Copy the runtime library into the Chrome directory.
-    syzyasan_rtl = os.path.abspath(os.path.join(self.syzygy_dir_,
-                                                _SYZYASAN_RTL))
-    self.syzyasan_rtl_ = os.path.abspath(os.path.join(self.chrome_dir_,
-                                                      _SYZYASAN_RTL))
-    _RestoreFile(self.syzyasan_rtl_, syzyasan_rtl)
-
-    return self
-
-  def __exit__(self, *args, **kwargs):
-    # Do nothing if instrumentation is to be skipped entirely.
-    if self.skip_instrumentation_:
-      return
-
-    # Remove the RTL and restore the original Chrome binaries.
-    os.remove(self.syzyasan_rtl_)
-    _RestoreFile(self.chrome_dll_, self.chrome_dll_bak_)
-    _RestoreFile(self.chrome_dll_pdb_, self.chrome_dll_pdb_bak_)
-
-
-def Main():
-  options = _ParseCommandLine()
-
-  # Generate a temporary directory for use in the tests.
-  with kasko.util.ScopedTempDir() as temp_dir:
-    try:
-      # Prevent the temporary directory from self cleaning if requested.
-      if options.keep_temp_dirs:
-        temp_dir_path = temp_dir.release()
-      else:
-        temp_dir_path = temp_dir.path
-
-      # Use the specified user data directory if requested.
-      if options.user_data_dir:
-        user_data_dir = options.user_data_dir
-      else:
-        user_data_dir = os.path.join(temp_dir_path, 'user-data-dir')
-
-      kasko_dir = os.path.join(temp_dir_path, 'kasko')
-      os.makedirs(kasko_dir)
-
-      # Launch the test server.
-      server = kasko.crash_server.CrashServer()
-      with kasko.util.ScopedStartStop(server):
-        _LOGGER.info('Started server on port %d', server.port)
-
-        # Configure the environment so Chrome can find the test crash server.
-        os.environ['KASKO_CRASH_SERVER_URL'] = (
-            'http://127.0.0.1:%d/crash' % server.port)
-
-        # Configure the environment to disable feature randomization, which can
-        # result in Kasko being randomly disabled. Append to any existing
-        # options.
-        k = 'SYZYGY_ASAN_OPTIONS'
-        v = '--disable_feature_randomization'
-        if k in os.environ:
-          os.environ[k] += ' ' + v
-        else:
-          os.environ[k] = v
-
-        # SyzyAsan instrument the Chrome installation.
-        chrome_dir = os.path.dirname(options.chrome)
-        with _ScopedInstrumentedChrome(chrome_dir, options.syzygy_dir,
-            temp_dir_path, instrumented_dir=options.instrumented_dir,
-            verbose=(options.log_level == logging.DEBUG),
-            skip_instrumentation=options.skip_instrumentation) as asan_chrome:
-          # Launch Chrome and navigate it to the test URL.
-          chrome = kasko.process.ChromeInstance(options.chromedriver,
-                                                options.chrome, user_data_dir)
-          with kasko.util.ScopedStartStop(chrome):
-            _LOGGER.info('Navigating to SyzyAsan debug URL')
-            chrome.navigate_to('chrome://crash/browser-use-after-free')
-
-            _LOGGER.info('Waiting for Kasko report')
-            if not server.wait_for_report(10):
-              raise Exception('No Kasko report received.')
-
-      report = server.crash(0)
-      kasko.report.LogCrashKeys(report)
-      kasko.report.ValidateCrashReport(report, {'asan-error-type': 'SyzyAsan'})
-
-      _LOGGER.info('Test passed successfully!')
-    except Exception as e:
-      _LOGGER.error(e)
-      return 1
-
-    return 0
-
-
-if __name__ == '__main__':
-  sys.exit(Main())
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index d00459a..f7d03ee 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -521,12 +521,6 @@
     'buildtype': ['dev', 'official'],
     'optional': ['dev', 'official'],
   },
-  {
-    'filename': 'kasko.dll',
-    'arch': ['32bit'],
-    'buildtype': ['dev', 'official'],
-    'optional': ['dev', 'official'],
-  },
   # Test binaries for external QA:
   {
     'filename': 'interactive_ui_tests.exe',
@@ -672,13 +666,6 @@
     'optional': ['dev', 'official'],
   },
   {
-    'filename': 'kasko.dll.pdb',
-    'arch': ['32bit'],
-    'buildtype': ['dev', 'official'],
-    'archive': 'chrome-win32-syms.zip',
-    'optional': ['dev', 'official'],
-  },
-  {
     'filename': 'nacl_irt_x86_32.nexe.debug',
     'arch': ['32bit'],
     'buildtype': ['official'],
diff --git a/chrome/utility/chrome_content_utility_client.h b/chrome/utility/chrome_content_utility_client.h
index d00db735..d24f0b11 100644
--- a/chrome/utility/chrome_content_utility_client.h
+++ b/chrome/utility/chrome_content_utility_client.h
@@ -49,12 +49,6 @@
                        const base::FileDescriptor& dest_fd);
 #endif  // defined(OS_CHROMEOS)
 
-  void OnPatchFileBsdiff(const IPC::PlatformFileForTransit& input_file,
-                         const IPC::PlatformFileForTransit& patch_file,
-                         const IPC::PlatformFileForTransit& output_file);
-  void OnPatchFileCourgette(const IPC::PlatformFileForTransit& input_file,
-                            const IPC::PlatformFileForTransit& patch_file,
-                            const IPC::PlatformFileForTransit& output_file);
   void OnStartupPing();
 #if defined(FULL_SAFE_BROWSING)
   void OnAnalyzeZipFileForDownloadProtection(
diff --git a/chrome/utility/extensions/extensions_handler.cc b/chrome/utility/extensions/extensions_handler.cc
index f6f37b1f..c6e2a74b 100644
--- a/chrome/utility/extensions/extensions_handler.cc
+++ b/chrome/utility/extensions/extensions_handler.cc
@@ -96,7 +96,6 @@
 #else
     callback.Run(false);
 #endif
-    ReleaseProcessIfNeeded();
   }
 
   ChromeContentUtilityClient* const utility_client_;
diff --git a/components/autofill/core/browser/personal_data_manager_unittest.cc b/components/autofill/core/browser/personal_data_manager_unittest.cc
index 272dcce..f3f78d10 100644
--- a/components/autofill/core/browser/personal_data_manager_unittest.cc
+++ b/components/autofill/core/browser/personal_data_manager_unittest.cc
@@ -4254,14 +4254,7 @@
 
 // Tests the SaveImportedProfile method with different profiles to make sure the
 // merge logic works correctly.
-// Flaky on TSan, see crbug.com/686226.
-#if defined(THREAD_SANITIZER)
-#define MAYBE_SaveImportedProfile DISABLED_SaveImportedProfile
-#else
-#define MAYBE_SaveImportedProfile SaveImportedProfile
-#endif
-
-TEST_F(PersonalDataManagerTest, MAYBE_SaveImportedProfile) {
+TEST_F(PersonalDataManagerTest, SaveImportedProfile) {
   typedef struct {
     autofill::ServerFieldType field_type;
     std::string field_value;
@@ -4523,7 +4516,13 @@
        {{COMPANY_NAME, "Stark Inc."}}},
   };
 
+  // Create the test clock.
+  TestAutofillClock test_clock;
+
   for (TestCase test_case : test_cases) {
+    // Set the time to a specific value.
+    test_clock.SetNow(kArbitraryTime);
+
     SetupReferenceProfile();
     const std::vector<AutofillProfile*>& initial_profiles =
         personal_data_->GetProfiles();
@@ -4534,6 +4533,9 @@
           change.field_type, base::UTF8ToUTF16(change.field_value));
     }
 
+    // Set the time to a bigger value.
+    test_clock.SetNow(kSomeLaterTime);
+
     AutofillProfile profile2(base::GenerateGUID(), "https://www.example.com");
     test::SetProfileInfo(&profile2, "Marion", "Mitchell", "Morrison",
                          "johnwayne@me.xyz", "Fox", "123 Zoo St", "unit 5",
@@ -4565,11 +4567,8 @@
       // Verify that the merged profile's use count, use date and modification
       // date were properly updated.
       EXPECT_EQ(1U, saved_profiles.front()->use_count());
-      EXPECT_GT(base::TimeDelta::FromMilliseconds(500),
-                AutofillClock::Now() - saved_profiles.front()->use_date());
-      EXPECT_GT(
-          base::TimeDelta::FromMilliseconds(500),
-          AutofillClock::Now() - saved_profiles.front()->modification_date());
+      EXPECT_EQ(kSomeLaterTime, saved_profiles.front()->use_date());
+      EXPECT_EQ(kSomeLaterTime, saved_profiles.front()->modification_date());
     }
 
     // Erase the profiles for the next test.
diff --git a/components/crash/DEPS b/components/crash/DEPS
deleted file mode 100644
index 246d797..0000000
--- a/components/crash/DEPS
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules = [
-  # Header struct only, and only used when #define KASKO.
-  "+syzygy/kasko/api/crash_key.h",
-]
diff --git a/components/crash/content/app/BUILD.gn b/components/crash/content/app/BUILD.gn
index 0cf0c6ca..e035ac3 100644
--- a/components/crash/content/app/BUILD.gn
+++ b/components/crash/content/app/BUILD.gn
@@ -44,7 +44,6 @@
   public_deps = [
     ":app_non_mac_win",
     ":lib",
-    "//third_party/kasko",
   ]
   deps = [
     "//base",
diff --git a/components/crash/content/app/DEPS b/components/crash/content/app/DEPS
index 80bc21a3..dc5e9320 100644
--- a/components/crash/content/app/DEPS
+++ b/components/crash/content/app/DEPS
@@ -4,6 +4,5 @@
   "+content/public/common/content_descriptors.h",
   "+content/public/common/result_codes.h",
   "+third_party/crashpad",
-  "+third_party/kasko",
   "+third_party/lss/linux_syscall_support.h",
 ]
diff --git a/components/exo/pointer.cc b/components/exo/pointer.cc
index 3cf4b73..f0e76858e 100644
--- a/components/exo/pointer.cc
+++ b/components/exo/pointer.cc
@@ -50,7 +50,9 @@
 // Pointer, public:
 
 Pointer::Pointer(PointerDelegate* delegate)
-    : delegate_(delegate), cursor_(ui::kCursorNull) {
+    : delegate_(delegate),
+      cursor_(ui::kCursorNull),
+      cursor_capture_weak_ptr_factory_(this) {
   auto* helper = WMHelper::GetInstance();
   helper->AddPreTargetHandler(this);
   helper->AddCursorObserver(this);
@@ -121,7 +123,7 @@
   if (surface_) {
     CaptureCursor();
   } else {
-    cursor_captured_callback_.Cancel();
+    cursor_capture_weak_ptr_factory_.InvalidateWeakPtrs();
     cursor_ = ui::kCursorNone;
     UpdateCursor();
   }
@@ -152,6 +154,7 @@
       focus_->UnregisterCursorProvider(this);
       focus_ = nullptr;
       cursor_ = ui::kCursorNull;
+      cursor_capture_weak_ptr_factory_.InvalidateWeakPtrs();
     }
     // Second generate an enter event if focus moved to a new target.
     if (target) {
@@ -328,17 +331,16 @@
   float primary_device_scale_factor =
       display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor();
 
-  // Cancel pending capture and create a new request.
-  cursor_captured_callback_.Reset(
-      base::Bind(&Pointer::OnCursorCaptured, base::Unretained(this),
-                 gfx::ScaleToFlooredPoint(
-                     hotspot_,
-                     // |hotspot_| is in surface coordinate space so apply both
-                     // device scale and UI scale.
-                     cursor_scale_ * primary_device_scale_factor)));
-  surface_->window()->layer()->RequestCopyOfOutput(
+  std::unique_ptr<cc::CopyOutputRequest> request =
       cc::CopyOutputRequest::CreateBitmapRequest(
-          cursor_captured_callback_.callback()));
+          base::Bind(&Pointer::OnCursorCaptured,
+                     cursor_capture_weak_ptr_factory_.GetWeakPtr(),
+                     gfx::ScaleToFlooredPoint(
+                         hotspot_,
+                         // |hotspot_| is in surface coordinate space so apply
+                         // both device scale and UI scale.
+                         cursor_scale_ * primary_device_scale_factor)));
+  surface_->window()->layer()->RequestCopyOfOutput(std::move(request));
 }
 
 void Pointer::OnCursorCaptured(const gfx::Point& hotspot,
diff --git a/components/exo/pointer.h b/components/exo/pointer.h
index 262b95b..24feb2d3 100644
--- a/components/exo/pointer.h
+++ b/components/exo/pointer.h
@@ -7,8 +7,8 @@
 
 #include <memory>
 
-#include "base/cancelable_callback.h"
 #include "base/macros.h"
+#include "base/memory/weak_ptr.h"
 #include "components/exo/surface_delegate.h"
 #include "components/exo/surface_observer.h"
 #include "components/exo/wm_helper.h"
@@ -103,9 +103,8 @@
   // The current cursor.
   ui::Cursor cursor_;
 
-  // Cancelable callback for pending cursor capture.
-  base::CancelableCallback<void(std::unique_ptr<cc::CopyOutputResult>)>
-      cursor_captured_callback_;
+  // Weak pointer factory used for cursor capture callbacks.
+  base::WeakPtrFactory<Pointer> cursor_capture_weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(Pointer);
 };
diff --git a/components/nacl/broker/BUILD.gn b/components/nacl/broker/BUILD.gn
index aaf1de8..252ab4da 100644
--- a/components/nacl/broker/BUILD.gn
+++ b/components/nacl/broker/BUILD.gn
@@ -167,7 +167,6 @@
       "//components/policy:generated",
       "//content/public/common:static_switches",
       "//ipc",
-      "//third_party/kasko",
     ]
   }
 }
diff --git a/components/pdf/browser/BUILD.gn b/components/pdf/browser/BUILD.gn
index 8ec86e9..99f85ad 100644
--- a/components/pdf/browser/BUILD.gn
+++ b/components/pdf/browser/BUILD.gn
@@ -6,7 +6,6 @@
 
 static_library("browser") {
   sources = [
-    "open_pdf_in_reader_prompt_client.h",
     "pdf_web_contents_helper.cc",
     "pdf_web_contents_helper.h",
     "pdf_web_contents_helper_client.h",
diff --git a/components/pdf/browser/open_pdf_in_reader_prompt_client.h b/components/pdf/browser/open_pdf_in_reader_prompt_client.h
deleted file mode 100644
index 854e6f4..0000000
--- a/components/pdf/browser/open_pdf_in_reader_prompt_client.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_PDF_BROWSER_OPEN_PDF_IN_READER_PROMPT_CLIENT_H_
-#define COMPONENTS_PDF_BROWSER_OPEN_PDF_IN_READER_PROMPT_CLIENT_H_
-
-#include "base/strings/string16.h"
-
-namespace content {
-struct LoadCommittedDetails;
-}
-
-namespace pdf {
-
-class OpenPDFInReaderPromptClient {
- public:
-  virtual ~OpenPDFInReaderPromptClient() {}
-
-  virtual base::string16 GetMessageText() const = 0;
-
-  virtual base::string16 GetAcceptButtonText() const = 0;
-
-  virtual base::string16 GetCancelButtonText() const = 0;
-
-  virtual bool ShouldExpire(
-      const content::LoadCommittedDetails& details) const = 0;
-
-  virtual void Accept() = 0;
-
-  virtual void Cancel() = 0;
-};
-
-}  // namespace pdf
-
-#endif  // COMPONENTS_PDF_BROWSER_OPEN_PDF_IN_READER_PROMPT_CLIENT_H_
diff --git a/components/pdf/browser/pdf_web_contents_helper.cc b/components/pdf/browser/pdf_web_contents_helper.cc
index ae931d4e..e425338 100644
--- a/components/pdf/browser/pdf_web_contents_helper.cc
+++ b/components/pdf/browser/pdf_web_contents_helper.cc
@@ -8,10 +8,8 @@
 
 #include "base/bind.h"
 #include "base/strings/utf_string_conversions.h"
-#include "components/pdf/browser/open_pdf_in_reader_prompt_client.h"
 #include "components/pdf/browser/pdf_web_contents_helper_client.h"
 #include "components/pdf/common/pdf_messages.h"
-#include "content/public/browser/navigation_details.h"
 
 DEFINE_WEB_CONTENTS_USER_DATA_KEY(pdf::PDFWebContentsHelper);
 
@@ -35,12 +33,6 @@
 PDFWebContentsHelper::~PDFWebContentsHelper() {
 }
 
-void PDFWebContentsHelper::ShowOpenInReaderPrompt(
-    std::unique_ptr<OpenPDFInReaderPromptClient> prompt) {
-  open_in_reader_prompt_ = std::move(prompt);
-  UpdateLocationBar();
-}
-
 bool PDFWebContentsHelper::OnMessageReceived(
     const IPC::Message& message,
     content::RenderFrameHost* render_frame_host) {
@@ -56,20 +48,6 @@
   return handled;
 }
 
-void PDFWebContentsHelper::DidNavigateMainFrame(
-    const content::LoadCommittedDetails& details,
-    const content::FrameNavigateParams& params) {
-  if (open_in_reader_prompt_.get() &&
-      open_in_reader_prompt_->ShouldExpire(details)) {
-    open_in_reader_prompt_.reset();
-    UpdateLocationBar();
-  }
-}
-
-void PDFWebContentsHelper::UpdateLocationBar() {
-  client_->UpdateLocationBar(web_contents());
-}
-
 void PDFWebContentsHelper::OnHasUnsupportedFeature() {
   client_->OnPDFHasUnsupportedFeature(web_contents());
 }
diff --git a/components/pdf/browser/pdf_web_contents_helper.h b/components/pdf/browser/pdf_web_contents_helper.h
index 85d7d02a..c9a2e58 100644
--- a/components/pdf/browser/pdf_web_contents_helper.h
+++ b/components/pdf/browser/pdf_web_contents_helper.h
@@ -20,7 +20,6 @@
 
 namespace pdf {
 
-class OpenPDFInReaderPromptClient;
 class PDFWebContentsHelperClient;
 
 // Per-WebContents class to handle PDF messages.
@@ -32,13 +31,6 @@
       content::WebContents* contents,
       std::unique_ptr<PDFWebContentsHelperClient> client);
 
-  OpenPDFInReaderPromptClient* open_in_reader_prompt() const {
-    return open_in_reader_prompt_.get();
-  }
-
-  void ShowOpenInReaderPrompt(
-      std::unique_ptr<OpenPDFInReaderPromptClient> prompt);
-
  private:
   PDFWebContentsHelper(content::WebContents* web_contents,
                        std::unique_ptr<PDFWebContentsHelperClient> client);
@@ -47,21 +39,12 @@
   // content::WebContentsObserver overrides:
   bool OnMessageReceived(const IPC::Message& message,
                          content::RenderFrameHost* render_frame_host) override;
-  void DidNavigateMainFrame(
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) override;
-
-  // Internal helpers ----------------------------------------------------------
-
-  void UpdateLocationBar();
 
   // Message handlers.
   void OnHasUnsupportedFeature();
   void OnSaveURLAs(const GURL& url, const content::Referrer& referrer);
   void OnUpdateContentRestrictions(int content_restrictions);
 
-  // The model for the confirmation prompt to open a PDF in Adobe Reader.
-  std::unique_ptr<OpenPDFInReaderPromptClient> open_in_reader_prompt_;
   std::unique_ptr<PDFWebContentsHelperClient> client_;
 
   DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelper);
diff --git a/components/pdf/browser/pdf_web_contents_helper_client.h b/components/pdf/browser/pdf_web_contents_helper_client.h
index eb983bf4..9a6ae89 100644
--- a/components/pdf/browser/pdf_web_contents_helper_client.h
+++ b/components/pdf/browser/pdf_web_contents_helper_client.h
@@ -19,8 +19,6 @@
  public:
   virtual ~PDFWebContentsHelperClient() {}
 
-  virtual void UpdateLocationBar(content::WebContents* contents) = 0;
-
   virtual void UpdateContentRestrictions(content::WebContents* contents,
                                          int content_restrictions) = 0;
 
diff --git a/components/previews/core/previews_experiments.cc b/components/previews/core/previews_experiments.cc
index 3806bc9..df82562 100644
--- a/components/previews/core/previews_experiments.cc
+++ b/components/previews/core/previews_experiments.cc
@@ -64,6 +64,12 @@
 const char kOfflinePreviewFreshnessDurationInDays[] =
     "offline_preview_freshness_duration_in_days";
 
+// The threshold of EffectiveConnectionType above which previews will not be
+// served.
+// See net/nqe/effective_connection_type.h for mapping from string to value.
+const char kEffectiveConnectionTypeThreshold[] =
+    "max_allowed_effective_connection_type";
+
 // The string that corresponds to enabled for the variation param experiments.
 const char kExperimentEnabled[] = "true";
 
@@ -158,6 +164,16 @@
   return base::TimeDelta::FromDays(duration);
 }
 
+net::EffectiveConnectionType EffectiveConnectionTypeThreshold() {
+  std::string param_value = ParamValue(kEffectiveConnectionTypeThreshold);
+  net::EffectiveConnectionType effective_connection_type;
+  if (!net::GetEffectiveConnectionTypeForName(param_value,
+                                              &effective_connection_type)) {
+    effective_connection_type = net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
+  }
+  return effective_connection_type;
+}
+
 }  // namespace params
 
 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() {
diff --git a/components/previews/core/previews_experiments.h b/components/previews/core/previews_experiments.h
index 021db0a..ad0bded 100644
--- a/components/previews/core/previews_experiments.h
+++ b/components/previews/core/previews_experiments.h
@@ -6,6 +6,7 @@
 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_
 
 #include "base/time/time.h"
+#include "net/nqe/effective_connection_type.h"
 
 namespace previews {
 
@@ -43,6 +44,10 @@
 // shown as a preview.
 base::TimeDelta OfflinePreviewFreshnessDuration();
 
+// The threshold of EffectiveConnectionType above which previews should not be
+// served.
+net::EffectiveConnectionType EffectiveConnectionTypeThreshold();
+
 }  // namespace params
 
 enum class PreviewsType {
diff --git a/components/previews/core/previews_experiments_unittest.cc b/components/previews/core/previews_experiments_unittest.cc
index e5d9573..faf92cc 100644
--- a/components/previews/core/previews_experiments_unittest.cc
+++ b/components/previews/core/previews_experiments_unittest.cc
@@ -4,17 +4,145 @@
 
 #include "components/previews/core/previews_experiments.h"
 
+#include <string>
+
 #include "base/metrics/field_trial.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
+#include "components/variations/variations_associated_data.h"
+
 #include "testing/gtest/include/gtest/gtest.h"
 
+namespace previews {
+
 namespace {
 
 using PreviewsExperimentsTest = testing::Test;
 
+// Used as field trial values. Somewhat random yet valid values.
+const char kMaxStoredHistoryLengthPerHost[] = "3";
+const char kMaxStoredHistoryLengthHostIndifferent[] = "4";
+const char kMaxHostsInBlackList[] = "13";
+const char kPerHostOptOutThreshold[] = "12";
+const char kHostIndifferentOptOutThreshold[] = "84";
+const char kPerHostBlackListDurationInDays[] = "99";
+const char kHostIndifferentBlackListDurationInDays[] = "64";
+const char kSingleOptOutDurationInSeconds[] = "28";
+const char kOfflinePreviewFreshnessDurationInDays[] = "12";
+const char kEffectiveConnectionTypeThreshold[] = "4G";
+
+// Verifies that the default params are the expected values.
+void VerifyDefaultParams() {
+  EXPECT_EQ(4u, params::MaxStoredHistoryLengthForPerHostBlackList());
+  EXPECT_EQ(10u, params::MaxStoredHistoryLengthForHostIndifferentBlackList());
+  EXPECT_EQ(100u, params::MaxInMemoryHostsInBlackList());
+  EXPECT_EQ(2, params::PerHostBlackListOptOutThreshold());
+  EXPECT_EQ(4, params::HostIndifferentBlackListOptOutThreshold());
+  EXPECT_EQ(base::TimeDelta::FromDays(30), params::PerHostBlackListDuration());
+  EXPECT_EQ(base::TimeDelta::FromDays(365 * 100),
+            params::HostIndifferentBlackListPerHostDuration());
+  EXPECT_EQ(base::TimeDelta::FromSeconds(60 * 5),
+            params::SingleOptOutDuration());
+  EXPECT_EQ(base::TimeDelta::FromDays(7),
+            params::OfflinePreviewFreshnessDuration());
+  EXPECT_EQ(net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
+            params::EffectiveConnectionTypeThreshold());
+}
+
+// Creates a map of the params names to the const string values above.
+std::map<std::string, std::string> GetFieldTrialParams() {
+  std::map<std::string, std::string> params;
+  // Assign different values than defaults.
+  params["per_host_max_stored_history_length"] = kMaxStoredHistoryLengthPerHost;
+  params["host_indifferent_max_stored_history_length"] =
+      kMaxStoredHistoryLengthHostIndifferent;
+  params["max_hosts_in_blacklist"] = kMaxHostsInBlackList;
+  params["per_host_opt_out_threshold"] = kPerHostOptOutThreshold;
+  params["host_indifferent_opt_out_threshold"] =
+      kHostIndifferentOptOutThreshold;
+  params["per_host_black_list_duration_in_days"] =
+      kPerHostBlackListDurationInDays;
+  params["host_indifferent_black_list_duration_in_days"] =
+      kHostIndifferentBlackListDurationInDays;
+  params["single_opt_out_duration_in_seconds"] = kSingleOptOutDurationInSeconds;
+  params["offline_preview_freshness_duration_in_days"] =
+      kOfflinePreviewFreshnessDurationInDays;
+  params["max_allowed_effective_connection_type"] =
+      kEffectiveConnectionTypeThreshold;
+
+  return params;
+}
+
+// Verifies that calling the params methods returns the correct values based on
+// the const string values above.
+void VerifyNewParams() {
+  {
+    size_t history_length;
+    EXPECT_TRUE(
+        base::StringToSizeT(kMaxStoredHistoryLengthPerHost, &history_length));
+    EXPECT_EQ(history_length,
+              params::MaxStoredHistoryLengthForPerHostBlackList());
+  }
+  {
+    size_t history_length;
+    EXPECT_TRUE(base::StringToSizeT(kMaxStoredHistoryLengthHostIndifferent,
+                                    &history_length));
+    EXPECT_EQ(history_length,
+              params::MaxStoredHistoryLengthForHostIndifferentBlackList());
+  }
+  {
+    size_t history_length;
+    EXPECT_TRUE(base::StringToSizeT(kMaxHostsInBlackList, &history_length));
+    EXPECT_EQ(history_length, params::MaxInMemoryHostsInBlackList());
+  }
+  {
+    int threshold;
+    EXPECT_TRUE(base::StringToInt(kPerHostOptOutThreshold, &threshold));
+    EXPECT_EQ(threshold, params::PerHostBlackListOptOutThreshold());
+  }
+  {
+    int threshold;
+    EXPECT_TRUE(base::StringToInt(kHostIndifferentOptOutThreshold, &threshold));
+    EXPECT_EQ(threshold, params::HostIndifferentBlackListOptOutThreshold());
+  }
+  {
+    int days;
+    EXPECT_TRUE(base::StringToInt(kPerHostBlackListDurationInDays, &days));
+    EXPECT_EQ(base::TimeDelta::FromDays(days),
+              params::PerHostBlackListDuration());
+  }
+  {
+    int days;
+    EXPECT_TRUE(
+        base::StringToInt(kHostIndifferentBlackListDurationInDays, &days));
+    EXPECT_EQ(base::TimeDelta::FromDays(days),
+              params::HostIndifferentBlackListPerHostDuration());
+  }
+  {
+    int seconds;
+    EXPECT_TRUE(base::StringToInt(kSingleOptOutDurationInSeconds, &seconds));
+    EXPECT_EQ(base::TimeDelta::FromSeconds(seconds),
+              params::SingleOptOutDuration());
+  }
+  {
+    int days;
+    EXPECT_TRUE(
+        base::StringToInt(kOfflinePreviewFreshnessDurationInDays, &days));
+    EXPECT_EQ(base::TimeDelta::FromDays(days),
+              params::OfflinePreviewFreshnessDuration());
+  }
+  {
+    net::EffectiveConnectionType effective_connection_type;
+    EXPECT_TRUE(net::GetEffectiveConnectionTypeForName(
+        kEffectiveConnectionTypeThreshold, &effective_connection_type));
+    EXPECT_EQ(effective_connection_type,
+              params::EffectiveConnectionTypeThreshold());
+  }
+}
+
 }  // namespace
 
-namespace previews {
-
+// Verifies that we can enable offline previews via field trial.
 TEST_F(PreviewsExperimentsTest, TestFieldTrialOfflinePage) {
   EXPECT_FALSE(IsIncludedInClientSidePreviewsExperimentsFieldTrial());
   EXPECT_FALSE(IsPreviewsTypeEnabled(PreviewsType::OFFLINE));
@@ -24,6 +152,20 @@
 
   EXPECT_TRUE(IsIncludedInClientSidePreviewsExperimentsFieldTrial());
   EXPECT_TRUE(IsPreviewsTypeEnabled(PreviewsType::OFFLINE));
+  variations::testing::ClearAllVariationParams();
+}
+
+// Verifies that we can enable offline previews via field trial and that the
+// default params for previews field trials are accurate.
+TEST_F(PreviewsExperimentsTest, TestAllDefaultParams) {
+  VerifyDefaultParams();
+  base::FieldTrialList field_trial_list(nullptr);
+  EXPECT_TRUE(variations::AssociateVariationParams(
+      "ClientSidePreviews", "Enabled", GetFieldTrialParams()));
+  EXPECT_TRUE(
+      base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled"));
+  VerifyNewParams();
+  variations::testing::ClearAllVariationParams();
 }
 
 }  // namespace previews
diff --git a/components/previews/core/previews_io_data.cc b/components/previews/core/previews_io_data.cc
index 9c333b2..0a7af37 100644
--- a/components/previews/core/previews_io_data.cc
+++ b/components/previews/core/previews_io_data.cc
@@ -113,7 +113,7 @@
     return false;
   }
   if (network_quality_estimator->GetEffectiveConnectionType() >
-      net::EFFECTIVE_CONNECTION_TYPE_SLOW_2G) {
+      params::EffectiveConnectionTypeThreshold()) {
     LogPreviewsEligibilityReason(PreviewsEligibilityReason::NETWORK_NOT_SLOW,
                                  type);
     return false;
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc
index 89c4601..00a3863 100644
--- a/components/printing/renderer/print_web_view_helper.cc
+++ b/components/printing/renderer/print_web_view_helper.cc
@@ -1855,11 +1855,16 @@
   int dpi = static_cast<int>(params.params.dpi);
   // Calculate the actual page size and content area in dpi.
   if (page_size_in_dpi) {
+    // Windows uses this for the actual page size. We have scaled page size
+    // to get blink to reflow the page, so scale it back to the real size
+    // before returning it.
     *page_size_in_dpi =
         gfx::Size(static_cast<int>(ConvertUnitDouble(page_size.width(),
-                                                     kPointsPerInch, dpi)),
+                                                     kPointsPerInch, dpi) *
+                                   css_scale_factor),
                   static_cast<int>(ConvertUnitDouble(page_size.height(),
-                                                     kPointsPerInch, dpi)));
+                                                     kPointsPerInch, dpi) *
+                                   css_scale_factor));
   }
 
   if (content_area_in_dpi) {
diff --git a/components/safe_browsing/base_blocking_page.cc b/components/safe_browsing/base_blocking_page.cc
index 8a6db51..2b3f8e2 100644
--- a/components/safe_browsing/base_blocking_page.cc
+++ b/components/safe_browsing/base_blocking_page.cc
@@ -62,10 +62,9 @@
 
 // static
 const SafeBrowsingErrorUI::SBErrorDisplayOptions
-BaseBlockingPage::CreateDefaultDisplayOptions(
-    const UnsafeResourceList& unsafe_resources) {
+BaseBlockingPage::CreateDefaultDisplayOptions() {
   return SafeBrowsingErrorUI::SBErrorDisplayOptions(
-      IsMainPageLoadBlocked(unsafe_resources),
+      true,    // IsMainPageLoadBlocked()
       false,   // kSafeBrowsingExtendedReportingOptInAllowed
       false,   // is_off_the_record
       false,   // is_extended_reporting
@@ -97,7 +96,7 @@
                 ui_manager->history_service(web_contents),
                 ui_manager->app_locale(),
                 ui_manager->default_safe_page()),
-                CreateDefaultDisplayOptions(resources));
+                CreateDefaultDisplayOptions());
     blocking_page->Show();
     return;
   }
diff --git a/components/safe_browsing/base_blocking_page.h b/components/safe_browsing/base_blocking_page.h
index 3e031bba..f1cb3a90 100644
--- a/components/safe_browsing/base_blocking_page.h
+++ b/components/safe_browsing/base_blocking_page.h
@@ -35,7 +35,7 @@
   ~BaseBlockingPage() override;
 
   static const SafeBrowsingErrorUI::SBErrorDisplayOptions
-  CreateDefaultDisplayOptions(const UnsafeResourceList& unsafe_resources);
+  CreateDefaultDisplayOptions();
 
   // Shows a blocking page warning the user about phishing/malware for a
   // specific resource.
diff --git a/components/safe_browsing_db/android/safe_browsing_api_handler_bridge.cc b/components/safe_browsing_db/android/safe_browsing_api_handler_bridge.cc
index c51337c..6798dd03 100644
--- a/components/safe_browsing_db/android/safe_browsing_api_handler_bridge.cc
+++ b/components/safe_browsing_db/android/safe_browsing_api_handler_bridge.cc
@@ -102,16 +102,12 @@
           callback_id));
 
   if (result_status != RESULT_STATUS_SUCCESS) {
-    // TODO(nparker): If the API is consistently failing, we might want to
-    // turn it off altogether and retest periodically. This would
-    // alleviate a bad experience if GMSCore is somehow busted.
     if (result_status == RESULT_STATUS_TIMEOUT) {
       ReportUmaResult(UMA_STATUS_TIMEOUT);
       VLOG(1) << "Safe browsing API call timed-out";
     } else {
       DCHECK_EQ(result_status, RESULT_STATUS_INTERNAL_ERROR);
       ReportUmaResult(UMA_STATUS_INTERNAL_ERROR);
-      LOG(WARNING) << "Safe browsing API had internal error";
     }
     RunCallbackOnIOThread(callback.release(), SB_THREAT_TYPE_SAFE,
                           ThreatMetadata());
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver.cc
index 421c4b5..e54de762 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver.cc
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver.cc
@@ -16,13 +16,13 @@
 ContentSubresourceFilterDriver::~ContentSubresourceFilterDriver() {}
 
 void ContentSubresourceFilterDriver::ActivateForProvisionalLoad(
-    ActivationState activation_state,
+    ActivationLevel activation_level,
     const GURL& url,
     bool measure_performance) {
   // Must use legacy IPC to ensure the activation message arrives in-order, i.e.
   // before the load is committed on the renderer side.
   render_frame_host_->Send(new SubresourceFilterMsg_ActivateForProvisionalLoad(
-      render_frame_host_->GetRoutingID(), activation_state, url,
+      render_frame_host_->GetRoutingID(), activation_level, url,
       measure_performance));
 }
 
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver.h b/components/subresource_filter/content/browser/content_subresource_filter_driver.h
index dff92cd..b340999c 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver.h
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver.h
@@ -6,7 +6,7 @@
 #define COMPONENTS_SUBRESOURCE_FILTER_CONTENT_BROWSER_CONTENT_SUBRESOURCE_FILTER_DRIVER_H_
 
 #include "base/macros.h"
-#include "components/subresource_filter/core/common/activation_state.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 
 class GURL;
 
@@ -26,7 +26,7 @@
 
   // Instructs the agent on the renderer to set up the subresource filter for
   // the currently ongoing provisional document load in the frame.
-  virtual void ActivateForProvisionalLoad(ActivationState activation_state,
+  virtual void ActivateForProvisionalLoad(ActivationLevel activation_level,
                                           const GURL& url,
                                           bool measure_performance);
 
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
index 0fc1ef5..78935d5 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.cc
@@ -67,7 +67,7 @@
     std::unique_ptr<SubresourceFilterClient> client)
     : content::WebContentsObserver(web_contents),
       client_(std::move(client)),
-      activation_state_(ActivationState::DISABLED),
+      activation_level_(ActivationLevel::DISABLED),
       measure_performance_(false) {
   content::RenderFrameHost* main_frame_host = web_contents->GetMainFrame();
   if (main_frame_host && main_frame_host->IsRenderFrameLive())
@@ -88,8 +88,8 @@
 }
 
 void ContentSubresourceFilterDriverFactory::OnFirstSubresourceLoadDisallowed() {
-  client_->ToggleNotificationVisibility(activation_state_ ==
-                                        ActivationState::ENABLED);
+  client_->ToggleNotificationVisibility(activation_level_ ==
+                                        ActivationLevel::ENABLED);
 }
 
 void ContentSubresourceFilterDriverFactory::OnDocumentLoadStatistics(
@@ -155,10 +155,10 @@
 void ContentSubresourceFilterDriverFactory::ActivateForFrameHostIfNeeded(
     content::RenderFrameHost* render_frame_host,
     const GURL& url) {
-  if (activation_state_ != ActivationState::DISABLED) {
+  if (activation_level_ != ActivationLevel::DISABLED) {
     auto* driver = DriverFromFrameHost(render_frame_host);
     DCHECK(driver);
-    driver->ActivateForProvisionalLoad(GetMaximumActivationState(), url,
+    driver->ActivateForProvisionalLoad(GetMaximumActivationLevel(), url,
                                        measure_performance_);
   }
 }
@@ -193,7 +193,7 @@
     navigation_chain_.push_back(navigation_handle->GetURL());
 
     client_->ToggleNotificationVisibility(false);
-    activation_state_ = ActivationState::DISABLED;
+    activation_level_ = ActivationLevel::DISABLED;
     measure_performance_ = false;
     aggregated_document_statistics_ = DocumentLoadStatistics();
   }
@@ -231,7 +231,7 @@
   if (render_frame_host->GetParent())
     return;
 
-  if (activation_state_ != ActivationState::DISABLED) {
+  if (activation_level_ != ActivationLevel::DISABLED) {
     UMA_HISTOGRAM_COUNTS_1000(
         "SubresourceFilter.PageLoad.NumSubresourceLoads.Total",
         aggregated_document_statistics_.num_loads_total);
@@ -247,7 +247,7 @@
   }
 
   if (measure_performance_) {
-    DCHECK(activation_state_ != ActivationState::DISABLED);
+    DCHECK(activation_level_ != ActivationLevel::DISABLED);
     UMA_HISTOGRAM_CUSTOM_MICRO_TIMES(
         "SubresourceFilter.PageLoad.SubresourceEvaluation.TotalWallDuration",
         aggregated_document_statistics_.evaluation_total_wall_duration,
@@ -286,12 +286,12 @@
   if (!render_frame_host->GetParent()) {
     RecordRedirectChainMatchPattern();
     if (ShouldActivateForMainFrameURL(url)) {
-      activation_state_ = GetMaximumActivationState();
-      measure_performance_ = activation_state_ != ActivationState::DISABLED &&
+      activation_level_ = GetMaximumActivationLevel();
+      measure_performance_ = activation_level_ != ActivationLevel::DISABLED &&
                              ShouldMeasurePerformanceForPageLoad();
       ActivateForFrameHostIfNeeded(render_frame_host, url);
     } else {
-      activation_state_ = ActivationState::DISABLED;
+      activation_level_ = ActivationLevel::DISABLED;
       measure_performance_ = false;
       aggregated_document_statistics_ = DocumentLoadStatistics();
     }
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
index 7b6e20d..49727a6 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory.h
@@ -32,7 +32,7 @@
 
 class ContentSubresourceFilterDriver;
 class SubresourceFilterClient;
-enum class ActivationState;
+enum class ActivationLevel;
 enum class ActivationList;
 
 using HostPathSet = std::set<std::string>;
@@ -133,7 +133,7 @@
 
   HostPathSet whitelisted_hosts_;
 
-  ActivationState activation_state_;
+  ActivationLevel activation_level_;
   bool measure_performance_;
 
   // The URLs in the navigation chain.
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
index 75db9c7..1f9fb59 100644
--- a/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
+++ b/components/subresource_filter/content/browser/content_subresource_filter_driver_factory_unittest.cc
@@ -123,15 +123,15 @@
      kActivationScopeActivationList},
 };
 
-struct ActivationStateTestData {
+struct ActivationLevelTestData {
   bool expected_activation;
-  const char* const activation_state;
+  const char* const activation_level;
 };
 
-const ActivationStateTestData kActivationStateTestData[] = {
-    {true /* expected_activation */, kActivationStateDryRun},
-    {true /* expected_activation */, kActivationStateEnabled},
-    {false /* expected_activation */, kActivationStateDisabled},
+const ActivationLevelTestData kActivationLevelTestData[] = {
+    {true /* expected_activation */, kActivationLevelDryRun},
+    {true /* expected_activation */, kActivationLevelEnabled},
+    {false /* expected_activation */, kActivationLevelDisabled},
 };
 
 class MockSubresourceFilterDriver : public ContentSubresourceFilterDriver {
@@ -143,7 +143,7 @@
   ~MockSubresourceFilterDriver() override = default;
 
   MOCK_METHOD3(ActivateForProvisionalLoad,
-               void(ActivationState, const GURL&, bool));
+               void(ActivationLevel, const GURL&, bool));
 
  private:
   DISALLOW_COPY_AND_ASSIGN(MockSubresourceFilterDriver);
@@ -361,16 +361,16 @@
       ContentSubresourceFilterDriverFactoryActivationScopeTest);
 };
 
-class ContentSubresourceFilterDriverFactoryActivationStateTest
+class ContentSubresourceFilterDriverFactoryActivationLevelTest
     : public ContentSubresourceFilterDriverFactoryTest,
-      public ::testing::WithParamInterface<ActivationStateTestData> {
+      public ::testing::WithParamInterface<ActivationLevelTestData> {
  public:
-  ContentSubresourceFilterDriverFactoryActivationStateTest() {}
-  ~ContentSubresourceFilterDriverFactoryActivationStateTest() override {}
+  ContentSubresourceFilterDriverFactoryActivationLevelTest() {}
+  ~ContentSubresourceFilterDriverFactoryActivationLevelTest() override {}
 
  private:
   DISALLOW_COPY_AND_ASSIGN(
-      ContentSubresourceFilterDriverFactoryActivationStateTest);
+      ContentSubresourceFilterDriverFactoryActivationLevelTest);
 };
 
 TEST_F(ContentSubresourceFilterDriverFactoryTest,
@@ -379,7 +379,7 @@
   // which is visited was a SB hit.
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_DISABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_DISABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeAllSites,
       kActivationListSocialEngineeringAdsInterstitial);
   const GURL url(kExampleUrlWithParams);
@@ -393,7 +393,7 @@
 TEST_F(ContentSubresourceFilterDriverFactoryTest, NoActivationWhenNoMatch) {
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeActivationList,
       kActivationListSocialEngineeringAdsInterstitial);
   NavigateAndExpectActivation({false}, {GURL(kExampleUrl)}, EMPTY,
@@ -406,7 +406,7 @@
   // signal is always sent.
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeAllSites);
   EmulateInPageNavigation({false}, EMPTY, true /* expected_activation */);
 }
@@ -415,7 +415,7 @@
        SpecialCaseNavigationActivationListEnabled) {
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeActivationList,
       kActivationListSocialEngineeringAdsInterstitial);
   EmulateInPageNavigation({true}, NO_REDIRECTS_HIT,
@@ -426,7 +426,7 @@
        SpecialCaseNavigationActivationListEnabledWithPerformanceMeasurement) {
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeActivationList,
       kActivationListSocialEngineeringAdsInterstitial,
       "1" /* performance_measurement_rate */);
@@ -437,7 +437,7 @@
 TEST_F(ContentSubresourceFilterDriverFactoryTest, RedirectPatternTest) {
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeActivationList,
       kActivationListSocialEngineeringAdsInterstitial);
   struct RedirectRedirectChainMatchPatternTestData {
@@ -504,12 +504,12 @@
   }
 }
 
-TEST_P(ContentSubresourceFilterDriverFactoryActivationStateTest,
+TEST_P(ContentSubresourceFilterDriverFactoryActivationLevelTest,
        ActivateForFrameState) {
-  const ActivationStateTestData& test_data = GetParam();
+  const ActivationLevelTestData& test_data = GetParam();
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, test_data.activation_state,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, test_data.activation_level,
       kActivationScopeActivationList,
       kActivationListSocialEngineeringAdsInterstitial);
 
@@ -529,7 +529,7 @@
   const ActivationListTestData& test_data = GetParam();
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       kActivationScopeActivationList, test_data.activation_list);
 
   const GURL test_url("https://example.com/nonsoceng?q=engsocnon");
@@ -548,7 +548,7 @@
   const ActivationScopeTestData& test_data = GetParam();
   base::FieldTrialList field_trial_list(nullptr);
   testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
-      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationStateEnabled,
+      base::FeatureList::OVERRIDE_ENABLE_FEATURE, kActivationLevelEnabled,
       test_data.activation_scope,
       kActivationListSocialEngineeringAdsInterstitial);
 
@@ -577,8 +577,8 @@
     ::testing::ValuesIn(kActivationScopeTestData));
 
 INSTANTIATE_TEST_CASE_P(
-    ActivationStateTest,
-    ContentSubresourceFilterDriverFactoryActivationStateTest,
-    ::testing::ValuesIn(kActivationStateTestData));
+    ActivationLevelTest,
+    ContentSubresourceFilterDriverFactoryActivationLevelTest,
+    ::testing::ValuesIn(kActivationLevelTestData));
 
 }  // namespace subresource_filter
diff --git a/components/subresource_filter/content/common/subresource_filter_messages.h b/components/subresource_filter/content/common/subresource_filter_messages.h
index c1c92ac..209c684 100644
--- a/components/subresource_filter/content/common/subresource_filter_messages.h
+++ b/components/subresource_filter/content/common/subresource_filter_messages.h
@@ -6,17 +6,17 @@
 
 #include "base/time/time.h"
 #include "components/subresource_filter/content/common/document_load_statistics.h"
-#include "components/subresource_filter/core/common/activation_state.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 #include "content/public/common/common_param_traits_macros.h"
-#include "ipc/ipc_message_macros.h"
 #include "ipc/ipc_message.h"
+#include "ipc/ipc_message_macros.h"
 #include "ipc/ipc_platform_file.h"
 #include "url/ipc/url_param_traits.h"
 
 #define IPC_MESSAGE_START SubresourceFilterMsgStart
 
-IPC_ENUM_TRAITS_MAX_VALUE(subresource_filter::ActivationState,
-                          subresource_filter::ActivationState::LAST);
+IPC_ENUM_TRAITS_MAX_VALUE(subresource_filter::ActivationLevel,
+                          subresource_filter::ActivationLevel::LAST);
 
 IPC_STRUCT_TRAITS_BEGIN(subresource_filter::DocumentLoadStatistics)
   IPC_STRUCT_TRAITS_MEMBER(num_loads_total)
@@ -40,9 +40,9 @@
 // Instructs the renderer to activate subresource filtering for the currently
 // ongoing provisional document load in a frame. The message must arrive after
 // the provisional load starts, but before it is committed on the renderer side.
-// If no message arrives, the default behavior is ActivationState::DISABLED.
+// If no message arrives, the default behavior is ActivationLevel::DISABLED.
 IPC_MESSAGE_ROUTED3(SubresourceFilterMsg_ActivateForProvisionalLoad,
-                    subresource_filter::ActivationState /* activation_state */,
+                    subresource_filter::ActivationLevel /* activation_level */,
                     GURL /* url */,
                     bool /* measure_performance */);
 
diff --git a/components/subresource_filter/content/renderer/document_subresource_filter.cc b/components/subresource_filter/content/renderer/document_subresource_filter.cc
index 3debaea..42da608 100644
--- a/components/subresource_filter/content/renderer/document_subresource_filter.cc
+++ b/components/subresource_filter/content/renderer/document_subresource_filter.cc
@@ -76,12 +76,12 @@
 }  // namespace
 
 DocumentSubresourceFilter::DocumentSubresourceFilter(
-    ActivationState activation_state,
+    ActivationLevel activation_level,
     bool measure_performance,
     const scoped_refptr<const MemoryMappedRuleset>& ruleset,
     const std::vector<GURL>& ancestor_document_urls,
     const base::Closure& first_disallowed_load_callback)
-    : activation_state_(activation_state),
+    : activation_level_(activation_level),
       measure_performance_(measure_performance),
       ruleset_(ruleset),
       ruleset_matcher_(ruleset_->data(), ruleset_->length()),
@@ -96,7 +96,7 @@
   SCOPED_UMA_HISTOGRAM_MICRO_THREAD_TIMER(
       "SubresourceFilter.DocumentLoad.Activation.CPUDuration");
 
-  DCHECK_NE(activation_state_, ActivationState::DISABLED);
+  DCHECK_NE(activation_level_, ActivationLevel::DISABLED);
   DCHECK(ruleset);
 
   url::Origin parent_document_origin;
@@ -161,7 +161,7 @@
           GURL(resourceUrl), *document_origin_, ToElementType(request_context),
           generic_blocking_rules_disabled_)) {
     ++statistics_.num_loads_matching_rules;
-    if (activation_state_ == ActivationState::ENABLED) {
+    if (activation_level_ == ActivationLevel::ENABLED) {
       if (!first_disallowed_load_callback_.is_null()) {
         DCHECK_EQ(statistics_.num_loads_disallowed, 0);
         first_disallowed_load_callback_.Run();
diff --git a/components/subresource_filter/content/renderer/document_subresource_filter.h b/components/subresource_filter/content/renderer/document_subresource_filter.h
index 8c15cb8..d09ac3b 100644
--- a/components/subresource_filter/content/renderer/document_subresource_filter.h
+++ b/components/subresource_filter/content/renderer/document_subresource_filter.h
@@ -15,7 +15,7 @@
 #include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
 #include "components/subresource_filter/content/common/document_load_statistics.h"
-#include "components/subresource_filter/core/common/activation_state.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 #include "components/subresource_filter/core/common/indexed_ruleset.h"
 #include "third_party/WebKit/public/platform/WebDocumentSubresourceFilter.h"
 #include "url/gurl.h"
@@ -32,8 +32,8 @@
       public base::SupportsWeakPtr<DocumentSubresourceFilter> {
  public:
   // Constructs a new filter that will:
-  //  -- Operate at the prescribed |activation_state|, which must be either
-  //     ActivationState::DRYRUN or ActivationState::ENABLED. In the former
+  //  -- Operate at the prescribed |activation_level|, which must be either
+  //     ActivationLevel::DRYRUN or ActivationLevel::ENABLED. In the former
   //     case filtering will be performed but no loads will be disallowed.
   //  -- Hold a reference to and use |ruleset| for its entire lifetime.
   //  -- Expect |ancestor_document_urls| to be the URLs of documents loaded into
@@ -42,7 +42,7 @@
   //  -- Invoke |first_disallowed_load_callback|, if it is non-null, on the
   //     first disallowed subresource load.
   DocumentSubresourceFilter(
-      ActivationState activation_state,
+      ActivationLevel activation_level,
       bool measure_performance,
       const scoped_refptr<const MemoryMappedRuleset>& ruleset,
       const std::vector<GURL>& ancestor_document_urls,
@@ -56,7 +56,7 @@
                  blink::WebURLRequest::RequestContext) override;
 
  private:
-  const ActivationState activation_state_;
+  const ActivationLevel activation_level_;
   const bool measure_performance_;
 
   scoped_refptr<const MemoryMappedRuleset> ruleset_;
@@ -68,7 +68,7 @@
   base::Closure first_disallowed_load_callback_;
 
   // Even when subresource filtering is activated at the page level by the
-  // |activation_state| passed into the constructor, the current document or
+  // |activation_level| passed into the constructor, the current document or
   // ancestors thereof may still match special filtering rules that specifically
   // disable the application of other types of rules on these documents. See
   // proto::ActivationType for details.
diff --git a/components/subresource_filter/content/renderer/document_subresource_filter_unittest.cc b/components/subresource_filter/content/renderer/document_subresource_filter_unittest.cc
index 6bb11d74..f3e78c7 100644
--- a/components/subresource_filter/content/renderer/document_subresource_filter_unittest.cc
+++ b/components/subresource_filter/content/renderer/document_subresource_filter_unittest.cc
@@ -79,7 +79,7 @@
       blink::WebURLRequest::RequestContextImage;
   TestCallbackReceiver first_disallowed_load_callback_receiver;
   DocumentSubresourceFilter filter(
-      ActivationState::DRYRUN, true, ruleset(), std::vector<GURL>(),
+      ActivationLevel::DRYRUN, true, ruleset(), std::vector<GURL>(),
       first_disallowed_load_callback_receiver.closure());
   EXPECT_TRUE(filter.allowLoad(GURL(kTestAlphaURL), request_context));
   EXPECT_TRUE(filter.allowLoad(GURL(kTestAlphaDataURI), request_context));
@@ -98,7 +98,7 @@
   auto test_impl = [this](bool measure_performance) {
     blink::WebURLRequest::RequestContext request_context =
         blink::WebURLRequest::RequestContextImage;
-    DocumentSubresourceFilter filter(ActivationState::ENABLED,
+    DocumentSubresourceFilter filter(ActivationLevel::ENABLED,
                                      measure_performance, ruleset(),
                                      std::vector<GURL>(), base::Closure());
     EXPECT_FALSE(filter.allowLoad(GURL(kTestAlphaURL), request_context));
@@ -129,7 +129,7 @@
       blink::WebURLRequest::RequestContextImage;
   TestCallbackReceiver first_disallowed_load_callback_receiver;
   DocumentSubresourceFilter filter(
-      ActivationState::ENABLED, true, ruleset(), std::vector<GURL>(),
+      ActivationLevel::ENABLED, true, ruleset(), std::vector<GURL>(),
       first_disallowed_load_callback_receiver.closure());
   EXPECT_TRUE(filter.allowLoad(GURL(kTestAlphaDataURI), request_context));
   EXPECT_EQ(0u, first_disallowed_load_callback_receiver.callback_count());
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent.cc b/components/subresource_filter/content/renderer/subresource_filter_agent.cc
index 876cea1..b2982b6 100644
--- a/components/subresource_filter/content/renderer/subresource_filter_agent.cc
+++ b/components/subresource_filter/content/renderer/subresource_filter_agent.cc
@@ -29,7 +29,7 @@
     UnverifiedRulesetDealer* ruleset_dealer)
     : content::RenderFrameObserver(render_frame),
       ruleset_dealer_(ruleset_dealer),
-      activation_state_for_provisional_load_(ActivationState::DISABLED) {
+      activation_level_for_provisional_load_(ActivationLevel::DISABLED) {
   DCHECK(ruleset_dealer);
 }
 
@@ -68,21 +68,21 @@
 }
 
 void SubresourceFilterAgent::OnActivateForProvisionalLoad(
-    ActivationState activation_state,
+    ActivationLevel activation_level,
     const GURL& url,
     bool measure_performance) {
-  activation_state_for_provisional_load_ = activation_state;
+  activation_level_for_provisional_load_ = activation_level;
   url_for_provisional_load_ = url;
   measure_performance_ = measure_performance;
 }
 
 void SubresourceFilterAgent::RecordHistogramsOnLoadCommitted() {
   UMA_HISTOGRAM_ENUMERATION(
-      "SubresourceFilter.DocumentLoad.ActivationState",
-      static_cast<int>(activation_state_for_provisional_load_),
-      static_cast<int>(ActivationState::LAST) + 1);
+      "SubresourceFilter.DocumentLoad.ActivationLevel",
+      static_cast<int>(activation_level_for_provisional_load_),
+      static_cast<int>(ActivationLevel::LAST) + 1);
 
-  if (activation_state_for_provisional_load_ != ActivationState::DISABLED) {
+  if (activation_level_for_provisional_load_ != ActivationLevel::DISABLED) {
     UMA_HISTOGRAM_BOOLEAN("SubresourceFilter.DocumentLoad.RulesetIsAvailable",
                           ruleset_dealer_->IsRulesetFileAvailable());
   }
@@ -144,7 +144,7 @@
       (!ds ||
        static_cast<GURL>(ds->getRequest().url()) !=
            url_for_provisional_load_)) {
-    activation_state_for_provisional_load_ = ActivationState::DISABLED;
+    activation_level_for_provisional_load_ = ActivationLevel::DISABLED;
     measure_performance_ = false;
   } else {
     url_for_provisional_load_ = GURL();
@@ -162,7 +162,7 @@
   if (ancestor_document_urls.front().SchemeIsHTTPOrHTTPS() ||
       ancestor_document_urls.front().SchemeIsFile()) {
     RecordHistogramsOnLoadCommitted();
-    if (activation_state_for_provisional_load_ != ActivationState::DISABLED &&
+    if (activation_level_for_provisional_load_ != ActivationLevel::DISABLED &&
         ruleset_dealer_->IsRulesetFileAvailable()) {
       base::Closure first_disallowed_load_callback(
           base::Bind(&SubresourceFilterAgent::
@@ -170,14 +170,14 @@
                      AsWeakPtr()));
       std::unique_ptr<DocumentSubresourceFilter> filter(
           new DocumentSubresourceFilter(
-              activation_state_for_provisional_load_, measure_performance_,
+              activation_level_for_provisional_load_, measure_performance_,
               ruleset_dealer_->GetRuleset(), ancestor_document_urls,
               first_disallowed_load_callback));
       filter_for_last_committed_load_ = filter->AsWeakPtr();
       SetSubresourceFilterForCommittedLoad(std::move(filter));
     }
   }
-  activation_state_for_provisional_load_ = ActivationState::DISABLED;
+  activation_level_for_provisional_load_ = ActivationLevel::DISABLED;
 }
 
 void SubresourceFilterAgent::DidFinishLoad() {
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent.h b/components/subresource_filter/content/renderer/subresource_filter_agent.h
index 2eb53c2..9a8d01a 100644
--- a/components/subresource_filter/content/renderer/subresource_filter_agent.h
+++ b/components/subresource_filter/content/renderer/subresource_filter_agent.h
@@ -11,7 +11,7 @@
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "components/subresource_filter/content/common/document_load_statistics.h"
-#include "components/subresource_filter/core/common/activation_state.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 #include "content/public/renderer/render_frame_observer.h"
 #include "url/gurl.h"
 
@@ -62,7 +62,7 @@
       const DocumentLoadStatistics& statistics);
 
  private:
-  void OnActivateForProvisionalLoad(ActivationState activation_state,
+  void OnActivateForProvisionalLoad(ActivationLevel activation_level,
                                     const GURL& url,
                                     bool measure_performance);
   void RecordHistogramsOnLoadCommitted();
@@ -79,7 +79,7 @@
   // Owned by the ChromeContentRendererClient and outlives us.
   UnverifiedRulesetDealer* ruleset_dealer_;
 
-  ActivationState activation_state_for_provisional_load_;
+  ActivationLevel activation_level_for_provisional_load_;
   GURL url_for_provisional_load_;
   bool measure_performance_ = false;
   base::WeakPtr<DocumentSubresourceFilter> filter_for_last_committed_load_;
diff --git a/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc b/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc
index 453c6f9..7a8b9bd0 100644
--- a/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc
+++ b/components/subresource_filter/content/renderer/subresource_filter_agent_unittest.cc
@@ -79,8 +79,8 @@
 // Histogram names.
 constexpr const char kDocumentLoadRulesetIsAvailable[] =
     "SubresourceFilter.DocumentLoad.RulesetIsAvailable";
-constexpr const char kDocumentLoadActivationState[] =
-    "SubresourceFilter.DocumentLoad.ActivationState";
+constexpr const char kDocumentLoadActivationLevel[] =
+    "SubresourceFilter.DocumentLoad.ActivationLevel";
 constexpr const char kSubresourcesEvaluated[] =
     "SubresourceFilter.DocumentLoad.NumSubresourceLoads.Evaluated";
 constexpr const char kSubresourcesTotal[] =
@@ -120,25 +120,25 @@
         testing::TestRuleset::Open(test_ruleset_pair.indexed));
   }
 
-  void StartLoadWithoutSettingActivationState() {
+  void StartLoadWithoutSettingActivationLevel() {
     agent_as_rfo()->DidStartProvisionalLoad();
     agent_as_rfo()->DidCommitProvisionalLoad(
         true /* is_new_navigation */, false /* is_same_page_navigation */);
   }
 
-  void PerformSamePageNavigationWithoutSettingActivationState() {
+  void PerformSamePageNavigationWithoutSettingActivationLevel() {
     agent_as_rfo()->DidStartProvisionalLoad();
     agent_as_rfo()->DidCommitProvisionalLoad(
         true /* is_new_navigation */, true /* is_same_page_navigation */);
     // No DidFinishLoad is called in this case.
   }
 
-  void StartLoadAndSetActivationState(ActivationState activation_state,
+  void StartLoadAndSetActivationLevel(ActivationLevel activation_level,
                                       bool measure_performance = false) {
     agent_as_rfo()->DidStartProvisionalLoad();
     EXPECT_TRUE(agent_as_rfo()->OnMessageReceived(
         SubresourceFilterMsg_ActivateForProvisionalLoad(
-            0, activation_state, GURL(), measure_performance)));
+            0, activation_level, GURL(), measure_performance)));
     agent_as_rfo()->DidCommitProvisionalLoad(
         true /* is_new_navigation */, false /* is_same_page_navigation */);
   }
@@ -196,11 +196,11 @@
   ASSERT_NO_FATAL_FAILURE(
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestBothURLsPathSuffix));
   ExpectNoSubresourceFilterGetsInjected();
-  StartLoadWithoutSettingActivationState();
+  StartLoadWithoutSettingActivationLevel();
   FinishLoad();
 
   histogram_tester.ExpectUniqueSample(
-      kDocumentLoadActivationState, static_cast<int>(ActivationState::DISABLED),
+      kDocumentLoadActivationLevel, static_cast<int>(ActivationLevel::DISABLED),
       1);
   histogram_tester.ExpectTotalCount(kDocumentLoadRulesetIsAvailable, 0);
 
@@ -217,7 +217,7 @@
   ASSERT_NO_FATAL_FAILURE(
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestBothURLsPathSuffix));
   ExpectNoSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::DISABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::DISABLED);
   FinishLoad();
 }
 
@@ -225,11 +225,11 @@
        EnabledButRulesetUnavailable_NoFilterIsInjected) {
   base::HistogramTester histogram_tester;
   ExpectNoSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   FinishLoad();
 
   histogram_tester.ExpectUniqueSample(
-      kDocumentLoadActivationState, static_cast<int>(ActivationState::ENABLED),
+      kDocumentLoadActivationLevel, static_cast<int>(ActivationLevel::ENABLED),
       1);
   histogram_tester.ExpectUniqueSample(kDocumentLoadRulesetIsAvailable, 0, 1);
 
@@ -248,10 +248,10 @@
   EXPECT_CALL(*agent(), GetAncestorDocumentURLs())
       .WillOnce(::testing::Return(
           std::vector<GURL>({GURL("about:blank"), GURL("http://outer.com/")})));
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   FinishLoad();
 
-  histogram_tester.ExpectTotalCount(kDocumentLoadActivationState, 0);
+  histogram_tester.ExpectTotalCount(kDocumentLoadActivationLevel, 0);
   histogram_tester.ExpectTotalCount(kDocumentLoadRulesetIsAvailable, 0);
 
   histogram_tester.ExpectTotalCount(kSubresourcesTotal, 0);
@@ -269,7 +269,7 @@
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix));
 
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   ExpectSignalAboutFirstSubresourceDisallowed();
@@ -281,12 +281,12 @@
   // In-page navigation should not count as a new load.
   ExpectNoSubresourceFilterGetsInjected();
   ExpectNoSignalAboutFirstSubresourceDisallowed();
-  PerformSamePageNavigationWithoutSettingActivationState();
+  PerformSamePageNavigationWithoutSettingActivationLevel();
   ExpectLoadAllowed(kTestFirstURL, false);
   ExpectLoadAllowed(kTestSecondURL, true);
 
   ExpectNoSubresourceFilterGetsInjected();
-  StartLoadWithoutSettingActivationState();
+  StartLoadWithoutSettingActivationLevel();
   FinishLoad();
 
   // Resource loads after the in-page navigation should not be counted toward
@@ -295,10 +295,10 @@
   histogram_tester.ExpectUniqueSample(kSubresourcesEvaluated, 2, 1);
   histogram_tester.ExpectUniqueSample(kSubresourcesMatchedRules, 1, 1);
   histogram_tester.ExpectUniqueSample(kSubresourcesDisallowed, 1, 1);
-  EXPECT_THAT(histogram_tester.GetAllSamples(kDocumentLoadActivationState),
+  EXPECT_THAT(histogram_tester.GetAllSamples(kDocumentLoadActivationLevel),
               ::testing::ElementsAre(
-                  base::Bucket(static_cast<int>(ActivationState::DISABLED), 1),
-                  base::Bucket(static_cast<int>(ActivationState::ENABLED), 1)));
+                  base::Bucket(static_cast<int>(ActivationLevel::DISABLED), 1),
+                  base::Bucket(static_cast<int>(ActivationLevel::ENABLED), 1)));
   histogram_tester.ExpectUniqueSample(kDocumentLoadRulesetIsAvailable, 1, 1);
 }
 
@@ -308,7 +308,7 @@
     ASSERT_NO_FATAL_FAILURE(
         SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix));
     ExpectSubresourceFilterGetsInjected();
-    StartLoadAndSetActivationState(ActivationState::ENABLED,
+    StartLoadAndSetActivationLevel(ActivationLevel::ENABLED,
                                    measure_performance);
     ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
@@ -322,7 +322,7 @@
     FinishLoad();
 
     ExpectSubresourceFilterGetsInjected();
-    StartLoadAndSetActivationState(ActivationState::ENABLED,
+    StartLoadAndSetActivationLevel(ActivationLevel::ENABLED,
                                    measure_performance);
     ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
@@ -334,8 +334,8 @@
     FinishLoad();
 
     histogram_tester.ExpectUniqueSample(
-        kDocumentLoadActivationState,
-        static_cast<int>(ActivationState::ENABLED), 2);
+        kDocumentLoadActivationLevel,
+        static_cast<int>(ActivationLevel::ENABLED), 2);
     histogram_tester.ExpectUniqueSample(kDocumentLoadRulesetIsAvailable, 1, 2);
 
     EXPECT_THAT(histogram_tester.GetAllSamples(kSubresourcesTotal),
@@ -360,7 +360,7 @@
   ASSERT_NO_FATAL_FAILURE(
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix));
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   // Set the new ruleset just after the deadline for being used for the current
@@ -375,7 +375,7 @@
   FinishLoad();
 
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   ExpectSignalAboutFirstSubresourceDisallowed();
@@ -397,7 +397,7 @@
   agent_as_rfo()->DidStartProvisionalLoad();
   EXPECT_TRUE(agent_as_rfo()->OnMessageReceived(
       SubresourceFilterMsg_ActivateForProvisionalLoad(
-          0, ActivationState::ENABLED, GURL(), true)));
+          0, ActivationLevel::ENABLED, GURL(), true)));
   agent_as_rfo()->DidStartProvisionalLoad();
   agent_as_rfo()->DidCommitProvisionalLoad(true /* is_new_navigation */,
                                            false /* is_same_page_navigation */);
@@ -409,7 +409,7 @@
   ASSERT_NO_FATAL_FAILURE(
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix));
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::DRYRUN);
+  StartLoadAndSetActivationLevel(ActivationLevel::DRYRUN);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   // In dry-run mode, loads to the first URL should be recorded as
@@ -421,8 +421,8 @@
   ExpectDocumentLoadStatisticsSent();
   FinishLoad();
 
-  histogram_tester.ExpectUniqueSample(kDocumentLoadActivationState,
-                                      static_cast<int>(ActivationState::DRYRUN),
+  histogram_tester.ExpectUniqueSample(kDocumentLoadActivationLevel,
+                                      static_cast<int>(ActivationLevel::DRYRUN),
                                       1);
   histogram_tester.ExpectUniqueSample(kDocumentLoadRulesetIsAvailable, 1, 1);
 
@@ -441,7 +441,7 @@
   ASSERT_NO_FATAL_FAILURE(
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix));
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   ExpectSignalAboutFirstSubresourceDisallowed();
@@ -453,7 +453,7 @@
   FinishLoad();
 
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   ExpectLoadAllowed(kTestSecondURL, true);
@@ -468,7 +468,7 @@
   ASSERT_NO_FATAL_FAILURE(
       SetTestRulesetToDisallowURLsWithPathSuffix(kTestFirstURLPathSuffix));
   ExpectSubresourceFilterGetsInjected();
-  StartLoadAndSetActivationState(ActivationState::ENABLED);
+  StartLoadAndSetActivationLevel(ActivationLevel::ENABLED);
   ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(agent()));
 
   auto filter = agent()->TakeFilter();
diff --git a/components/subresource_filter/core/browser/subresource_filter_features.cc b/components/subresource_filter/core/browser/subresource_filter_features.cc
index 9ac0acf..d9374e1 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features.cc
+++ b/components/subresource_filter/core/browser/subresource_filter_features.cc
@@ -16,10 +16,11 @@
 const base::Feature kSafeBrowsingSubresourceFilter{
     "SubresourceFilter", base::FEATURE_DISABLED_BY_DEFAULT};
 
-const char kActivationStateParameterName[] = "activation_state";
-const char kActivationStateDryRun[] = "dryrun";
-const char kActivationStateEnabled[] = "enabled";
-const char kActivationStateDisabled[] = "disabled";
+// Legacy name `activation_state` is used in variation parameters.
+const char kActivationLevelParameterName[] = "activation_state";
+const char kActivationLevelDryRun[] = "dryrun";
+const char kActivationLevelEnabled[] = "enabled";
+const char kActivationLevelDisabled[] = "disabled";
 
 const char kActivationScopeParameterName[] = "activation_scope";
 const char kActivationScopeAllSites[] = "all_sites";
@@ -34,14 +35,14 @@
 const char kPerformanceMeasurementRateParameterName[] =
     "performance_measurement_rate";
 
-ActivationState GetMaximumActivationState() {
-  std::string activation_state = variations::GetVariationParamValueByFeature(
-      kSafeBrowsingSubresourceFilter, kActivationStateParameterName);
-  if (base::LowerCaseEqualsASCII(activation_state, kActivationStateEnabled))
-    return ActivationState::ENABLED;
-  else if (base::LowerCaseEqualsASCII(activation_state, kActivationStateDryRun))
-    return ActivationState::DRYRUN;
-  return ActivationState::DISABLED;
+ActivationLevel GetMaximumActivationLevel() {
+  std::string activation_level = variations::GetVariationParamValueByFeature(
+      kSafeBrowsingSubresourceFilter, kActivationLevelParameterName);
+  if (base::LowerCaseEqualsASCII(activation_level, kActivationLevelEnabled))
+    return ActivationLevel::ENABLED;
+  else if (base::LowerCaseEqualsASCII(activation_level, kActivationLevelDryRun))
+    return ActivationLevel::DRYRUN;
+  return ActivationLevel::DISABLED;
 }
 
 ActivationScope GetCurrentActivationScope() {
diff --git a/components/subresource_filter/core/browser/subresource_filter_features.h b/components/subresource_filter/core/browser/subresource_filter_features.h
index 11f54ff..06ff4ac07 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features.h
+++ b/components/subresource_filter/core/browser/subresource_filter_features.h
@@ -6,20 +6,20 @@
 #define COMPONENTS_SUBRESOURCE_FILTER_SUBRESOURCE_FILTER_FEATURES_H_
 
 #include "base/feature_list.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 #include "components/subresource_filter/core/common/activation_list.h"
 #include "components/subresource_filter/core/common/activation_scope.h"
-#include "components/subresource_filter/core/common/activation_state.h"
 
 namespace subresource_filter {
 
 // The master toggle to enable/disable the Safe Browsing Subresource Filter.
 extern const base::Feature kSafeBrowsingSubresourceFilter;
 
-// Name/values of the variation parameter controlling maximum activation state.
-extern const char kActivationStateParameterName[];
-extern const char kActivationStateDryRun[];
-extern const char kActivationStateEnabled[];
-extern const char kActivationStateDisabled[];
+// Name/values of the variation parameter controlling maximum activation level.
+extern const char kActivationLevelParameterName[];
+extern const char kActivationLevelDryRun[];
+extern const char kActivationLevelEnabled[];
+extern const char kActivationLevelDisabled[];
 
 extern const char kActivationScopeParameterName[];
 extern const char kActivationScopeAllSites[];
@@ -33,9 +33,9 @@
 extern const char kPerformanceMeasurementRateParameterName[];
 
 // Returns the maximum degree to which subresource filtering should be activated
-// on any RenderFrame. This will be ActivationState::DISABLED unless the feature
-// is enabled and variation parameters prescribe a higher activation state.
-ActivationState GetMaximumActivationState();
+// on any RenderFrame. This will be ActivationLevel::DISABLED unless the feature
+// is enabled and variation parameters prescribe a higher activation level.
+ActivationLevel GetMaximumActivationLevel();
 
 // Returns the current activation scope, that is, the subset of page loads where
 // subresource filtering should be activated. The function returns
diff --git a/components/subresource_filter/core/browser/subresource_filter_features_test_support.cc b/components/subresource_filter/core/browser/subresource_filter_features_test_support.cc
index a6be80b..13d6a97 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features_test_support.cc
+++ b/components/subresource_filter/core/browser/subresource_filter_features_test_support.cc
@@ -22,13 +22,13 @@
 
 ScopedSubresourceFilterFeatureToggle::ScopedSubresourceFilterFeatureToggle(
     base::FeatureList::OverrideState feature_state,
-    const std::string& maximum_activation_state,
+    const std::string& maximum_activation_level,
     const std::string& activation_scope,
     const std::string& activation_lists,
     const std::string& performance_measurement_rate)
     : ScopedSubresourceFilterFeatureToggle(
           feature_state,
-          {{kActivationStateParameterName, maximum_activation_state},
+          {{kActivationLevelParameterName, maximum_activation_level},
            {kActivationScopeParameterName, activation_scope},
            {kActivationListsParameterName, activation_lists},
            {kPerformanceMeasurementRateParameterName,
diff --git a/components/subresource_filter/core/browser/subresource_filter_features_test_support.h b/components/subresource_filter/core/browser/subresource_filter_features_test_support.h
index 6fe38513..c8bcd37 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features_test_support.h
+++ b/components/subresource_filter/core/browser/subresource_filter_features_test_support.h
@@ -16,13 +16,13 @@
 namespace testing {
 
 // Helper to override the state of the |kSafeBrowsingSubresourceFilter| feature,
-// and its variation parameters, e.g., maximum activation state and activation
+// and its variation parameters, e.g., maximum activation level and activation
 // scope. Expects a pre-existing global base::FieldTrialList singleton.
 class ScopedSubresourceFilterFeatureToggle {
  public:
   ScopedSubresourceFilterFeatureToggle(
       base::FeatureList::OverrideState feature_state,
-      const std::string& maximum_activation_state,
+      const std::string& maximum_activation_level,
       const std::string& activation_scope,
       const std::string& activation_lists = std::string(),
       const std::string& performance_measurement_rate = std::string());
diff --git a/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc b/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
index d2ab51d..33d672d 100644
--- a/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
+++ b/components/subresource_filter/core/browser/subresource_filter_features_unittest.cc
@@ -12,37 +12,37 @@
 
 namespace subresource_filter {
 
-TEST(SubresourceFilterFeaturesTest, ActivationState) {
+TEST(SubresourceFilterFeaturesTest, ActivationLevel) {
   const struct {
     bool feature_enabled;
-    const char* activation_state_param;
-    ActivationState expected_activation_state;
-  } kTestCases[] = {{false, "", ActivationState::DISABLED},
-                    {false, "disabled", ActivationState::DISABLED},
-                    {false, "dryrun", ActivationState::DISABLED},
-                    {false, "enabled", ActivationState::DISABLED},
-                    {false, "%$ garbage !%", ActivationState::DISABLED},
-                    {true, "", ActivationState::DISABLED},
-                    {true, "disable", ActivationState::DISABLED},
-                    {true, "Disable", ActivationState::DISABLED},
-                    {true, "disabled", ActivationState::DISABLED},
-                    {true, "%$ garbage !%", ActivationState::DISABLED},
-                    {true, kActivationStateDryRun, ActivationState::DRYRUN},
-                    {true, kActivationStateEnabled, ActivationState::ENABLED},
-                    {true, "Enabled", ActivationState::ENABLED}};
+    const char* activation_level_param;
+    ActivationLevel expected_activation_level;
+  } kTestCases[] = {{false, "", ActivationLevel::DISABLED},
+                    {false, "disabled", ActivationLevel::DISABLED},
+                    {false, "dryrun", ActivationLevel::DISABLED},
+                    {false, "enabled", ActivationLevel::DISABLED},
+                    {false, "%$ garbage !%", ActivationLevel::DISABLED},
+                    {true, "", ActivationLevel::DISABLED},
+                    {true, "disable", ActivationLevel::DISABLED},
+                    {true, "Disable", ActivationLevel::DISABLED},
+                    {true, "disabled", ActivationLevel::DISABLED},
+                    {true, "%$ garbage !%", ActivationLevel::DISABLED},
+                    {true, kActivationLevelDryRun, ActivationLevel::DRYRUN},
+                    {true, kActivationLevelEnabled, ActivationLevel::ENABLED},
+                    {true, "Enabled", ActivationLevel::ENABLED}};
 
   for (const auto& test_case : kTestCases) {
     SCOPED_TRACE(::testing::Message("Enabled = ") << test_case.feature_enabled);
-    SCOPED_TRACE(::testing::Message("ActivationStateParam = \"")
-                 << test_case.activation_state_param << "\"");
+    SCOPED_TRACE(::testing::Message("ActivationLevelParam = \"")
+                 << test_case.activation_level_param << "\"");
 
     base::FieldTrialList field_trial_list(nullptr /* entropy_provider */);
     testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
         test_case.feature_enabled ? base::FeatureList::OVERRIDE_ENABLE_FEATURE
                                   : base::FeatureList::OVERRIDE_USE_DEFAULT,
-        test_case.activation_state_param, kActivationScopeNoSites);
+        test_case.activation_level_param, kActivationScopeNoSites);
 
-    EXPECT_EQ(test_case.expected_activation_state, GetMaximumActivationState());
+    EXPECT_EQ(test_case.expected_activation_level, GetMaximumActivationLevel());
     EXPECT_EQ(ActivationScope::NO_SITES, GetCurrentActivationScope());
   }
 }
@@ -75,48 +75,48 @@
     testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
         test_case.feature_enabled ? base::FeatureList::OVERRIDE_ENABLE_FEATURE
                                   : base::FeatureList::OVERRIDE_USE_DEFAULT,
-        kActivationStateDisabled, test_case.activation_scope_param);
+        kActivationLevelDisabled, test_case.activation_scope_param);
 
-    EXPECT_EQ(ActivationState::DISABLED, GetMaximumActivationState());
+    EXPECT_EQ(ActivationLevel::DISABLED, GetMaximumActivationLevel());
     EXPECT_EQ(test_case.expected_activation_scope, GetCurrentActivationScope());
   }
 }
 
-TEST(SubresourceFilterFeaturesTest, ActivationStateAndScope) {
+TEST(SubresourceFilterFeaturesTest, ActivationLevelAndScope) {
   const struct {
     bool feature_enabled;
-    const char* activation_state_param;
-    ActivationState expected_activation_state;
+    const char* activation_level_param;
+    ActivationLevel expected_activation_level;
     const char* activation_scope_param;
     ActivationScope expected_activation_scope;
   } kTestCases[] = {
-      {false, kActivationStateDisabled, ActivationState::DISABLED,
+      {false, kActivationLevelDisabled, ActivationLevel::DISABLED,
        kActivationScopeNoSites, ActivationScope::NO_SITES},
-      {true, kActivationStateDisabled, ActivationState::DISABLED,
+      {true, kActivationLevelDisabled, ActivationLevel::DISABLED,
        kActivationScopeNoSites, ActivationScope::NO_SITES},
-      {true, kActivationStateDisabled, ActivationState::DISABLED,
+      {true, kActivationLevelDisabled, ActivationLevel::DISABLED,
        kActivationScopeAllSites, ActivationScope::ALL_SITES},
-      {true, kActivationStateDisabled, ActivationState::DISABLED,
+      {true, kActivationLevelDisabled, ActivationLevel::DISABLED,
        kActivationScopeActivationList, ActivationScope::ACTIVATION_LIST},
-      {true, kActivationStateDisabled, ActivationState::DISABLED,
+      {true, kActivationLevelDisabled, ActivationLevel::DISABLED,
        kActivationScopeAllSites, ActivationScope::ALL_SITES},
-      {true, kActivationStateDryRun, ActivationState::DRYRUN,
+      {true, kActivationLevelDryRun, ActivationLevel::DRYRUN,
        kActivationScopeNoSites, ActivationScope::NO_SITES},
-      {true, kActivationStateDryRun, ActivationState::DRYRUN,
+      {true, kActivationLevelDryRun, ActivationLevel::DRYRUN,
        kActivationScopeAllSites, ActivationScope::ALL_SITES},
-      {true, kActivationStateDryRun, ActivationState::DRYRUN,
+      {true, kActivationLevelDryRun, ActivationLevel::DRYRUN,
        kActivationScopeActivationList, ActivationScope::ACTIVATION_LIST},
-      {true, kActivationStateDryRun, ActivationState::DRYRUN,
+      {true, kActivationLevelDryRun, ActivationLevel::DRYRUN,
        kActivationScopeAllSites, ActivationScope::ALL_SITES},
-      {true, kActivationStateEnabled, ActivationState::ENABLED,
+      {true, kActivationLevelEnabled, ActivationLevel::ENABLED,
        kActivationScopeNoSites, ActivationScope::NO_SITES},
-      {true, kActivationStateEnabled, ActivationState::ENABLED,
+      {true, kActivationLevelEnabled, ActivationLevel::ENABLED,
        kActivationScopeAllSites, ActivationScope::ALL_SITES},
-      {true, kActivationStateEnabled, ActivationState::ENABLED,
+      {true, kActivationLevelEnabled, ActivationLevel::ENABLED,
        kActivationScopeActivationList, ActivationScope::ACTIVATION_LIST},
-      {true, kActivationStateEnabled, ActivationState::ENABLED,
+      {true, kActivationLevelEnabled, ActivationLevel::ENABLED,
        kActivationScopeAllSites, ActivationScope::ALL_SITES},
-      {false, kActivationStateEnabled, ActivationState::DISABLED,
+      {false, kActivationLevelEnabled, ActivationLevel::DISABLED,
        kActivationScopeAllSites, ActivationScope::NO_SITES}};
 
   for (const auto& test_case : kTestCases) {
@@ -124,10 +124,10 @@
     testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
         test_case.feature_enabled ? base::FeatureList::OVERRIDE_ENABLE_FEATURE
                                   : base::FeatureList::OVERRIDE_USE_DEFAULT,
-        test_case.activation_state_param, test_case.activation_scope_param);
+        test_case.activation_level_param, test_case.activation_scope_param);
 
     EXPECT_EQ(test_case.expected_activation_scope, GetCurrentActivationScope());
-    EXPECT_EQ(test_case.expected_activation_state, GetMaximumActivationState());
+    EXPECT_EQ(test_case.expected_activation_level, GetMaximumActivationLevel());
   }
 }
 
@@ -176,7 +176,7 @@
     testing::ScopedSubresourceFilterFeatureToggle scoped_feature_toggle(
         test_case.feature_enabled ? base::FeatureList::OVERRIDE_ENABLE_FEATURE
                                   : base::FeatureList::OVERRIDE_USE_DEFAULT,
-        kActivationStateDisabled, kActivationScopeNoSites,
+        kActivationLevelDisabled, kActivationScopeNoSites,
         test_case.activation_list_param);
 
     EXPECT_EQ(test_case.expected_activation_list, GetCurrentActivationList());
diff --git a/components/subresource_filter/core/common/BUILD.gn b/components/subresource_filter/core/common/BUILD.gn
index 5e260b7..cccfa252 100644
--- a/components/subresource_filter/core/common/BUILD.gn
+++ b/components/subresource_filter/core/common/BUILD.gn
@@ -4,12 +4,12 @@
 
 static_library("common") {
   sources = [
+    "activation_level.cc",
+    "activation_level.h",
     "activation_list.cc",
     "activation_list.h",
     "activation_scope.cc",
     "activation_scope.h",
-    "activation_state.cc",
-    "activation_state.h",
     "closed_hash_map.h",
     "copying_file_stream.cc",
     "copying_file_stream.h",
diff --git a/components/subresource_filter/core/common/activation_state.cc b/components/subresource_filter/core/common/activation_level.cc
similarity index 62%
rename from components/subresource_filter/core/common/activation_state.cc
rename to components/subresource_filter/core/common/activation_level.cc
index 3461eb8..14fc77ad 100644
--- a/components/subresource_filter/core/common/activation_state.cc
+++ b/components/subresource_filter/core/common/activation_level.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "components/subresource_filter/core/common/activation_state.h"
+#include "components/subresource_filter/core/common/activation_level.h"
 
 #include <ostream>
 
@@ -10,15 +10,15 @@
 
 namespace subresource_filter {
 
-std::ostream& operator<<(std::ostream& os, const ActivationState& state) {
-  switch (state) {
-    case ActivationState::DISABLED:
+std::ostream& operator<<(std::ostream& os, const ActivationLevel& level) {
+  switch (level) {
+    case ActivationLevel::DISABLED:
       os << "DISABLED";
       break;
-    case ActivationState::DRYRUN:
+    case ActivationLevel::DRYRUN:
       os << "DRYRUN";
       break;
-    case ActivationState::ENABLED:
+    case ActivationLevel::ENABLED:
       os << "ENABLED";
       break;
     default:
diff --git a/components/subresource_filter/core/common/activation_state.h b/components/subresource_filter/core/common/activation_level.h
similarity index 71%
rename from components/subresource_filter/core/common/activation_state.h
rename to components/subresource_filter/core/common/activation_level.h
index 4f568d5..097264a 100644
--- a/components/subresource_filter/core/common/activation_state.h
+++ b/components/subresource_filter/core/common/activation_level.h
@@ -2,15 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_ACTIVATION_STATE_H_
-#define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_ACTIVATION_STATE_H_
+#ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_ACTIVATION_LEVEL_H_
+#define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_ACTIVATION_LEVEL_H_
 
 #include <iosfwd>
 
 namespace subresource_filter {
 
 // Degrees to which the subresource filtering mechanism can be activated.
-enum class ActivationState {
+enum class ActivationLevel {
   DISABLED,
   // Subresource loads are matched against filtering rules, but all loads are
   // allowed to proceed regardless. Used for stability and performance testing.
@@ -20,8 +20,8 @@
 };
 
 // For logging use only.
-std::ostream& operator<<(std::ostream& os, const ActivationState& state);
+std::ostream& operator<<(std::ostream& os, const ActivationLevel& level);
 
 }  // namespace subresource_filter
 
-#endif  // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_ACTIVATION_STATE_H_
+#endif  // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_ACTIVATION_LEVEL_H_
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 7641725..288ff94 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -129,7 +129,6 @@
     "//third_party/WebKit/public:resources",
     "//third_party/angle:angle_common",
     "//third_party/icu",
-    "//third_party/kasko:kasko_features",
     "//third_party/libyuv",
     "//third_party/re2",
     "//third_party/zlib",
diff --git a/content/browser/frame_host/DEPS b/content/browser/frame_host/DEPS
index a6068f73..09569cb 100644
--- a/content/browser/frame_host/DEPS
+++ b/content/browser/frame_host/DEPS
@@ -5,8 +5,6 @@
   "-content/public/browser/web_contents.h",
   "-content/public/browser/web_contents_delegate.h",
   "-content/public/browser/web_contents_view.h",
-
-  "+third_party/kasko",
 ]
 
 specific_include_rules = {
diff --git a/content/browser/frame_host/debug_urls.cc b/content/browser/frame_host/debug_urls.cc
index 9aafa8aa..dd86fca 100644
--- a/content/browser/frame_host/debug_urls.cc
+++ b/content/browser/frame_host/debug_urls.cc
@@ -22,7 +22,6 @@
 #include "content/public/common/content_constants.h"
 #include "content/public/common/url_constants.h"
 #include "ppapi/features/features.h"
-#include "third_party/kasko/kasko_features.h"
 #include "url/gurl.h"
 
 #if BUILDFLAG(ENABLE_PLUGINS)
@@ -49,12 +48,6 @@
 const char kAsanCorruptHeap[] = "/browser-corrupt-heap";
 #endif
 
-#if BUILDFLAG(ENABLE_KASKO)
-// Define the Kasko debug URLs.
-const char kKaskoCrashDomain[] = "kasko";
-const char kKaskoSendReport[] = "/send-report";
-#endif
-
 void HandlePpapiFlashDebugURL(const GURL& url) {
 #if BUILDFLAG(ENABLE_PLUGINS)
   bool crash = url == kChromeUIPpapiFlashCrashURL;
@@ -72,50 +65,6 @@
 #endif
 }
 
-bool IsKaskoDebugURL(const GURL& url) {
-#if BUILDFLAG(ENABLE_KASKO)
-  return (url.is_valid() && url.SchemeIs(kChromeUIScheme) &&
-          url.DomainIs(kKaskoCrashDomain) &&
-          url.path_piece() == kKaskoSendReport);
-#else
-  return false;
-#endif
-}
-
-void HandleKaskoDebugURL() {
-#if BUILDFLAG(ENABLE_KASKO)
-  // Signature of the exported crash key setting function.
-  using SetCrashKeyValueImplPtr = void(__cdecl *)(const wchar_t*,
-                                                  const wchar_t*);
-  // Signature of an enhanced crash reporting function.
-  using ReportCrashWithProtobufPtr = void(__cdecl *)(EXCEPTION_POINTERS*,
-                                                     const char*);
-
-  HMODULE exe_hmodule = ::GetModuleHandle(NULL);
-
-  // First, set a crash key using the exported function reserved for Kasko
-  // clients (SyzyASAN for now).
-  SetCrashKeyValueImplPtr set_crash_key_value_impl =
-      reinterpret_cast<SetCrashKeyValueImplPtr>(
-          ::GetProcAddress(exe_hmodule, "SetCrashKeyValueImpl"));
-  if (set_crash_key_value_impl)
-    set_crash_key_value_impl(L"kasko-set-crash-key-value-impl", L"true");
-  else
-    NOTREACHED();
-
-  // Next, invoke a crash report via Kasko.
-  ReportCrashWithProtobufPtr report_crash_with_protobuf =
-      reinterpret_cast<ReportCrashWithProtobufPtr>(
-          ::GetProcAddress(exe_hmodule, "ReportCrashWithProtobuf"));
-  if (report_crash_with_protobuf)
-    report_crash_with_protobuf(NULL, "Invoked from debug url.");
-  else
-    NOTREACHED();
-#else
-  NOTIMPLEMENTED();
-#endif
-}
-
 bool IsAsanDebugURL(const GURL& url) {
 #if defined(SYZYASAN)
   if (!base::debug::IsBinaryInstrumented())
@@ -197,11 +146,6 @@
   if (IsAsanDebugURL(url))
     return HandleAsanDebugURL(url);
 
-  if (IsKaskoDebugURL(url)) {
-    HandleKaskoDebugURL();
-    return true;
-  }
-
   if (url == kChromeUIBrowserCrashURL) {
     // Induce an intentional crash in the browser process.
     CHECK(false);
diff --git a/content/browser/loader/detachable_resource_handler.cc b/content/browser/loader/detachable_resource_handler.cc
index 85ac2d3..15ab8c3a 100644
--- a/content/browser/loader/detachable_resource_handler.cc
+++ b/content/browser/loader/detachable_resource_handler.cc
@@ -226,7 +226,9 @@
 
   is_finished_ = true;
 
-  next_handler_->OnResponseCompleted(status, std::move(controller));
+  HoldController(std::move(controller));
+  next_handler_->OnResponseCompleted(status,
+                                     base::MakeUnique<Controller>(this));
 }
 
 void DetachableResourceHandler::OnDataDownloaded(int bytes_downloaded) {
diff --git a/content/renderer/media/gpu/rtc_video_decoder.cc b/content/renderer/media/gpu/rtc_video_decoder.cc
index 01c136c..8564111 100644
--- a/content/renderer/media/gpu/rtc_video_decoder.cc
+++ b/content/renderer/media/gpu/rtc_video_decoder.cc
@@ -110,6 +110,9 @@
     case webrtc::kVideoCodecVP8:
       profile = media::VP8PROFILE_ANY;
       break;
+    case webrtc::kVideoCodecVP9:
+      profile = media::VP9PROFILE_MIN;
+      break;
     case webrtc::kVideoCodecH264:
       profile = media::H264PROFILE_MAIN;
       break;
diff --git a/content/renderer/media/gpu/rtc_video_encoder.cc b/content/renderer/media/gpu/rtc_video_encoder.cc
index 4c42938..988185b4 100644
--- a/content/renderer/media/gpu/rtc_video_encoder.cc
+++ b/content/renderer/media/gpu/rtc_video_encoder.cc
@@ -41,6 +41,8 @@
   switch (type) {
     case webrtc::kVideoCodecVP8:
       return media::VP8PROFILE_ANY;
+    case webrtc::kVideoCodecVP9:
+      return media::VP9PROFILE_MIN;
     case webrtc::kVideoCodecH264:
       // TODO(magjed): WebRTC is only using Baseline profile for now. Update
       // once http://crbug/webrtc/6337 is fixed.
diff --git a/content/renderer/media/user_media_client_impl_unittest.cc b/content/renderer/media/user_media_client_impl_unittest.cc
index 1e6e6e3..43a957f 100644
--- a/content/renderer/media/user_media_client_impl_unittest.cc
+++ b/content/renderer/media/user_media_client_impl_unittest.cc
@@ -153,34 +153,26 @@
         create_source_that_fails_(false),
         video_source_(NULL) {}
 
-  void RequestUserMedia(const blink::WebUserMediaRequest& user_media_request) {
+  void RequestUserMediaForTest(
+      const blink::WebUserMediaRequest& user_media_request) {
     state_ = REQUEST_NOT_COMPLETE;
     requestUserMedia(user_media_request);
     base::RunLoop().RunUntilIdle();
   }
 
-  void RequestUserMedia() {
+  void RequestUserMediaForTest() {
     blink::WebUserMediaRequest user_media_request =
         blink::WebUserMediaRequest::createForTesting(
             CreateDefaultConstraints(), CreateDefaultConstraints());
-    RequestUserMedia(user_media_request);
+    RequestUserMediaForTest(user_media_request);
   }
 
-  void RequestMediaDevices() {
+  void RequestMediaDevicesForTest() {
     blink::WebMediaDevicesRequest media_devices_request;
     state_ = REQUEST_NOT_COMPLETE;
     requestMediaDevices(media_devices_request);
   }
 
-  void SetMediaDeviceChangeObserver() {
-    blink::WebMediaDeviceChangeObserver observer(true);
-    setMediaDeviceChangeObserver(observer);
-  }
-
-  void RemoveMediaDeviceChangeObserver() {
-    setMediaDeviceChangeObserver(blink::WebMediaDeviceChangeObserver());
-  }
-
   void GetUserMediaRequestSucceeded(
       const blink::WebMediaStream& stream,
       blink::WebUserMediaRequest request_info) override {
@@ -332,7 +324,7 @@
   }
 
   blink::WebMediaStream RequestLocalMediaStream() {
-    user_media_client_impl_->RequestUserMedia();
+    user_media_client_impl_->RequestUserMediaForTest();
     FakeMediaStreamDispatcherRequestUserMediaComplete();
     StartMockedVideoSource();
 
@@ -389,7 +381,7 @@
     blink::WebUserMediaRequest request =
         blink::WebUserMediaRequest::createForTesting(audio_constraints,
                                                      null_constraints);
-    user_media_client_impl_->RequestUserMedia(request);
+    user_media_client_impl_->RequestUserMediaForTest(request);
     bool result =
         user_media_client_impl_->UserMediaRequestHasAutomaticDeviceSelection(
             ms_dispatcher_->audio_input_request_id());
@@ -408,7 +400,7 @@
     blink::WebUserMediaRequest request =
         blink::WebUserMediaRequest::createForTesting(audio_constraints,
                                                      video_constraints);
-    user_media_client_impl_->RequestUserMedia(request);
+    user_media_client_impl_->RequestUserMediaForTest(request);
     FakeMediaStreamDispatcherRequestUserMediaComplete();
     StartMockedVideoSource();
 
@@ -576,7 +568,7 @@
 
 // This test what happens if a video source to a MediaSteam fails to start.
 TEST_F(UserMediaClientImplTest, MediaVideoSourceFailToStart) {
-  user_media_client_impl_->RequestUserMedia();
+  user_media_client_impl_->RequestUserMediaForTest();
   FakeMediaStreamDispatcherRequestUserMediaComplete();
   FailToStartMockedVideoSource();
   EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_FAILED,
@@ -592,7 +584,7 @@
 // This test what happens if an audio source fail to initialize.
 TEST_F(UserMediaClientImplTest, MediaAudioSourceFailToInitialize) {
   user_media_client_impl_->SetCreateSourceThatFails(true);
-  user_media_client_impl_->RequestUserMedia();
+  user_media_client_impl_->RequestUserMediaForTest();
   FakeMediaStreamDispatcherRequestUserMediaComplete();
   StartMockedVideoSource();
   EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_FAILED,
@@ -608,7 +600,7 @@
 // This test what happens if UserMediaClientImpl is deleted before a source has
 // started.
 TEST_F(UserMediaClientImplTest, MediaStreamImplShutDown) {
-  user_media_client_impl_->RequestUserMedia();
+  user_media_client_impl_->RequestUserMediaForTest();
   FakeMediaStreamDispatcherRequestUserMediaComplete();
   EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
   EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_NOT_COMPLETE,
@@ -619,7 +611,7 @@
 // This test what happens if a new document is loaded in the frame while the
 // MediaStream is being generated by the MediaStreamDispatcher.
 TEST_F(UserMediaClientImplTest, ReloadFrameWhileGeneratingStream) {
-  user_media_client_impl_->RequestUserMedia();
+  user_media_client_impl_->RequestUserMediaForTest();
   LoadNewDocumentInFrame();
   EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
   EXPECT_EQ(0, ms_dispatcher_->stop_audio_device_counter());
@@ -631,7 +623,7 @@
 // This test what happens if a newdocument is loaded in the frame while the
 // sources are being started.
 TEST_F(UserMediaClientImplTest, ReloadFrameWhileGeneratingSources) {
-  user_media_client_impl_->RequestUserMedia();
+  user_media_client_impl_->RequestUserMediaForTest();
   FakeMediaStreamDispatcherRequestUserMediaComplete();
   EXPECT_EQ(1, ms_dispatcher_->request_stream_counter());
   LoadNewDocumentInFrame();
@@ -665,7 +657,7 @@
 }
 
 TEST_F(UserMediaClientImplTest, EnumerateMediaDevices) {
-  user_media_client_impl_->RequestMediaDevices();
+  user_media_client_impl_->RequestMediaDevicesForTest();
   base::RunLoop().RunUntilIdle();
 
   EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_SUCCEEDED,
@@ -722,7 +714,7 @@
 
 TEST_F(UserMediaClientImplTest, RenderToAssociatedSinkConstraint) {
   // For a null UserMediaRequest (no audio requested), we expect false.
-  user_media_client_impl_->RequestUserMedia();
+  user_media_client_impl_->RequestUserMediaForTest();
   EXPECT_FALSE(
       user_media_client_impl_->UserMediaRequestHasAutomaticDeviceSelection(
           ms_dispatcher_->audio_input_request_id()));
@@ -766,7 +758,8 @@
   EXPECT_CALL(
       media_devices_dispatcher_,
       SubscribeDeviceChangeNotifications(MEDIA_DEVICE_TYPE_AUDIO_OUTPUT, _, _));
-  user_media_client_impl_->SetMediaDeviceChangeObserver();
+  user_media_client_impl_->setMediaDeviceChangeObserver(
+      blink::WebMediaDeviceChangeObserver(true));
   base::RunLoop().RunUntilIdle();
 
   base::WeakPtr<MediaDevicesEventDispatcher> event_dispatcher =
@@ -786,7 +779,9 @@
   EXPECT_CALL(
       media_devices_dispatcher_,
       UnsubscribeDeviceChangeNotifications(MEDIA_DEVICE_TYPE_AUDIO_OUTPUT, _));
-  user_media_client_impl_->RemoveMediaDeviceChangeObserver();
+
+  user_media_client_impl_->setMediaDeviceChangeObserver(
+      blink::WebMediaDeviceChangeObserver());
   base::RunLoop().RunUntilIdle();
 }
 
@@ -822,7 +817,7 @@
   blink::WebUserMediaRequest request =
       blink::WebUserMediaRequest::createForTesting(
           audio_constraints, blink::WebMediaConstraints());
-  user_media_client_impl_->RequestUserMedia(request);
+  user_media_client_impl_->RequestUserMediaForTest(request);
   EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_FAILED,
             user_media_client_impl_->request_state());
 }
@@ -833,7 +828,7 @@
   blink::WebUserMediaRequest request =
       blink::WebUserMediaRequest::createForTesting(blink::WebMediaConstraints(),
                                                    video_constraints);
-  user_media_client_impl_->RequestUserMedia(request);
+  user_media_client_impl_->RequestUserMediaForTest(request);
   EXPECT_EQ(UserMediaClientImplUnderTest::REQUEST_FAILED,
             user_media_client_impl_->request_state());
 }
diff --git a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
index 81e189e..f5f34339 100644
--- a/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_adapter_bluez.cc
@@ -130,6 +130,8 @@
 
 void DoNothingOnError(
     device::BluetoothGattService::GattErrorCode /*error_code*/) {}
+void DoNothingOnAdvertisementError(
+    device::BluetoothAdvertisement::ErrorCode /*error_code*/) {}
 
 void SetIntervalErrorCallbackConnector(
     const device::BluetoothAdapter::AdvertisementErrorCallback& error_callback,
@@ -188,6 +190,16 @@
     delete it.second;
   profile_queues_.clear();
 
+  // This may call unregister on advertisements that have already been
+  // unregistered but that's fine. The advertisement object keeps a track of
+  // the fact that it has been already unregistered and will call our empty
+  // error callback with an "Already unregistered" error, which we'll ignore.
+  for (auto& it : advertisements_) {
+    it->Unregister(base::Bind(&base::DoNothing),
+                   base::Bind(&DoNothingOnAdvertisementError));
+  }
+  advertisements_.clear();
+
   bluez::BluezDBusManager::Get()->GetBluetoothAdapterClient()->RemoveObserver(
       this);
   bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->RemoveObserver(
@@ -478,6 +490,7 @@
   scoped_refptr<BluetoothAdvertisementBlueZ> advertisement(
       new BluetoothAdvertisementBlueZ(std::move(advertisement_data), this));
   advertisement->Register(base::Bind(callback, advertisement), error_callback);
+  advertisements_.emplace_back(advertisement);
 }
 
 void BluetoothAdapterBlueZ::SetAdvertisingInterval(
diff --git a/device/bluetooth/bluez/bluetooth_adapter_bluez.h b/device/bluetooth/bluez/bluetooth_adapter_bluez.h
index 58f12f0..5e9be8e 100644
--- a/device/bluetooth/bluez/bluetooth_adapter_bluez.h
+++ b/device/bluetooth/bluez/bluetooth_adapter_bluez.h
@@ -46,6 +46,7 @@
 
 class BluetoothBlueZTest;
 class BluetoothAdapterProfileBlueZ;
+class BluetoothAdvertisementBlueZ;
 class BluetoothDeviceBlueZ;
 class BluetoothLocalGattCharacteristicBlueZ;
 class BluetoothLocalGattServiceBlueZ;
@@ -491,6 +492,14 @@
   std::unique_ptr<BluetoothGattApplicationServiceProvider>
       gatt_application_provider_;
 
+  // List of advertisements registered with this adapter. This list is used
+  // to ensure we unregister any advertisements that were registered with
+  // this adapter on adapter shutdown. This is a sub-optimal solution since
+  // we'll keep a list of all advertisements ever created by this adapter (the
+  // unregistered ones will just be inactive). This will be fixed with
+  // crbug.com/687396.
+  std::vector<scoped_refptr<BluetoothAdvertisementBlueZ>> advertisements_;
+
   // Note: This should remain the last member so it'll be destroyed and
   // invalidate its weak pointers before any other members are destroyed.
   base::WeakPtrFactory<BluetoothAdapterBlueZ> weak_ptr_factory_;
diff --git a/device/bluetooth/bluez/bluetooth_advertisement_bluez.cc b/device/bluetooth/bluez/bluetooth_advertisement_bluez.cc
index 0adece73..7b938ff0 100644
--- a/device/bluetooth/bluez/bluetooth_advertisement_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_advertisement_bluez.cc
@@ -13,7 +13,6 @@
 #include "base/logging.h"
 #include "base/strings/string_util.h"
 #include "dbus/bus.h"
-#include "dbus/object_path.h"
 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
 #include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h"
 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
@@ -71,7 +70,7 @@
 BluetoothAdvertisementBlueZ::BluetoothAdvertisementBlueZ(
     std::unique_ptr<device::BluetoothAdvertisement::Data> data,
     scoped_refptr<BluetoothAdapterBlueZ> adapter)
-    : adapter_(adapter) {
+    : adapter_path_(adapter->object_path()) {
   // Generate a new object path - make sure that we strip any -'s from the
   // generated GUID string since object paths can only contain alphanumeric
   // characters and _ characters.
@@ -99,7 +98,7 @@
   bluez::BluezDBusManager::Get()
       ->GetBluetoothLEAdvertisingManagerClient()
       ->RegisterAdvertisement(
-          adapter_->object_path(), provider_->object_path(), success_callback,
+          adapter_path_, provider_->object_path(), success_callback,
           base::Bind(&RegisterErrorCallbackConnector, error_callback));
 }
 
@@ -122,9 +121,8 @@
   bluez::BluezDBusManager::Get()
       ->GetBluetoothLEAdvertisingManagerClient()
       ->UnregisterAdvertisement(
-          adapter_->object_path(), provider_->object_path(), success_callback,
+          adapter_path_, provider_->object_path(), success_callback,
           base::Bind(&UnregisterErrorCallbackConnector, error_callback));
-  provider_.reset();
 }
 
 void BluetoothAdvertisementBlueZ::Released() {
diff --git a/device/bluetooth/bluez/bluetooth_advertisement_bluez.h b/device/bluetooth/bluez/bluetooth_advertisement_bluez.h
index 010ed26..98be931d 100644
--- a/device/bluetooth/bluez/bluetooth_advertisement_bluez.h
+++ b/device/bluetooth/bluez/bluetooth_advertisement_bluez.h
@@ -8,6 +8,7 @@
 #include <memory>
 
 #include "base/macros.h"
+#include "dbus/object_path.h"
 #include "device/bluetooth/bluetooth_adapter.h"
 #include "device/bluetooth/bluetooth_advertisement.h"
 #include "device/bluetooth/bluetooth_export.h"
@@ -52,7 +53,7 @@
   ~BluetoothAdvertisementBlueZ() override;
 
   // Adapter this advertisement is advertising on.
-  scoped_refptr<BluetoothAdapterBlueZ> adapter_;
+  dbus::ObjectPath adapter_path_;
   std::unique_ptr<bluez::BluetoothLEAdvertisementServiceProvider> provider_;
 
   DISALLOW_COPY_AND_ASSIGN(BluetoothAdvertisementBlueZ);
diff --git a/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc
index bbf8b36d..1d220053 100644
--- a/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc
+++ b/device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc
@@ -75,6 +75,7 @@
     observer_.reset();
     // The adapter should outlive the advertisement.
     advertisement_ = nullptr;
+    BluetoothAdapterFactory::Shutdown();
     adapter_ = nullptr;
     bluez::BluezDBusManager::Shutdown();
   }
@@ -268,4 +269,16 @@
   ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
 }
 
+TEST_F(BluetoothAdvertisementBlueZTest, UnregisterAfterAdapterShutdown) {
+  scoped_refptr<BluetoothAdvertisement> advertisement = CreateAdvertisement();
+  ExpectSuccess();
+  EXPECT_TRUE(advertisement);
+
+  // Shutdown the default adapter.
+  BluetoothAdapterFactory::Shutdown();
+
+  UnregisterAdvertisement(advertisement);
+  ExpectError(BluetoothAdvertisement::ERROR_ADVERTISEMENT_DOES_NOT_EXIST);
+}
+
 }  // namespace bluez
diff --git a/device/vr/android/gvr/gvr_delegate.h b/device/vr/android/gvr/gvr_delegate.h
index 57d4d87..2e75a97 100644
--- a/device/vr/android/gvr/gvr_delegate.h
+++ b/device/vr/android/gvr/gvr_delegate.h
@@ -10,10 +10,6 @@
 #include "device/vr/vr_service.mojom.h"
 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
 
-namespace gvr {
-class GvrApi;
-}  // namespace gvr
-
 namespace device {
 
 constexpr gvr::Sizei kInvalidRenderTargetSize = {0, 0};
@@ -25,14 +21,15 @@
   virtual void UpdateWebVRTextureBounds(int16_t frame_index,
                                         const gvr::Rectf& left_bounds,
                                         const gvr::Rectf& right_bounds) = 0;
-  virtual gvr::Sizei GetWebVRCompositorSurfaceSize() = 0;
-  virtual void SetWebVRRenderSurfaceSize(int width, int height) = 0;
-  // TODO(mthiesse): This function is not threadsafe. crbug.com/674594
-  virtual gvr::GvrApi* gvr_api() = 0;
   virtual void OnVRVsyncProviderRequest(
       mojom::VRVSyncProviderRequest request) = 0;
   virtual void UpdateVSyncInterval(long timebase_nanos,
                                    double interval_seconds) = 0;
+  virtual bool SupportsPresentation() = 0;
+  virtual void ResetPose() = 0;
+  virtual void CreateVRDisplayInfo(
+      const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback,
+      uint32_t device_id) = 0;
 
  protected:
   virtual ~GvrDelegate() {}
@@ -44,11 +41,11 @@
   static GvrDelegateProvider* GetInstance();
 
   virtual void SetDeviceProvider(GvrDeviceProvider* device_provider) = 0;
+  virtual void ClearDeviceProvider() = 0;
   virtual void RequestWebVRPresent(
       const base::Callback<void(bool)>& callback) = 0;
   virtual void ExitWebVRPresent() = 0;
-  virtual GvrDelegate* GetNonPresentingDelegate() = 0;
-  virtual void DestroyNonPresentingDelegate() = 0;
+  virtual GvrDelegate* GetDelegate() = 0;
   virtual void SetListeningForActivate(bool listening) = 0;
 
  protected:
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc
index a8efa67a..5abea2b 100644
--- a/device/vr/android/gvr/gvr_device.cc
+++ b/device/vr/android/gvr/gvr_device.cc
@@ -19,138 +19,25 @@
 
 namespace device {
 
-GvrDevice::GvrDevice(GvrDeviceProvider* provider, GvrDelegate* delegate)
-    : VRDevice(), delegate_(delegate), gvr_provider_(provider) {}
+GvrDevice::GvrDevice(GvrDeviceProvider* provider)
+    : VRDevice(), gvr_provider_(provider) {}
 
 GvrDevice::~GvrDevice() {}
 
-mojom::VRDisplayInfoPtr GvrDevice::GetVRDevice() {
-  TRACE_EVENT0("input", "GvrDevice::GetVRDevice");
-
-  mojom::VRDisplayInfoPtr device = mojom::VRDisplayInfo::New();
-
-  device->index = id();
-
-  device->capabilities = mojom::VRDisplayCapabilities::New();
-  device->capabilities->hasOrientation = true;
-  device->capabilities->hasPosition = false;
-  device->capabilities->hasExternalDisplay = false;
-  device->capabilities->canPresent = true;
-
-  device->leftEye = mojom::VREyeParameters::New();
-  device->rightEye = mojom::VREyeParameters::New();
-  mojom::VREyeParametersPtr& left_eye = device->leftEye;
-  mojom::VREyeParametersPtr& right_eye = device->rightEye;
-
-  left_eye->fieldOfView = mojom::VRFieldOfView::New();
-  right_eye->fieldOfView = mojom::VRFieldOfView::New();
-
-  left_eye->offset.resize(3);
-  right_eye->offset.resize(3);
-
-  // Set the render target size to "invalid" to indicate that
-  // we can't render into it yet. Other code uses this to check
-  // for valid state.
-  gvr::Sizei render_target_size = kInvalidRenderTargetSize;
-  left_eye->renderWidth = render_target_size.width / 2;
-  left_eye->renderHeight = render_target_size.height;
-
-  right_eye->renderWidth = left_eye->renderWidth;
-  right_eye->renderHeight = left_eye->renderHeight;
-
-  gvr::GvrApi* gvr_api = GetGvrApi();
-  if (!gvr_api) {
-    // We may not be able to get an instance of GvrApi right away, so
-    // stub in some data till we have one.
-    device->displayName = "Unknown";
-
-    left_eye->fieldOfView->upDegrees = 45;
-    left_eye->fieldOfView->downDegrees = 45;
-    left_eye->fieldOfView->leftDegrees = 45;
-    left_eye->fieldOfView->rightDegrees = 45;
-
-    right_eye->fieldOfView->upDegrees = 45;
-    right_eye->fieldOfView->downDegrees = 45;
-    right_eye->fieldOfView->leftDegrees = 45;
-    right_eye->fieldOfView->rightDegrees = 45;
-
-    left_eye->offset[0] = -0.0;
-    left_eye->offset[1] = -0.0;
-    left_eye->offset[2] = -0.03;
-
-    right_eye->offset[0] = 0.0;
-    right_eye->offset[1] = 0.0;
-    right_eye->offset[2] = 0.03;
-
-    // Tell the delegate not to draw yet, to avoid a race condition
-    // (and visible wobble) on entering VR.
-    if (delegate_) {
-      delegate_->SetWebVRRenderSurfaceSize(kInvalidRenderTargetSize.width,
-                                           kInvalidRenderTargetSize.height);
-    }
-
-    return device;
+void GvrDevice::GetVRDevice(
+    const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) {
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (delegate) {
+    delegate->CreateVRDisplayInfo(callback, id());
+  } else {
+    callback.Run(nullptr);
   }
-
-  // In compositor mode, we have to use the current compositor window's
-  // surface size. Would be nice to change it, but that needs more browser
-  // internals to be modified. TODO(klausw,crbug.com/655722): remove this once
-  // we can pick our own surface size.
-  gvr::Sizei compositor_size = delegate_->GetWebVRCompositorSurfaceSize();
-  left_eye->renderWidth = compositor_size.width / 2;
-  left_eye->renderHeight = compositor_size.height;
-  right_eye->renderWidth = left_eye->renderWidth;
-  right_eye->renderHeight = left_eye->renderHeight;
-
-  std::string vendor = gvr_api->GetViewerVendor();
-  std::string model = gvr_api->GetViewerModel();
-  device->displayName = vendor + " " + model;
-
-  gvr::BufferViewportList gvr_buffer_viewports =
-      gvr_api->CreateEmptyBufferViewportList();
-  gvr_buffer_viewports.SetToRecommendedBufferViewports();
-
-  gvr::BufferViewport eye_viewport = gvr_api->CreateBufferViewport();
-  gvr_buffer_viewports.GetBufferViewport(GVR_LEFT_EYE, &eye_viewport);
-  gvr::Rectf eye_fov = eye_viewport.GetSourceFov();
-  left_eye->fieldOfView->upDegrees = eye_fov.top;
-  left_eye->fieldOfView->downDegrees = eye_fov.bottom;
-  left_eye->fieldOfView->leftDegrees = eye_fov.left;
-  left_eye->fieldOfView->rightDegrees = eye_fov.right;
-
-  eye_viewport = gvr_api->CreateBufferViewport();
-  gvr_buffer_viewports.GetBufferViewport(GVR_RIGHT_EYE, &eye_viewport);
-  eye_fov = eye_viewport.GetSourceFov();
-  right_eye->fieldOfView->upDegrees = eye_fov.top;
-  right_eye->fieldOfView->downDegrees = eye_fov.bottom;
-  right_eye->fieldOfView->leftDegrees = eye_fov.left;
-  right_eye->fieldOfView->rightDegrees = eye_fov.right;
-
-  gvr::Mat4f left_eye_mat = gvr_api->GetEyeFromHeadMatrix(GVR_LEFT_EYE);
-  left_eye->offset[0] = -left_eye_mat.m[0][3];
-  left_eye->offset[1] = -left_eye_mat.m[1][3];
-  left_eye->offset[2] = -left_eye_mat.m[2][3];
-
-  gvr::Mat4f right_eye_mat = gvr_api->GetEyeFromHeadMatrix(GVR_RIGHT_EYE);
-  right_eye->offset[0] = -right_eye_mat.m[0][3];
-  right_eye->offset[1] = -right_eye_mat.m[1][3];
-  right_eye->offset[2] = -right_eye_mat.m[2][3];
-
-  if (delegate_) {
-    delegate_->SetWebVRRenderSurfaceSize(2 * left_eye->renderWidth,
-                                         left_eye->renderHeight);
-  }
-
-  return device;
 }
 
 void GvrDevice::ResetPose() {
-  gvr::GvrApi* gvr_api = GetGvrApi();
-
-  // Should never call RecenterTracking when using with Daydream viewers. On
-  // those devices recentering should only be done via the controller.
-  if (gvr_api && gvr_api->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD)
-    gvr_api->RecenterTracking();
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (delegate)
+    delegate->ResetPose();
 }
 
 void GvrDevice::RequestPresent(const base::Callback<void(bool)>& callback) {
@@ -159,8 +46,9 @@
 
 void GvrDevice::SetSecureOrigin(bool secure_origin) {
   secure_origin_ = secure_origin;
-  if (delegate_)
-    delegate_->SetWebVRSecureOrigin(secure_origin_);
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (delegate)
+    delegate->SetWebVRSecureOrigin(secure_origin_);
 }
 
 void GvrDevice::ExitPresent() {
@@ -169,14 +57,16 @@
 }
 
 void GvrDevice::SubmitFrame(mojom::VRPosePtr pose) {
-  if (delegate_)
-    delegate_->SubmitWebVRFrame();
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (delegate)
+    delegate->SubmitWebVRFrame();
 }
 
 void GvrDevice::UpdateLayerBounds(int16_t frame_index,
                                   mojom::VRLayerBoundsPtr left_bounds,
                                   mojom::VRLayerBoundsPtr right_bounds) {
-  if (!delegate_)
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (!delegate)
     return;
 
   gvr::Rectf left_gvr_bounds;
@@ -191,30 +81,32 @@
   right_gvr_bounds.right = right_bounds->left + right_bounds->width;
   right_gvr_bounds.bottom = 1.0f - (right_bounds->top + right_bounds->height);
 
-  delegate_->UpdateWebVRTextureBounds(frame_index, left_gvr_bounds,
-                                      right_gvr_bounds);
+  delegate->UpdateWebVRTextureBounds(frame_index, left_gvr_bounds,
+                                     right_gvr_bounds);
 }
 
 void GvrDevice::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) {
-  if (delegate_)
-    delegate_->OnVRVsyncProviderRequest(std::move(request));
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (delegate)
+    delegate->OnVRVsyncProviderRequest(std::move(request));
 }
 
-void GvrDevice::SetDelegate(GvrDelegate* delegate) {
-  delegate_ = delegate;
-
+void GvrDevice::OnDelegateChanged() {
+  GvrDelegate* delegate = GetGvrDelegate();
+  if (!delegate || !delegate->SupportsPresentation())
+    OnExitPresent();
   // Notify the clients that this device has changed
-  if (delegate_) {
-    delegate_->SetWebVRSecureOrigin(secure_origin_);
-    OnChanged();
-  }
+  if (delegate)
+    delegate->SetWebVRSecureOrigin(secure_origin_);
+
+  OnChanged();
 }
 
-gvr::GvrApi* GvrDevice::GetGvrApi() {
-  if (!delegate_)
-    return nullptr;
-
-  return delegate_->gvr_api();
+GvrDelegate* GvrDevice::GetGvrDelegate() {
+  GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance();
+  if (delegate_provider)
+    return delegate_provider->GetDelegate();
+  return nullptr;
 }
 
 }  // namespace device
diff --git a/device/vr/android/gvr/gvr_device.h b/device/vr/android/gvr/gvr_device.h
index 8ca44fa9..55fb95f3 100644
--- a/device/vr/android/gvr/gvr_device.h
+++ b/device/vr/android/gvr/gvr_device.h
@@ -8,22 +8,19 @@
 #include "base/macros.h"
 #include "device/vr/vr_device.h"
 
-namespace gvr {
-class GvrApi;
-}  // namespace gvr
-
 namespace device {
 
 class GvrDeviceProvider;
 class GvrDelegate;
 
-class GvrDevice : public VRDevice {
+class DEVICE_VR_EXPORT GvrDevice : public VRDevice {
  public:
-  GvrDevice(GvrDeviceProvider* provider, GvrDelegate* delegate);
+  GvrDevice(GvrDeviceProvider* provider);
   ~GvrDevice() override;
 
   // VRDevice
-  mojom::VRDisplayInfoPtr GetVRDevice() override;
+  void GetVRDevice(
+      const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) override;
   void ResetPose() override;
 
   void RequestPresent(const base::Callback<void(bool)>& callback) override;
@@ -35,13 +32,11 @@
                          mojom::VRLayerBoundsPtr left_bounds,
                          mojom::VRLayerBoundsPtr right_bounds) override;
   void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) override;
-
-  void SetDelegate(GvrDelegate* delegate);
+  void OnDelegateChanged();
 
  private:
-  gvr::GvrApi* GetGvrApi();
+  GvrDelegate* GetGvrDelegate();
 
-  GvrDelegate* delegate_;
   GvrDeviceProvider* gvr_provider_;
   bool secure_origin_ = false;
 
diff --git a/device/vr/android/gvr/gvr_device_provider.cc b/device/vr/android/gvr/gvr_device_provider.cc
index 26d1c59..971fd7fc 100644
--- a/device/vr/android/gvr/gvr_device_provider.cc
+++ b/device/vr/android/gvr/gvr_device_provider.cc
@@ -12,129 +12,69 @@
 #include "base/android/scoped_java_ref.h"
 #include "device/vr/android/gvr/gvr_delegate.h"
 #include "device/vr/android/gvr/gvr_device.h"
-#include "device/vr/android/gvr/gvr_gamepad_data_fetcher.h"
 #include "device/vr/vr_device.h"
 #include "device/vr/vr_device_manager.h"
 #include "device/vr/vr_service.mojom.h"
 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h"
 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_controller.h"
-#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
-
-using base::android::AttachCurrentThread;
-using base::android::GetApplicationContext;
 
 namespace device {
 
-GvrDeviceProvider::GvrDeviceProvider() {}
+GvrDeviceProvider::GvrDeviceProvider()
+    : vr_device_(base::MakeUnique<GvrDevice>(this)) {}
 
 GvrDeviceProvider::~GvrDeviceProvider() {
-  GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
-      GAMEPAD_SOURCE_GVR);
-
   device::GvrDelegateProvider* delegate_provider =
       device::GvrDelegateProvider::GetInstance();
   if (delegate_provider) {
     delegate_provider->ExitWebVRPresent();
-    delegate_provider->DestroyNonPresentingDelegate();
-    delegate_provider->SetDeviceProvider(nullptr);
+    delegate_provider->ClearDeviceProvider();
   }
 }
 
 void GvrDeviceProvider::GetDevices(std::vector<VRDevice*>* devices) {
   Initialize();
-
-  if (vr_device_)
-    devices->push_back(vr_device_.get());
+  devices->push_back(vr_device_.get());
 }
 
 void GvrDeviceProvider::Initialize() {
+  // TODO(mthiesse): Clean up how we connect the GvrDelegateProvider to the
+  // GvrDeviceProvider so we don't have to call this function multiple times.
+  // Ideally the DelegateProvider would always be available, and GetInstance()
+  // would create it.
+  if (initialized_)
+    return;
   device::GvrDelegateProvider* delegate_provider =
       device::GvrDelegateProvider::GetInstance();
   if (!delegate_provider)
     return;
   delegate_provider->SetDeviceProvider(this);
-  if (!vr_device_) {
-    vr_device_.reset(
-        new GvrDevice(this, delegate_provider->GetNonPresentingDelegate()));
-  }
+  initialized_ = true;
 }
 
 void GvrDeviceProvider::RequestPresent(
     const base::Callback<void(bool)>& callback) {
+  Initialize();
   device::GvrDelegateProvider* delegate_provider =
       device::GvrDelegateProvider::GetInstance();
   if (!delegate_provider)
     return callback.Run(false);
 
-  // RequestWebVRPresent is async as a render thread may be created.
+  // RequestWebVRPresent is async as we may trigger a DON flow that pauses
+  // Chrome.
   delegate_provider->RequestWebVRPresent(callback);
 }
 
 // VR presentation exit requested by the API.
 void GvrDeviceProvider::ExitPresent() {
-  SwitchToNonPresentingDelegate();
-  // If we're presenting currently stop.
+  Initialize();
   GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance();
   if (delegate_provider)
     delegate_provider->ExitWebVRPresent();
 }
 
-void GvrDeviceProvider::OnGvrDelegateReady(GvrDelegate* delegate) {
-  if (!vr_device_)
-    return;
-  VLOG(1) << "Switching to presenting delegate";
-  vr_device_->SetDelegate(delegate);
-  GamepadDataFetcherManager::GetInstance()->AddFactory(
-      new GvrGamepadDataFetcher::Factory(delegate, vr_device_->id()));
-}
-
-// VR presentation exit requested by the delegate (probably via UI).
-void GvrDeviceProvider::OnGvrDelegateRemoved() {
-  if (!vr_device_)
-    return;
-
-  SwitchToNonPresentingDelegate();
-  vr_device_->OnExitPresent();
-}
-
-void GvrDeviceProvider::OnNonPresentingDelegateRemoved() {
-  if (!vr_device_)
-    return;
-  vr_device_->SetDelegate(nullptr);
-}
-
-void GvrDeviceProvider::OnDisplayBlur() {
-  if (!vr_device_)
-    return;
-  vr_device_->OnBlur();
-}
-
-void GvrDeviceProvider::OnDisplayFocus() {
-  if (!vr_device_)
-    return;
-  vr_device_->OnFocus();
-}
-
-void GvrDeviceProvider::OnDisplayActivate() {
-  if (!vr_device_)
-    return;
-  vr_device_->OnActivate(mojom::VRDisplayEventReason::MOUNTED);
-}
-
-void GvrDeviceProvider::SwitchToNonPresentingDelegate() {
-  GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance();
-  if (!vr_device_ || !delegate_provider)
-    return;
-
-  VLOG(1) << "Switching to non-presenting delegate";
-  vr_device_->SetDelegate(delegate_provider->GetNonPresentingDelegate());
-
-  // Remove GVR gamepad polling.
-  GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
-      GAMEPAD_SOURCE_GVR);
-}
-
 void GvrDeviceProvider::SetListeningForActivate(bool listening) {
+  Initialize();
   device::GvrDelegateProvider* delegate_provider =
       device::GvrDelegateProvider::GetInstance();
   if (!delegate_provider)
diff --git a/device/vr/android/gvr/gvr_device_provider.h b/device/vr/android/gvr/gvr_device_provider.h
index 6bbef04..5793021 100644
--- a/device/vr/android/gvr/gvr_device_provider.h
+++ b/device/vr/android/gvr/gvr_device_provider.h
@@ -14,7 +14,6 @@
 
 namespace device {
 
-class GvrDelegate;
 class GvrDevice;
 
 class DEVICE_VR_EXPORT GvrDeviceProvider : public VRDeviceProvider {
@@ -31,20 +30,11 @@
   void RequestPresent(const base::Callback<void(bool)>& callback);
   void ExitPresent();
 
-  void OnGvrDelegateReady(GvrDelegate* delegate);
-  void OnGvrDelegateRemoved();
-
-  // TODO(mthiesse): Make the NonPresentingDelegate owned by this class so that
-  // it cannot be removed.
-  void OnNonPresentingDelegateRemoved();
-  void OnDisplayBlur();
-  void OnDisplayFocus();
-  void OnDisplayActivate();
+  GvrDevice* Device() { return vr_device_.get(); }
 
  private:
-  void SwitchToNonPresentingDelegate();
-
   std::unique_ptr<GvrDevice> vr_device_;
+  bool initialized_ = false;
 
   DISALLOW_COPY_AND_ASSIGN(GvrDeviceProvider);
 };
diff --git a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
index be21ce9..d4eed15 100644
--- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
+++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
@@ -9,6 +9,7 @@
 
 #include "device/vr/android/gvr/gvr_delegate.h"
 #include "third_party/WebKit/public/platform/WebGamepads.h"
+#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr.h"
 
 namespace device {
 
@@ -29,36 +30,38 @@
 
 using namespace blink;
 
-GvrGamepadDataFetcher::Factory::Factory(GvrDelegate* delegate,
+GvrGamepadDataFetcher::Factory::Factory(gvr_context* context,
                                         unsigned int display_id)
-    : delegate_(delegate), display_id_(display_id) {}
+    : context_(context), display_id_(display_id) {}
 
 GvrGamepadDataFetcher::Factory::~Factory() {}
 
 std::unique_ptr<GamepadDataFetcher>
 GvrGamepadDataFetcher::Factory::CreateDataFetcher() {
-  if (!delegate_)
-    return nullptr;
-  return base::MakeUnique<GvrGamepadDataFetcher>(delegate_, display_id_);
+  return base::MakeUnique<GvrGamepadDataFetcher>(context_, display_id_);
 }
 
 GamepadSource GvrGamepadDataFetcher::Factory::source() {
   return GAMEPAD_SOURCE_GVR;
 }
 
-GvrGamepadDataFetcher::GvrGamepadDataFetcher(GvrDelegate* delegate,
+GvrGamepadDataFetcher::GvrGamepadDataFetcher(gvr_context* context,
                                              unsigned int display_id)
     : display_id_(display_id) {
-  gvr::GvrApi* gvr_api = delegate->gvr_api();
   controller_api_.reset(new gvr::ControllerApi());
   int32_t options = gvr::ControllerApi::DefaultOptions();
   options |= GVR_CONTROLLER_ENABLE_GYRO;
-  bool success = controller_api_->Init(options, gvr_api->GetContext());
+
+  // TODO(mthiesse): Use of the gvr_context on multiple threads isn't guaranteed
+  // to be threadsafe. All gvr context usage should be moved to VR Shell's GL
+  // thread. crbug.com/674594
+  std::unique_ptr<gvr::GvrApi> gvr = gvr::GvrApi::WrapNonOwned(context);
+  // TODO(bajones): Monitor changes to the controller handedness.
+  handedness_ = gvr->GetUserPrefs().GetControllerHandedness();
+
+  bool success = controller_api_->Init(options, context);
   if (!success)
     controller_api_.reset(nullptr);
-
-  // TODO(bajones): Monitor changes to the controller handedness.
-  handedness_ = gvr_api->GetUserPrefs().GetControllerHandedness();
 }
 
 GvrGamepadDataFetcher::~GvrGamepadDataFetcher() {}
diff --git a/device/vr/android/gvr/gvr_gamepad_data_fetcher.h b/device/vr/android/gvr/gvr_gamepad_data_fetcher.h
index 5b105c42..35f3d93 100644
--- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.h
+++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.h
@@ -8,28 +8,27 @@
 #include <string>
 
 #include "device/gamepad/gamepad_data_fetcher.h"
+#include "device/vr/vr_export.h"
 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_controller.h"
 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"
 
 namespace device {
 
-class GvrDelegate;
-
-class GvrGamepadDataFetcher : public GamepadDataFetcher {
+class DEVICE_VR_EXPORT GvrGamepadDataFetcher : public GamepadDataFetcher {
  public:
   class Factory : public GamepadDataFetcherFactory {
    public:
-    Factory(GvrDelegate* delegate, unsigned int display_id);
+    Factory(gvr_context* context, unsigned int display_id);
     ~Factory() override;
     std::unique_ptr<GamepadDataFetcher> CreateDataFetcher() override;
     GamepadSource source() override;
 
    private:
-    GvrDelegate* delegate_;
+    gvr_context* context_;
     unsigned int display_id_;
   };
 
-  GvrGamepadDataFetcher(GvrDelegate* delegate, unsigned int display_id);
+  GvrGamepadDataFetcher(gvr_context* context, unsigned int display_id);
   ~GvrGamepadDataFetcher() override;
 
   GamepadSource source() override;
diff --git a/device/vr/test/fake_vr_device.cc b/device/vr/test/fake_vr_device.cc
index d0853de..c6999050 100644
--- a/device/vr/test/fake_vr_device.cc
+++ b/device/vr/test/fake_vr_device.cc
@@ -54,9 +54,10 @@
   device_ = device.Clone();
 }
 
-mojom::VRDisplayInfoPtr FakeVRDevice::GetVRDevice() {
+void FakeVRDevice::GetVRDevice(
+    const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) {
   mojom::VRDisplayInfoPtr display = device_.Clone();
-  return display.Clone();
+  callback.Run(std::move(display));
 }
 
 void FakeVRDevice::ResetPose() {}
diff --git a/device/vr/test/fake_vr_device.h b/device/vr/test/fake_vr_device.h
index 188d82e..178610ea 100644
--- a/device/vr/test/fake_vr_device.h
+++ b/device/vr/test/fake_vr_device.h
@@ -22,7 +22,9 @@
 
   void SetVRDevice(const mojom::VRDisplayInfoPtr& device);
 
-  mojom::VRDisplayInfoPtr GetVRDevice() override;
+  // VRDevice
+  void GetVRDevice(
+      const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) override;
   void ResetPose() override;
 
   void RequestPresent(const base::Callback<void(bool)>& callback) override;
diff --git a/device/vr/vr_device.cc b/device/vr/vr_device.cc
index b89fc44..52d81bc 100644
--- a/device/vr/vr_device.cc
+++ b/device/vr/vr_device.cc
@@ -10,7 +10,8 @@
 
 unsigned int VRDevice::next_id_ = 1;
 
-VRDevice::VRDevice() : presenting_display_(nullptr), id_(next_id_) {
+VRDevice::VRDevice()
+    : presenting_display_(nullptr), id_(next_id_), weak_ptr_factory_(this) {
   // Prevent wraparound. Devices with this ID will be treated as invalid.
   if (next_id_ != VR_DEVICE_LAST_ID)
     next_id_++;
@@ -43,19 +44,24 @@
 }
 
 void VRDevice::OnChanged() {
-  mojom::VRDisplayInfoPtr vr_device_info = GetVRDevice();
+  base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind(
+      &VRDevice::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr());
+  GetVRDevice(callback);
+}
+
+void VRDevice::OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr vr_device_info) {
   if (vr_device_info.is_null())
     return;
-
   for (const auto& display : displays_)
     display->client()->OnChanged(vr_device_info.Clone());
 }
 
 void VRDevice::OnExitPresent() {
+  if (!presenting_display_)
+    return;
   auto it = displays_.find(presenting_display_);
-  if (it != displays_.end())
-    (*it)->client()->OnExitPresent();
-
+  CHECK(it != displays_.end());
+  (*it)->client()->OnExitPresent();
   SetPresentingDisplay(nullptr);
 }
 
diff --git a/device/vr/vr_device.h b/device/vr/vr_device.h
index d2ed8fa..be836ee 100644
--- a/device/vr/vr_device.h
+++ b/device/vr/vr_device.h
@@ -23,7 +23,8 @@
 
   unsigned int id() const { return id_; }
 
-  virtual mojom::VRDisplayInfoPtr GetVRDevice() = 0;
+  virtual void GetVRDevice(
+      const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) = 0;
   virtual void ResetPose() = 0;
 
   virtual void RequestPresent(const base::Callback<void(bool)>& callback) = 0;
@@ -55,6 +56,8 @@
   void SetPresentingDisplay(VRDisplayImpl* display);
 
  private:
+  void OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr vr_device_info);
+
   std::set<VRDisplayImpl*> displays_;
 
   VRDisplayImpl* presenting_display_;
@@ -63,6 +66,8 @@
 
   static unsigned int next_id_;
 
+  base::WeakPtrFactory<VRDevice> weak_ptr_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(VRDevice);
 };
 
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc
index c99b7dfc..c14f8b7 100644
--- a/device/vr/vr_display_impl.cc
+++ b/device/vr/vr_display_impl.cc
@@ -15,11 +15,17 @@
       device_(device),
       service_(service),
       weak_ptr_factory_(this) {
-  mojom::VRDisplayInfoPtr display_info = device->GetVRDevice();
-  if (service->client()) {
-    service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
-                                          mojo::MakeRequest(&client_),
-                                          std::move(display_info));
+  base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind(
+      &VRDisplayImpl::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr());
+  device->GetVRDevice(callback);
+}
+
+void VRDisplayImpl::OnVRDisplayInfoCreated(
+    mojom::VRDisplayInfoPtr display_info) {
+  if (service_->client()) {
+    service_->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
+                                           mojo::MakeRequest(&client_),
+                                           std::move(display_info));
   }
 }
 
diff --git a/device/vr/vr_display_impl.h b/device/vr/vr_display_impl.h
index 02a1e1a..7116d52 100644
--- a/device/vr/vr_display_impl.h
+++ b/device/vr/vr_display_impl.h
@@ -45,6 +45,8 @@
                             bool secure_origin,
                             bool success);
 
+  void OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr display_info);
+
   mojo::Binding<mojom::VRDisplay> binding_;
   mojom::VRDisplayClientPtr client_;
   device::VRDevice* device_;
diff --git a/extensions/browser/api/declarative_content/content_rules_registry.h b/extensions/browser/api/declarative_content/content_rules_registry.h
index 239687f..2c67160 100644
--- a/extensions/browser/api/declarative_content/content_rules_registry.h
+++ b/extensions/browser/api/declarative_content/content_rules_registry.h
@@ -13,9 +13,8 @@
 
 namespace content {
 class BrowserContext;
+class NavigationHandle;
 class WebContents;
-struct FrameNavigateParams;
-struct LoadCommittedDetails;
 }
 
 namespace extensions {
@@ -48,10 +47,11 @@
       content::WebContents* contents) = 0;
 
   // Applies all content rules given that a tab was just navigated.
-  virtual void DidNavigateMainFrame(
+  // This corresponds to the notification of the same name in
+  // content::WebContentsObserver.
+  virtual void DidFinishNavigation(
       content::WebContents* tab,
-      const content::LoadCommittedDetails& details,
-      const content::FrameNavigateParams& params) = 0;
+      content::NavigationHandle* navigation_handle) = 0;
 
  protected:
   ~ContentRulesRegistry() override {}
diff --git a/extensions/common/extension.cc b/extensions/common/extension.cc
index 3160619..e804db05 100644
--- a/extensions/common/extension.cc
+++ b/extensions/common/extension.cc
@@ -306,18 +306,6 @@
               url::kStandardSchemeSeparator + extension_id + "/");
 }
 
-bool Extension::ShowConfigureContextMenus() const {
-  // Normally we don't show a context menu for component actions, but when
-  // re-design is enabled we show them in the toolbar (if they have an action),
-  // and it is weird to have a random button that has no context menu when the
-  // rest do.
-  if (location() == Manifest::COMPONENT ||
-      location() == Manifest::EXTERNAL_COMPONENT)
-    return FeatureSwitch::extension_action_redesign()->IsEnabled();
-
-  return true;
-}
-
 bool Extension::OverlapsWithOrigin(const GURL& origin) const {
   if (url() == origin)
     return true;
diff --git a/extensions/common/extension.h b/extensions/common/extension.h
index bab44d4..a5c2702 100644
--- a/extensions/common/extension.h
+++ b/extensions/common/extension.h
@@ -233,9 +233,6 @@
   // Returns the base extension url for a given |extension_id|.
   static GURL GetBaseURLFromExtensionId(const ExtensionId& extension_id);
 
-  // Whether context menu should be shown for page and browser actions.
-  bool ShowConfigureContextMenus() const;
-
   // Returns true if this extension or app includes areas within |origin|.
   bool OverlapsWithOrigin(const GURL& origin) const;
 
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index e38190c..637b488 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -34,6 +34,14 @@
 IsolateHolder::IsolateHolder(
     scoped_refptr<base::SingleThreadTaskRunner> task_runner,
     AccessMode access_mode)
+    : IsolateHolder(std::move(task_runner),
+                    AccessMode::kSingleThread,
+                    kAllowAtomicsWait) {}
+
+IsolateHolder::IsolateHolder(
+    scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+    AccessMode access_mode,
+    AllowAtomicsWaitMode atomics_wait_mode)
     : access_mode_(access_mode) {
   v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
   CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first";
@@ -43,6 +51,7 @@
   params.constraints.ConfigureDefaults(base::SysInfo::AmountOfPhysicalMemory(),
                                        base::SysInfo::AmountOfVirtualMemory());
   params.array_buffer_allocator = allocator;
+  params.allow_atomics_wait = atomics_wait_mode == kAllowAtomicsWait;
   isolate_ = v8::Isolate::New(params);
   isolate_data_.reset(
       new PerIsolateData(isolate_, allocator, access_mode, task_runner));
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index 62b871085..0d9cb3b 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -41,6 +41,12 @@
     kUseLocker
   };
 
+  // Whether Atomics.wait can be called on this isolate.
+  enum AllowAtomicsWaitMode {
+    kDisallowAtomicsWait,
+    kAllowAtomicsWait
+  };
+
   // Indicates whether V8 works with stable or experimental v8 extras.
   enum V8ExtrasMode {
     kStableV8Extras,
@@ -51,6 +57,9 @@
       scoped_refptr<base::SingleThreadTaskRunner> task_runner);
   IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
                 AccessMode access_mode);
+  IsolateHolder(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+                AccessMode access_mode,
+                AllowAtomicsWaitMode atomics_wait_mode);
   ~IsolateHolder();
 
   // Should be invoked once before creating IsolateHolder instances to
diff --git a/ios/web/shell/test/context_menu_egtest.mm b/ios/web/shell/test/context_menu_egtest.mm
index ddd7895..46f665e 100644
--- a/ios/web/shell/test/context_menu_egtest.mm
+++ b/ios/web/shell/test/context_menu_egtest.mm
@@ -27,6 +27,7 @@
 
 using testing::ContextMenuItemWithText;
 using testing::ElementToDismissContextMenu;
+using web::WebViewContainingText;
 
 // Context menu test cases for the web shell.
 @interface ContextMenuTestCase : ShellBaseTestCase
@@ -36,26 +37,24 @@
 
 // Tests context menu appears on a regular link.
 - (void)testContextMenu {
-// TODO(crbug.com/687546): Tests disabled on devices.
-#if !TARGET_IPHONE_SIMULATOR
-  EARL_GREY_TEST_DISABLED(@"Disabled for devices because it is very flaky.");
-#endif
-
   // Create map of canned responses and set up the test HTML server.
   std::map<GURL, std::string> responses;
   GURL initialURL = web::test::HttpServer::MakeUrl("http://contextMenuOpen");
   GURL destinationURL = web::test::HttpServer::MakeUrl("http://destination");
   // The initial page contains a link to the destination URL.
   std::string linkID = "link";
+  std::string linkText = "link for context menu";
   responses[initialURL] =
       "<body>"
       "<a href='" +
-      destinationURL.spec() + "' id='" + linkID +
-      "'>link for context menu</a>"
+      destinationURL.spec() + "' id='" + linkID + "'>" + linkText +
+      "</a>"
       "</span></body>";
 
   web::test::SetUpSimpleHttpServer(responses);
   [ShellEarlGrey loadURL:initialURL];
+  [[EarlGrey selectElementWithMatcher:WebViewContainingText(linkText)]
+      assertWithMatcher:grey_notNil()];
 
   [[EarlGrey selectElementWithMatcher:web::WebView()]
       performAction:web::longPressElementForContextMenu(
@@ -85,14 +84,17 @@
   // The initial page contains a link to the destination URL that has an
   // ancestor that disables the context menu via -webkit-touch-callout.
   std::string linkID = "link";
+  std::string linkText = "no-callout link";
   responses[initialURL] = "<body><a href='" + destinationURL.spec() +
                           "' style='-webkit-touch-callout: none' id='" +
-                          linkID +
-                          "'>no-callout link</a>"
+                          linkID + "'>" + linkText +
+                          "</a>"
                           "</body>";
 
   web::test::SetUpSimpleHttpServer(responses);
   [ShellEarlGrey loadURL:initialURL];
+  [[EarlGrey selectElementWithMatcher:WebViewContainingText(linkText)]
+      assertWithMatcher:grey_notNil()];
 
   [[EarlGrey selectElementWithMatcher:web::WebView()]
       performAction:web::longPressElementForContextMenu(
@@ -115,15 +117,18 @@
   // The initial page contains a link to the destination URL that has an
   // ancestor that disables the context menu via -webkit-touch-callout.
   std::string linkID = "link";
+  std::string linkText = "ancestor no-callout link";
   responses[initialURL] =
       "<body style='-webkit-touch-callout: none'>"
       "<a href='" +
-      destinationURL.spec() + "' id='" + linkID +
-      "'>ancestor no-callout link</a>"
+      destinationURL.spec() + "' id='" + linkID + "'>" + linkText +
+      "</a>"
       "</body>";
 
   web::test::SetUpSimpleHttpServer(responses);
   [ShellEarlGrey loadURL:initialURL];
+  [[EarlGrey selectElementWithMatcher:WebViewContainingText(linkText)]
+      assertWithMatcher:grey_notNil()];
 
   [[EarlGrey selectElementWithMatcher:web::WebView()]
       performAction:web::longPressElementForContextMenu(
@@ -146,16 +151,19 @@
   // The initial page contains a link to the destination URL that has an
   // ancestor that disables the context menu via -webkit-touch-callout.
   std::string linkID = "link";
+  std::string linkText = "override no-callout link";
   responses[initialURL] =
       "<body style='-webkit-touch-callout: none'>"
       "<a href='" +
       destinationURL.spec() + "' style='-webkit-touch-callout: default' id='" +
-      linkID +
-      "'>override no-callout link</a>"
+      linkID + "'>" + linkText +
+      "</a>"
       "</body>";
 
   web::test::SetUpSimpleHttpServer(responses);
   [ShellEarlGrey loadURL:initialURL];
+  [[EarlGrey selectElementWithMatcher:WebViewContainingText(linkText)]
+      assertWithMatcher:grey_notNil()];
 
   [[EarlGrey selectElementWithMatcher:web::WebView()]
       performAction:web::longPressElementForContextMenu(
diff --git a/mash/simple_wm/simple_wm.cc b/mash/simple_wm/simple_wm.cc
index 90fd986..b8f98a75 100644
--- a/mash/simple_wm/simple_wm.cc
+++ b/mash/simple_wm/simple_wm.cc
@@ -399,10 +399,6 @@
   // Don't care.
 }
 
-aura::client::CaptureClient* SimpleWM::GetCaptureClient() {
-  return wm_state_.capture_controller();
-}
-
 aura::PropertyConverter* SimpleWM::GetPropertyConverter() {
   return &property_converter_;
 }
diff --git a/mash/simple_wm/simple_wm.h b/mash/simple_wm/simple_wm.h
index c648897..a0a05356 100644
--- a/mash/simple_wm/simple_wm.h
+++ b/mash/simple_wm/simple_wm.h
@@ -67,7 +67,6 @@
   void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override;
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override;
-  aura::client::CaptureClient* GetCaptureClient() override;
   aura::PropertyConverter* GetPropertyConverter() override;
 
   // aura::WindowManagerDelegate:
diff --git a/net/BUILD.gn b/net/BUILD.gn
index 8a7ee89e..c550ba7 100644
--- a/net/BUILD.gn
+++ b/net/BUILD.gn
@@ -4689,8 +4689,8 @@
     "tools/content_decoder_tool/content_decoder_tool.h",
     "tools/content_decoder_tool/content_decoder_tool_unittest.cc",
     "tools/quic/quic_simple_client_test.cc",
-    "tools/quic/test_tools/mock_quic_server_session_visitor.cc",
-    "tools/quic/test_tools/mock_quic_server_session_visitor.h",
+    "tools/quic/test_tools/mock_quic_session_visitor.cc",
+    "tools/quic/test_tools/mock_quic_session_visitor.h",
     "tools/tld_cleanup/tld_cleanup_util_unittest.cc",
     "url_request/report_sender_unittest.cc",
     "url_request/sdch_dictionary_fetcher_unittest.cc",
diff --git a/net/http/disk_cache_based_quic_server_info_unittest.cc b/net/http/disk_cache_based_quic_server_info_unittest.cc
index d4d338e..55f5835 100644
--- a/net/http/disk_cache_based_quic_server_info_unittest.cc
+++ b/net/http/disk_cache_based_quic_server_info_unittest.cc
@@ -94,7 +94,7 @@
   // Use the blocking mock backend factory to force asynchronous completion
   // of quic_server_info->WaitForDataReady(), so that the callback will run.
   MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
-  MockHttpCache cache(base::WrapUnique(factory));
+  MockHttpCache cache(base::WrapUnique(factory), true);
   QuicServerId server_id("www.verisign.com", 443, PRIVACY_MODE_DISABLED);
   std::unique_ptr<QuicServerInfo> quic_server_info(
       new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache()));
@@ -109,7 +109,7 @@
 
 // Tests the basic logic of storing, retrieving and updating data.
 TEST(DiskCacheBasedQuicServerInfo, Update) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
   TestCompletionCallback callback;
 
@@ -180,7 +180,7 @@
 
 // Test that demonstrates different info is returned when the ports differ.
 TEST(DiskCacheBasedQuicServerInfo, UpdateDifferentPorts) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
   AddMockTransaction(&kHostInfoTransaction2);
   TestCompletionCallback callback;
@@ -281,7 +281,7 @@
 
 // Test IsReadyToPersist when there is a pending write.
 TEST(DiskCacheBasedQuicServerInfo, IsReadyToPersist) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
   TestCompletionCallback callback;
 
@@ -343,7 +343,7 @@
 
 // Test multiple calls to Persist.
 TEST(DiskCacheBasedQuicServerInfo, MultiplePersist) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
   TestCompletionCallback callback;
 
@@ -433,7 +433,7 @@
 
 TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReady) {
   MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
-  MockHttpCache cache(base::WrapUnique(factory));
+  MockHttpCache cache(base::WrapUnique(factory), true);
   TestCompletionCallback callback;
   QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
   std::unique_ptr<QuicServerInfo> quic_server_info(
@@ -451,7 +451,7 @@
 }
 
 TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReadyButDataIsReady) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
   TestCompletionCallback callback;
 
@@ -470,7 +470,7 @@
 TEST(DiskCacheBasedQuicServerInfo, CancelWaitForDataReadyAfterDeleteCache) {
   std::unique_ptr<QuicServerInfo> quic_server_info;
   {
-    MockHttpCache cache;
+    MockHttpCache cache(true);
     AddMockTransaction(&kHostInfoTransaction1);
     TestCompletionCallback callback;
 
@@ -491,7 +491,7 @@
 
 // Test Start() followed by Persist() without calling WaitForDataReady.
 TEST(DiskCacheBasedQuicServerInfo, StartAndPersist) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
 
   QuicServerId server_id("www.google.com", 443, PRIVACY_MODE_DISABLED);
@@ -557,7 +557,7 @@
 // persists the data when Start() finishes.
 TEST(DiskCacheBasedQuicServerInfo, PersistWhenNotReadyToPersist) {
   MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
-  MockHttpCache cache(base::WrapUnique(factory));
+  MockHttpCache cache(base::WrapUnique(factory), true);
   AddMockTransaction(&kHostInfoTransaction1);
   TestCompletionCallback callback;
 
@@ -618,7 +618,7 @@
 
 // Test multiple calls to Persist without waiting for the data to be written.
 TEST(DiskCacheBasedQuicServerInfo, MultiplePersistsWithoutWaiting) {
-  MockHttpCache cache;
+  MockHttpCache cache(true);
   AddMockTransaction(&kHostInfoTransaction1);
   TestCompletionCallback callback;
 
@@ -704,7 +704,7 @@
   // Use the blocking mock backend factory to force asynchronous completion
   // of quic_server_info->WaitForDataReady(), so that the callback will run.
   MockBlockingBackendFactory* factory = new MockBlockingBackendFactory();
-  MockHttpCache cache(base::WrapUnique(factory));
+  MockHttpCache cache(base::WrapUnique(factory), true);
   QuicServerId server_id("www.verisign.com", 443, PRIVACY_MODE_DISABLED);
   QuicServerInfo* quic_server_info =
       new DiskCacheBasedQuicServerInfo(server_id, cache.http_cache());
diff --git a/net/http/http_server_properties_manager.cc b/net/http/http_server_properties_manager.cc
index dfcd04e..e94c7ca 100644
--- a/net/http/http_server_properties_manager.cc
+++ b/net/http/http_server_properties_manager.cc
@@ -16,6 +16,7 @@
 #include "base/values.h"
 #include "net/base/ip_address.h"
 #include "net/base/port_util.h"
+#include "net/quic/platform/api/quic_url_utils.h"
 #include "url/gurl.h"
 
 namespace net {
@@ -714,7 +715,8 @@
        it.Advance()) {
     // Get quic_server_id.
     const std::string& quic_server_id_str = it.key();
-    QuicServerId quic_server_id = QuicServerId::FromString(quic_server_id_str);
+    QuicServerId quic_server_id;
+    QuicUrlUtils::StringToQuicServerId(quic_server_id_str, &quic_server_id);
     if (quic_server_id.host().empty()) {
       DVLOG(1) << "Malformed http_server_properties for quic server: "
                << quic_server_id_str;
diff --git a/net/http/mock_http_cache.cc b/net/http/mock_http_cache.cc
index 9fc8ced..d7c08bac 100644
--- a/net/http/mock_http_cache.cc
+++ b/net/http/mock_http_cache.cc
@@ -540,14 +540,22 @@
 
 //-----------------------------------------------------------------------------
 
-MockHttpCache::MockHttpCache()
-    : MockHttpCache(base::MakeUnique<MockBackendFactory>()) {}
+MockHttpCache::MockHttpCache() : MockHttpCache(false) {}
 
 MockHttpCache::MockHttpCache(
     std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory)
+    : MockHttpCache(std::move(disk_cache_factory), false) {}
+
+MockHttpCache::MockHttpCache(bool set_up_quic_server_info)
+    : MockHttpCache(base::MakeUnique<MockBackendFactory>(),
+                    set_up_quic_server_info) {}
+
+MockHttpCache::MockHttpCache(
+    std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory,
+    bool set_up_quic_server_info)
     : http_cache_(base::MakeUnique<MockNetworkLayer>(),
                   std::move(disk_cache_factory),
-                  true) {}
+                  set_up_quic_server_info) {}
 
 disk_cache::Backend* MockHttpCache::backend() {
   TestCompletionCallback cb;
diff --git a/net/http/mock_http_cache.h b/net/http/mock_http_cache.h
index 7cf03db4..ebf67fe 100644
--- a/net/http/mock_http_cache.h
+++ b/net/http/mock_http_cache.h
@@ -182,6 +182,12 @@
   MockHttpCache();
   explicit MockHttpCache(
       std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory);
+  // |set_up_quic_server_info| if set, will set a quic server info factory
+  // adptor.
+  explicit MockHttpCache(bool set_up_quic_server_info);
+
+  MockHttpCache(std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory,
+                bool set_up_quic_server_info);
 
   HttpCache* http_cache() { return &http_cache_; }
 
diff --git a/net/quic/core/quic_blocked_writer_interface.h b/net/quic/core/quic_blocked_writer_interface.h
index 3a85b80..2da2eb4 100644
--- a/net/quic/core/quic_blocked_writer_interface.h
+++ b/net/quic/core/quic_blocked_writer_interface.h
@@ -9,8 +9,6 @@
 #ifndef NET_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_
 #define NET_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_
 
-#include <cstddef>
-
 #include "net/quic/platform/api/quic_export.h"
 
 namespace net {
diff --git a/net/quic/core/quic_client_promised_info.cc b/net/quic/core/quic_client_promised_info.cc
index a08ff45..ebc6d18 100644
--- a/net/quic/core/quic_client_promised_info.cc
+++ b/net/quic/core/quic_client_promised_info.cc
@@ -7,8 +7,6 @@
 #include "net/quic/core/spdy_utils.h"
 #include "net/quic/platform/api/quic_logging.h"
 
-using net::SpdyHeaderBlock;
-using net::kPushPromiseTimeoutSecs;
 using std::string;
 
 namespace net {
diff --git a/net/quic/core/quic_client_session_base.h b/net/quic/core/quic_client_session_base.h
index 76aa4374..7cb6610 100644
--- a/net/quic/core/quic_client_session_base.h
+++ b/net/quic/core/quic_client_session_base.h
@@ -65,15 +65,15 @@
   // Called by |QuicSpdyClientStream| on receipt of PUSH_PROMISE, does
   // some session level validation and creates the
   // |QuicClientPromisedInfo| inserting into maps by (promised) id and
-  // url. Returns true if a new push promise is accepted. Reset the promised
-  // stream and returns false otherwiese.
+  // url. Returns true if a new push promise is accepted. Resets the promised
+  // stream and returns false otherwise.
   virtual bool HandlePromised(QuicStreamId associated_id,
                               QuicStreamId promised_id,
                               const SpdyHeaderBlock& headers);
 
   // For cross-origin server push, this should verify the server is
   // authoritative per [RFC2818], Section 3.  Roughly, subjectAltName
-  // std::list in the certificate should contain a matching DNS name, or IP
+  // list in the certificate should contain a matching DNS name, or IP
   // address.  |hostname| is derived from the ":authority" header field of
   // the PUSH_PROMISE frame, port if present there will be dropped.
   virtual bool IsAuthorized(const std::string& hostname) = 0;
diff --git a/net/quic/core/quic_config.h b/net/quic/core/quic_config.h
index e2388108..286ba1c 100644
--- a/net/quic/core/quic_config.h
+++ b/net/quic/core/quic_config.h
@@ -5,9 +5,8 @@
 #ifndef NET_QUIC_CORE_QUIC_CONFIG_H_
 #define NET_QUIC_CORE_QUIC_CONFIG_H_
 
-#include <stddef.h>
-#include <stdint.h>
-
+#include <cstddef>
+#include <cstdint>
 #include <string>
 
 #include "net/quic/core/quic_packets.h"
diff --git a/net/quic/core/quic_config_test.cc b/net/quic/core/quic_config_test.cc
index 9cf0f33..4445e00 100644
--- a/net/quic/core/quic_config_test.cc
+++ b/net/quic/core/quic_config_test.cc
@@ -6,7 +6,6 @@
 
 #include "net/quic/core/crypto/crypto_handshake_message.h"
 #include "net/quic/core/crypto/crypto_protocol.h"
-#include "net/quic/core/quic_flags.h"
 #include "net/quic/core/quic_packets.h"
 #include "net/quic/core/quic_time.h"
 #include "net/quic/core/quic_utils.h"
diff --git a/net/quic/core/quic_connection.cc b/net/quic/core/quic_connection.cc
index 1f867c9d..3bc93ab 100644
--- a/net/quic/core/quic_connection.cc
+++ b/net/quic/core/quic_connection.cc
@@ -1305,7 +1305,7 @@
   if (!Near(header.packet_number, last_header_.packet_number)) {
     QUIC_DLOG(INFO) << ENDPOINT << "Packet " << header.packet_number
                     << " out of bounds.  Discarding";
-    CloseConnection(QUIC_INVALID_PACKET_HEADER, "packet number out of bounds.",
+    CloseConnection(QUIC_INVALID_PACKET_HEADER, "Packet number out of bounds.",
                     ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
     return false;
   }
@@ -1641,7 +1641,6 @@
   const string error_details = QuicStrCat(
       "Write failed with error: ", error_code, " (", strerror(error_code), ")");
   QUIC_LOG_FIRST_N(ERROR, 2) << ENDPOINT << error_details;
-  // We can't send an error as the socket is presumably borked.
   switch (error_code) {
     case kMessageTooBigErrorCode:
       CloseConnection(
@@ -1690,8 +1689,9 @@
         sent_packet_manager_.GetRttStats()->initial_rtt_us());
   }
 
-  if (debug_visitor_)
+  if (debug_visitor_ != nullptr) {
     debug_visitor_->OnRttChanged(rtt);
+  }
 }
 
 void QuicConnection::OnPathDegrading() {
diff --git a/net/quic/core/quic_connection.h b/net/quic/core/quic_connection.h
index 37182bd..6604c77 100644
--- a/net/quic/core/quic_connection.h
+++ b/net/quic/core/quic_connection.h
@@ -16,9 +16,8 @@
 #ifndef NET_QUIC_CORE_QUIC_CONNECTION_H_
 #define NET_QUIC_CORE_QUIC_CONNECTION_H_
 
-#include <stddef.h>
-#include <stdint.h>
-
+#include <cstddef>
+#include <cstdint>
 #include <deque>
 #include <list>
 #include <map>
@@ -52,6 +51,7 @@
 class QuicClock;
 class QuicConfig;
 class QuicConnection;
+class QuicDecrypter;
 class QuicEncrypter;
 class QuicRandom;
 
@@ -170,7 +170,7 @@
                             TransmissionType transmission_type,
                             QuicTime sent_time) {}
 
-  // Called when an PING frame has been sent.
+  // Called when a PING frame has been sent.
   virtual void OnPingSent() {}
 
   // Called when a packet has been received, but before it is
@@ -483,7 +483,10 @@
     debug_visitor_ = debug_visitor;
     sent_packet_manager_.SetDebugDelegate(debug_visitor);
   }
+  // Used in Chromium, but not internally.
+  // Must only be called before ping_alarm_ is set.
   void set_ping_timeout(QuicTime::Delta ping_timeout) {
+    DCHECK(!ping_alarm_->IsSet());
     ping_timeout_ = ping_timeout;
   }
   const QuicTime::Delta ping_timeout() { return ping_timeout_; }
@@ -760,12 +763,11 @@
   bool WritePacket(SerializedPacket* packet);
 
   // Make sure an ack we got from our peer is sane.
-  // Returns nullptr for valid acks or an error std::string if it was invalid.
+  // Returns nullptr for valid acks or an error string if it was invalid.
   const char* ValidateAckFrame(const QuicAckFrame& incoming_ack);
 
   // Make sure a stop waiting we got from our peer is sane.
-  // Returns nullptr if the frame is valid or an error std::string if it was
-  // invalid.
+  // Returns nullptr if the frame is valid or an error string if it was invalid.
   const char* ValidateStopWaitingFrame(
       const QuicStopWaitingFrame& stop_waiting);
 
@@ -914,7 +916,7 @@
   bool pending_version_negotiation_packet_;
 
   // When packets could not be sent because the socket was not writable,
-  // they are added to this std::list.  All corresponding frames are in
+  // they are added to this list.  All corresponding frames are in
   // unacked_packets_ if they are to be retransmitted.  Packets encrypted_buffer
   // fields are owned by the QueuedPacketList, in order to ensure they outlast
   // the original scope of the SerializedPacket.
@@ -981,7 +983,7 @@
   // An alarm that is scheduled when the connection can still write and there
   // may be more data to send.
   // TODO(ianswett): Remove resume_writes_alarm when deprecating
-  // FLAGS_quic_only_one_sending_alarm
+  // FLAGS_quic_reloadable_flag_quic_only_one_sending_alarm
   QuicArenaScopedPtr<QuicAlarm> resume_writes_alarm_;
   // An alarm that fires when the connection may have timed out.
   QuicArenaScopedPtr<QuicAlarm> timeout_alarm_;
diff --git a/net/quic/core/quic_constants.h b/net/quic/core/quic_constants.h
index 9783db06..8560e90 100644
--- a/net/quic/core/quic_constants.h
+++ b/net/quic/core/quic_constants.h
@@ -27,6 +27,7 @@
 
 // Default initial maximum size in bytes of a QUIC packet.
 const QuicByteCount kDefaultMaxPacketSize = 1350;
+// Default initial maximum size in bytes of a QUIC packet for servers.
 const QuicByteCount kDefaultServerMaxPacketSize = 1000;
 // The maximum packet size of any QUIC packet, based on ethernet's max size,
 // minus the IP and UDP headers. IPv6 has a 40 byte header, UDP adds an
diff --git a/net/quic/core/quic_crypto_client_stream.cc b/net/quic/core/quic_crypto_client_stream.cc
index 7db937c..f7fba760 100644
--- a/net/quic/core/quic_crypto_client_stream.cc
+++ b/net/quic/core/quic_crypto_client_stream.cc
@@ -5,7 +5,6 @@
 #include "net/quic/core/quic_crypto_client_stream.h"
 
 #include <memory>
-#include <vector>
 
 #include "base/metrics/histogram_macros.h"
 #include "base/metrics/sparse_histogram.h"
@@ -235,7 +234,7 @@
         DoInitializeServerConfigUpdate(cached);
         break;
       case STATE_NONE:
-        NOTREACHED();
+        QUIC_NOTREACHED();
         return;  // We are done.
     }
   } while (rv != QUIC_PENDING && next_state_ != STATE_NONE);
@@ -319,7 +318,7 @@
       return;
     }
     // TODO(rch): Remove this when we remove:
-    // FLAGS_quic_use_chlo_packet_size
+    // FLAGS_quic_reloadable_flag_quic_use_chlo_packet_size
     out.set_minimum_size(
         static_cast<size_t>(max_packet_size - kFramingOverhead));
     next_state_ = STATE_RECV_REJ;
diff --git a/net/quic/core/quic_crypto_client_stream.h b/net/quic/core/quic_crypto_client_stream.h
index cc937f09..6cbdad52 100644
--- a/net/quic/core/quic_crypto_client_stream.h
+++ b/net/quic/core/quic_crypto_client_stream.h
@@ -267,6 +267,7 @@
   // STATE_VERIFY_PROOF*, and subsequent STATE_SEND_CHLO state.
   bool stateless_reject_received_;
 
+  // Only used in chromium, not internally.
   base::TimeTicks proof_verify_start_time_;
 
   int num_scup_messages_received_;
diff --git a/net/quic/core/quic_crypto_server_stream_test.cc b/net/quic/core/quic_crypto_server_stream_test.cc
index bba6bda..0c693262 100644
--- a/net/quic/core/quic_crypto_server_stream_test.cc
+++ b/net/quic/core/quic_crypto_server_stream_test.cc
@@ -228,7 +228,6 @@
 
 TEST_P(QuicCryptoServerStreamTest, StatelessRejectAfterCHLO) {
   FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true;
-
   Initialize();
 
   EXPECT_CALL(*server_connection_,
@@ -262,7 +261,6 @@
 
 TEST_P(QuicCryptoServerStreamTest, ConnectedAfterStatelessHandshake) {
   FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true;
-
   Initialize();
 
   InitializeFakeClient(/* supports_stateless_rejects= */ true);
@@ -306,7 +304,6 @@
 
 TEST_P(QuicCryptoServerStreamTest, NoStatelessRejectIfNoClientSupport) {
   FLAGS_quic_reloadable_flag_enable_quic_stateless_reject_support = true;
-
   Initialize();
 
   // The server is configured to use stateless rejects, but the client does not
@@ -508,6 +505,5 @@
 }
 
 }  // namespace
-
 }  // namespace test
 }  // namespace net
diff --git a/net/quic/core/quic_crypto_stream.cc b/net/quic/core/quic_crypto_stream.cc
index 814b2683..3b3ec36 100644
--- a/net/quic/core/quic_crypto_stream.cc
+++ b/net/quic/core/quic_crypto_stream.cc
@@ -17,7 +17,6 @@
 
 using std::string;
 using base::StringPiece;
-using net::SpdyPriority;
 
 namespace net {
 
diff --git a/net/quic/core/quic_crypto_stream.h b/net/quic/core/quic_crypto_stream.h
index 05aa23c..32ed81a9 100644
--- a/net/quic/core/quic_crypto_stream.h
+++ b/net/quic/core/quic_crypto_stream.h
@@ -5,7 +5,7 @@
 #ifndef NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_
 #define NET_QUIC_CORE_QUIC_CRYPTO_STREAM_H_
 
-#include <stddef.h>
+#include <cstddef>
 
 #include "base/macros.h"
 #include "net/quic/core/crypto/crypto_framer.h"
diff --git a/net/quic/core/quic_flow_controller_test.cc b/net/quic/core/quic_flow_controller_test.cc
index 4b4bd76..9e8eb45 100644
--- a/net/quic/core/quic_flow_controller_test.cc
+++ b/net/quic/core/quic_flow_controller_test.cc
@@ -6,7 +6,6 @@
 
 #include <memory>
 
-#include "base/format_macros.h"
 #include "net/quic/platform/api/quic_str_cat.h"
 #include "net/quic/test_tools/quic_connection_peer.h"
 #include "net/quic/test_tools/quic_flow_controller_peer.h"
diff --git a/net/quic/core/quic_headers_stream_test.cc b/net/quic/core/quic_headers_stream_test.cc
index 33dcaeaa..2c413d9 100644
--- a/net/quic/core/quic_headers_stream_test.cc
+++ b/net/quic/core/quic_headers_stream_test.cc
@@ -942,8 +942,7 @@
   // This test will issue a write that will require fragmenting into
   // multiple HTTP/2 DATA frames.
   const int kMinDataFrames = 4;
-  const size_t data_len =
-      kSpdyInitialFrameSizeLimit * kMinDataFrames + 1024;
+  const size_t data_len = kSpdyInitialFrameSizeLimit * kMinDataFrames + 1024;
   // Set headers stream send window large enough for data written below.
   headers_stream_->flow_controller()->UpdateSendWindowOffset(data_len * 2 * 4);
   string data(data_len, 'a');
diff --git a/net/quic/core/quic_iovector.h b/net/quic/core/quic_iovector.h
index 6e893e9..b163fee5 100644
--- a/net/quic/core/quic_iovector.h
+++ b/net/quic/core/quic_iovector.h
@@ -5,7 +5,7 @@
 #ifndef NET_QUIC_CORE_QUIC_IOVECTOR_H_
 #define NET_QUIC_CORE_QUIC_IOVECTOR_H_
 
-#include <stddef.h>
+#include <cstddef>
 
 #include "net/base/iovec.h"
 #include "net/quic/platform/api/quic_export.h"
diff --git a/net/quic/core/quic_one_block_arena.h b/net/quic/core/quic_one_block_arena.h
index a3f13fa8..bf9cef4 100644
--- a/net/quic/core/quic_one_block_arena.h
+++ b/net/quic/core/quic_one_block_arena.h
@@ -12,6 +12,7 @@
 
 #include <cstdint>
 
+#include "base/macros.h"
 #include "net/quic/core/quic_arena_scoped_ptr.h"
 #include "net/quic/core/quic_types.h"
 #include "net/quic/platform/api/quic_bug_tracker.h"
diff --git a/net/quic/core/quic_packet_creator_test.cc b/net/quic/core/quic_packet_creator_test.cc
index 1815978..a4dafc76 100644
--- a/net/quic/core/quic_packet_creator_test.cc
+++ b/net/quic/core/quic_packet_creator_test.cc
@@ -10,7 +10,6 @@
 #include <string>
 
 #include "base/macros.h"
-#include "base/stl_util.h"
 #include "net/quic/core/crypto/null_encrypter.h"
 #include "net/quic/core/crypto/quic_decrypter.h"
 #include "net/quic/core/crypto/quic_encrypter.h"
diff --git a/net/quic/core/quic_packet_generator_test.cc b/net/quic/core/quic_packet_generator_test.cc
index 4486fc5..f846dbc 100644
--- a/net/quic/core/quic_packet_generator_test.cc
+++ b/net/quic/core/quic_packet_generator_test.cc
@@ -9,7 +9,6 @@
 #include <string>
 
 #include "base/macros.h"
-#include "base/stl_util.h"
 #include "net/quic/core/crypto/crypto_protocol.h"
 #include "net/quic/core/crypto/null_encrypter.h"
 #include "net/quic/core/crypto/quic_decrypter.h"
diff --git a/net/quic/core/quic_received_packet_manager.cc b/net/quic/core/quic_received_packet_manager.cc
index e78c2fb..2415307 100644
--- a/net/quic/core/quic_received_packet_manager.cc
+++ b/net/quic/core/quic_received_packet_manager.cc
@@ -7,7 +7,6 @@
 #include <limits>
 #include <utility>
 
-#include "net/base/linked_hash_map.h"
 #include "net/quic/core/crypto/crypto_protocol.h"
 #include "net/quic/core/quic_connection_stats.h"
 #include "net/quic/platform/api/quic_bug_tracker.h"
@@ -72,8 +71,8 @@
 
 bool QuicReceivedPacketManager::IsAwaitingPacket(
     QuicPacketNumber packet_number) {
-  return ::net::IsAwaitingPacket(ack_frame_, packet_number,
-                                 peer_least_packet_awaiting_ack_);
+  return net::IsAwaitingPacket(ack_frame_, packet_number,
+                               peer_least_packet_awaiting_ack_);
 }
 
 const QuicFrame QuicReceivedPacketManager::GetUpdatedAckFrame(
diff --git a/net/quic/core/quic_server_id.cc b/net/quic/core/quic_server_id.cc
index 280530a..62397061 100644
--- a/net/quic/core/quic_server_id.cc
+++ b/net/quic/core/quic_server_id.cc
@@ -6,10 +6,7 @@
 
 #include <tuple>
 
-#include "net/base/host_port_pair.h"
-#include "net/base/port_util.h"
 #include "net/quic/platform/api/quic_str_cat.h"
-#include "url/gurl.h"
 
 using std::string;
 
@@ -41,16 +38,6 @@
          host_port_pair_.Equals(other.host_port_pair_);
 }
 
-// static
-QuicServerId QuicServerId::FromString(const std::string& str) {
-  GURL url(str);
-  if (!url.is_valid())
-    return QuicServerId();
-  return QuicServerId(HostPortPair::FromURL(url), url.path_piece() == "/private"
-                                                      ? PRIVACY_MODE_ENABLED
-                                                      : PRIVACY_MODE_DISABLED);
-}
-
 string QuicServerId::ToString() const {
   return QuicStrCat("https://", host_port_pair_.ToString(),
                     (privacy_mode_ == PRIVACY_MODE_ENABLED ? "/private" : ""));
diff --git a/net/quic/core/quic_server_id.h b/net/quic/core/quic_server_id.h
index 906529d..580789c 100644
--- a/net/quic/core/quic_server_id.h
+++ b/net/quic/core/quic_server_id.h
@@ -31,15 +31,11 @@
   bool operator<(const QuicServerId& other) const;
   bool operator==(const QuicServerId& other) const;
 
-  // Creates a QuicServerId from a string formatted in same manner as
-  // ToString().
-  static QuicServerId FromString(const std::string& str);
-
   // ToString() will convert the QuicServerId to "scheme:hostname:port" or
   // "scheme:hostname:port/private". "scheme" will be "https".
   std::string ToString() const;
 
-  // Used in Chromium, but not in the server.
+  // Used in Chromium, but not internally.
   const HostPortPair& host_port_pair() const { return host_port_pair_; }
 
   const std::string& host() const { return host_port_pair_.host(); }
diff --git a/net/quic/core/quic_server_session_base.cc b/net/quic/core/quic_server_session_base.cc
index 3f00b27..9b13dba 100644
--- a/net/quic/core/quic_server_session_base.cc
+++ b/net/quic/core/quic_server_session_base.cc
@@ -7,7 +7,6 @@
 #include "net/quic/core/proto/cached_network_parameters.pb.h"
 #include "net/quic/core/quic_connection.h"
 #include "net/quic/core/quic_flags.h"
-#include "net/quic/core/quic_spdy_session.h"
 #include "net/quic/core/quic_stream.h"
 #include "net/quic/platform/api/quic_bug_tracker.h"
 #include "net/quic/platform/api/quic_logging.h"
diff --git a/net/quic/core/quic_server_session_base.h b/net/quic/core/quic_server_session_base.h
index 5ad9a84..6b41e657 100644
--- a/net/quic/core/quic_server_session_base.h
+++ b/net/quic/core/quic_server_session_base.h
@@ -7,8 +7,6 @@
 #ifndef NET_QUIC_CORE_QUIC_SERVER_SESSION_BASE_H_
 #define NET_QUIC_CORE_QUIC_SERVER_SESSION_BASE_H_
 
-#include <stdint.h>
-
 #include <cstdint>
 #include <memory>
 #include <set>
diff --git a/net/quic/core/quic_server_session_base_test.cc b/net/quic/core/quic_server_session_base_test.cc
index fdbb61b..09c9c28 100644
--- a/net/quic/core/quic_server_session_base_test.cc
+++ b/net/quic/core/quic_server_session_base_test.cc
@@ -31,7 +31,7 @@
 #include "net/test/gtest_util.h"
 #include "net/tools/quic/quic_epoll_connection_helper.h"
 #include "net/tools/quic/quic_simple_server_stream.h"
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/net/quic/core/quic_session.cc b/net/quic/core/quic_session.cc
index 6161ad4..36e41c4 100644
--- a/net/quic/core/quic_session.cc
+++ b/net/quic/core/quic_session.cc
@@ -4,7 +4,9 @@
 
 #include "net/quic/core/quic_session.h"
 
-#include "net/quic/core/crypto/proof_verifier.h"
+#include <cstdint>
+#include <utility>
+
 #include "net/quic/core/quic_connection.h"
 #include "net/quic/core/quic_flags.h"
 #include "net/quic/core/quic_flow_controller.h"
diff --git a/net/quic/core/quic_session.h b/net/quic/core/quic_session.h
index 77fc237..283f55f 100644
--- a/net/quic/core/quic_session.h
+++ b/net/quic/core/quic_session.h
@@ -7,8 +7,7 @@
 #ifndef NET_QUIC_CORE_QUIC_SESSION_H_
 #define NET_QUIC_CORE_QUIC_SESSION_H_
 
-#include <stddef.h>
-
+#include <cstddef>
 #include <map>
 #include <memory>
 #include <string>
@@ -26,6 +25,7 @@
 #include "net/quic/core/quic_write_blocked_list.h"
 #include "net/quic/platform/api/quic_containers.h"
 #include "net/quic/platform/api/quic_export.h"
+#include "net/quic/platform/api/quic_socket_address.h"
 
 namespace net {
 
@@ -41,7 +41,7 @@
  public:
   // An interface from the session to the entity owning the session.
   // This lets the session notify its owner (the Dispatcher) when the connection
-  // is closed, blocked, or added/removed from the time-wait std::list.
+  // is closed, blocked, or added/removed from the time-wait list.
   class Visitor {
    public:
     virtual ~Visitor() {}
diff --git a/net/quic/core/quic_session_test.cc b/net/quic/core/quic_session_test.cc
index e04a331..84c8db3e 100644
--- a/net/quic/core/quic_session_test.cc
+++ b/net/quic/core/quic_session_test.cc
@@ -4,6 +4,7 @@
 
 #include "net/quic/core/quic_session.h"
 
+#include <cstdint>
 #include <set>
 #include <utility>
 
@@ -33,8 +34,6 @@
 #include "testing/gmock_mutant.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
-using net::SpdyHeaderBlock;
-using net::SpdyPriority;
 using std::string;
 using testing::CreateFunctor;
 using testing::AtLeast;
diff --git a/net/quic/core/quic_socket_address_coder.cc b/net/quic/core/quic_socket_address_coder.cc
index ae1dd6d6..dc20f807 100644
--- a/net/quic/core/quic_socket_address_coder.cc
+++ b/net/quic/core/quic_socket_address_coder.cc
@@ -4,8 +4,6 @@
 
 #include "net/quic/core/quic_socket_address_coder.h"
 
-#include "net/base/sys_addrinfo.h"
-
 using std::string;
 
 namespace net {
@@ -59,10 +57,10 @@
   size_t ip_length;
   switch (address_family) {
     case kIPv4:
-      ip_length = IPAddress::kIPv4AddressSize;
+      ip_length = QuicIpAddress::kIPv4AddressSize;
       break;
     case kIPv6:
-      ip_length = IPAddress::kIPv6AddressSize;
+      ip_length = QuicIpAddress::kIPv6AddressSize;
       break;
     default:
       return false;
diff --git a/net/quic/core/quic_socket_address_coder.h b/net/quic/core/quic_socket_address_coder.h
index 1038c28..0a98cfe 100644
--- a/net/quic/core/quic_socket_address_coder.h
+++ b/net/quic/core/quic_socket_address_coder.h
@@ -5,9 +5,7 @@
 #ifndef NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_
 #define NET_QUIC_CORE_QUIC_SOCKET_ADDRESS_CODER_H_
 
-#include <stddef.h>
-#include <stdint.h>
-
+#include <cstdint>
 #include <string>
 
 #include "base/macros.h"
diff --git a/net/quic/core/quic_socket_address_coder_test.cc b/net/quic/core/quic_socket_address_coder_test.cc
index 703cc430..548fde2e 100644
--- a/net/quic/core/quic_socket_address_coder_test.cc
+++ b/net/quic/core/quic_socket_address_coder_test.cc
@@ -4,7 +4,6 @@
 
 #include "net/quic/core/quic_socket_address_coder.h"
 
-#include "net/base/sys_addrinfo.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using std::string;
diff --git a/net/quic/core/quic_spdy_session.cc b/net/quic/core/quic_spdy_session.cc
index d6481612..84274e7 100644
--- a/net/quic/core/quic_spdy_session.cc
+++ b/net/quic/core/quic_spdy_session.cc
@@ -4,7 +4,6 @@
 
 #include "net/quic/core/quic_spdy_session.h"
 
-#include <algorithm>
 #include <cstdint>
 #include <string>
 #include <utility>
diff --git a/net/quic/core/quic_spdy_session.h b/net/quic/core/quic_spdy_session.h
index d0066b59..a4ce4236 100644
--- a/net/quic/core/quic_spdy_session.h
+++ b/net/quic/core/quic_spdy_session.h
@@ -5,8 +5,7 @@
 #ifndef NET_QUIC_CORE_QUIC_SPDY_SESSION_H_
 #define NET_QUIC_CORE_QUIC_SPDY_SESSION_H_
 
-#include <stddef.h>
-
+#include <cstddef>
 #include <memory>
 
 #include "base/macros.h"
diff --git a/net/quic/core/quic_spdy_stream.cc b/net/quic/core/quic_spdy_stream.cc
index 2f39ea4..8a6cf48 100644
--- a/net/quic/core/quic_spdy_stream.cc
+++ b/net/quic/core/quic_spdy_stream.cc
@@ -19,7 +19,6 @@
 using std::string;
 
 namespace net {
-
 #define ENDPOINT                                                               \
   (session()->perspective() == Perspective::IS_SERVER ? "Server: " : "Client:" \
                                                                      " ")
diff --git a/net/quic/core/quic_spdy_stream.h b/net/quic/core/quic_spdy_stream.h
index d470e80..c68cdff 100644
--- a/net/quic/core/quic_spdy_stream.h
+++ b/net/quic/core/quic_spdy_stream.h
@@ -221,8 +221,7 @@
   bool headers_decompressed_;
   // The priority of the stream, once parsed.
   SpdyPriority priority_;
-  // Contains a copy of the decompressed header (name, value) std::pairs until
-  // they
+  // Contains a copy of the decompressed header (name, value) pairs until they
   // are consumed via Readv.
   QuicHeaderList header_list_;
 
diff --git a/net/quic/platform/api/quic_ip_address.h b/net/quic/platform/api/quic_ip_address.h
index 9b10e8ef..75b9f0c7 100644
--- a/net/quic/platform/api/quic_ip_address.h
+++ b/net/quic/platform/api/quic_ip_address.h
@@ -17,6 +17,10 @@
   // implementation (platform dependent) of an IP address is in
   // QuicIpAddressImpl.
  public:
+  enum : size_t {
+    kIPv4AddressSize = QuicIpAddressImpl::kIPv4AddressSize,
+    kIPv6AddressSize = QuicIpAddressImpl::kIPv6AddressSize
+  };
   static QuicIpAddress Loopback4();
   static QuicIpAddress Loopback6();
   static QuicIpAddress Any4();
diff --git a/net/quic/platform/api/quic_logging.h b/net/quic/platform/api/quic_logging.h
index 3bc5f48..5031e9f 100644
--- a/net/quic/platform/api/quic_logging.h
+++ b/net/quic/platform/api/quic_logging.h
@@ -23,4 +23,6 @@
 
 #define QUIC_PREDICT_FALSE(x) QUIC_PREDICT_FALSE_IMPL(x)
 
+#define QUIC_NOTREACHED() QUIC_NOTREACHED_IMPL()
+
 #endif  // NET_QUIC_PLATFORM_API_QUIC_LOGGING_H_
diff --git a/net/quic/platform/api/quic_url_utils.cc b/net/quic/platform/api/quic_url_utils.cc
index 73b8fcd..a15fdeb2 100644
--- a/net/quic/platform/api/quic_url_utils.cc
+++ b/net/quic/platform/api/quic_url_utils.cc
@@ -29,4 +29,9 @@
   return QuicUrlUtilsImpl::NormalizeHostname(hostname);
 }
 
+// static
+void QuicUrlUtils::StringToQuicServerId(const string& str, QuicServerId* out) {
+  QuicUrlUtilsImpl::StringToQuicServerId(str, out);
+}
+
 }  // namespace net
diff --git a/net/quic/platform/api/quic_url_utils.h b/net/quic/platform/api/quic_url_utils.h
index 53564f10e..0ff77f2 100644
--- a/net/quic/platform/api/quic_url_utils.h
+++ b/net/quic/platform/api/quic_url_utils.h
@@ -31,6 +31,10 @@
   // WARNING: mutates |hostname| in place and returns |hostname|.
   static char* NormalizeHostname(char* hostname);
 
+  // Creates a QuicServerId from a string formatted in same manner as
+  // QuicServerId::ToString().
+  static void StringToQuicServerId(const std::string& str, QuicServerId* out);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(QuicUrlUtils);
 };
diff --git a/net/quic/platform/impl/quic_ip_address_impl.h b/net/quic/platform/impl/quic_ip_address_impl.h
index c2b0d89..c9c2998f 100644
--- a/net/quic/platform/impl/quic_ip_address_impl.h
+++ b/net/quic/platform/impl/quic_ip_address_impl.h
@@ -15,6 +15,10 @@
 
 class QUIC_EXPORT_PRIVATE QuicIpAddressImpl {
  public:
+  enum : size_t {
+    kIPv4AddressSize = IPAddress::kIPv4AddressSize,
+    kIPv6AddressSize = IPAddress::kIPv6AddressSize
+  };
   static QuicIpAddressImpl Loopback4();
   static QuicIpAddressImpl Loopback6();
   static QuicIpAddressImpl Any4();
diff --git a/net/quic/platform/impl/quic_logging_impl.h b/net/quic/platform/impl/quic_logging_impl.h
index 6daa47f..d6e6cdc 100644
--- a/net/quic/platform/impl/quic_logging_impl.h
+++ b/net/quic/platform/impl/quic_logging_impl.h
@@ -55,4 +55,6 @@
 
 #define QUIC_PREDICT_FALSE_IMPL(x) x
 
+#define QUIC_NOTREACHED_IMPL() NOTREACHED()
+
 #endif  // NET_QUIC_PLATFORM_IMPL_QUIC_LOGGING_IMPL_H_
diff --git a/net/quic/platform/impl/quic_url_utils_impl.cc b/net/quic/platform/impl/quic_url_utils_impl.cc
index f9c7600..323e326 100644
--- a/net/quic/platform/impl/quic_url_utils_impl.cc
+++ b/net/quic/platform/impl/quic_url_utils_impl.cc
@@ -59,4 +59,17 @@
   return hostname;
 }
 
+// static
+void QuicUrlUtilsImpl::StringToQuicServerId(const string& str,
+                                            QuicServerId* out) {
+  GURL url(str);
+  if (!url.is_valid()) {
+    *out = QuicServerId();
+    return;
+  }
+  *out = QuicServerId(HostPortPair::FromURL(url), url.path_piece() == "/private"
+                                                      ? PRIVACY_MODE_ENABLED
+                                                      : PRIVACY_MODE_DISABLED);
+}
+
 }  // namespace net
diff --git a/net/quic/platform/impl/quic_url_utils_impl.h b/net/quic/platform/impl/quic_url_utils_impl.h
index 070f516..d8b945b 100644
--- a/net/quic/platform/impl/quic_url_utils_impl.h
+++ b/net/quic/platform/impl/quic_url_utils_impl.h
@@ -7,6 +7,7 @@
 
 #include "base/macros.h"
 #include "base/strings/string_piece.h"
+#include "net/quic/core/quic_server_id.h"
 #include "net/quic/platform/api/quic_export.h"
 
 namespace net {
@@ -31,6 +32,10 @@
   // WARNING: mutates |hostname| in place and returns |hostname|.
   static char* NormalizeHostname(char* hostname);
 
+  // Creates a QuicServerId from a string formatted in same manner as
+  // QuicServerId::ToString().
+  static void StringToQuicServerId(const std::string& str, QuicServerId* out);
+
  private:
   DISALLOW_COPY_AND_ASSIGN(QuicUrlUtilsImpl);
 };
diff --git a/net/quic/test_tools/quic_stream_factory_peer.cc b/net/quic/test_tools/quic_stream_factory_peer.cc
index 03dbff8..d7ea3105 100644
--- a/net/quic/test_tools/quic_stream_factory_peer.cc
+++ b/net/quic/test_tools/quic_stream_factory_peer.cc
@@ -174,7 +174,9 @@
       ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem"));
   DCHECK(cert);
   std::string der_bytes;
-  DCHECK(X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_bytes));
+  bool success =
+      X509Certificate::GetDEREncoded(cert->os_cert_handle(), &der_bytes);
+  DCHECK(success);
   certs.push_back(der_bytes);
 
   QuicCryptoClientConfig* crypto_config = &factory->crypto_config_;
diff --git a/net/quic/test_tools/quic_test_utils.h b/net/quic/test_tools/quic_test_utils.h
index a1fad40..082c5e32 100644
--- a/net/quic/test_tools/quic_test_utils.h
+++ b/net/quic/test_tools/quic_test_utils.h
@@ -37,7 +37,7 @@
 #include "net/test/gtest_util.h"
 #include "net/tools/quic/quic_dispatcher.h"
 #include "net/tools/quic/quic_per_connection_packet_writer.h"
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
 #include "testing/gmock/include/gmock/gmock.h"
 
 using base::StringPiece;
diff --git a/net/tools/quic/quic_simple_server_session_test.cc b/net/tools/quic/quic_simple_server_session_test.cc
index a808d23..2ee35bb 100644
--- a/net/tools/quic/quic_simple_server_session_test.cc
+++ b/net/tools/quic/quic_simple_server_session_test.cc
@@ -29,7 +29,7 @@
 #include "net/quic/test_tools/quic_test_utils.h"
 #include "net/test/gtest_util.h"
 #include "net/tools/quic/quic_simple_server_stream.h"
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/net/tools/quic/quic_time_wait_list_manager_test.cc b/net/tools/quic/quic_time_wait_list_manager_test.cc
index a409ead..a870e30 100644
--- a/net/tools/quic/quic_time_wait_list_manager_test.cc
+++ b/net/tools/quic/quic_time_wait_list_manager_test.cc
@@ -23,7 +23,7 @@
 #include "net/tools/quic/quic_epoll_alarm_factory.h"
 #include "net/tools/quic/quic_epoll_connection_helper.h"
 #include "net/tools/quic/test_tools/mock_epoll_server.h"
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/net/tools/quic/test_tools/mock_quic_server_session_visitor.cc b/net/tools/quic/test_tools/mock_quic_session_visitor.cc
similarity index 87%
rename from net/tools/quic/test_tools/mock_quic_server_session_visitor.cc
rename to net/tools/quic/test_tools/mock_quic_session_visitor.cc
index 46aac8d8..ea52f14e 100644
--- a/net/tools/quic/test_tools/mock_quic_server_session_visitor.cc
+++ b/net/tools/quic/test_tools/mock_quic_session_visitor.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
+#include "net/tools/quic/test_tools/mock_quic_session_visitor.h"
 
 namespace net {
 namespace test {
diff --git a/net/tools/quic/test_tools/mock_quic_server_session_visitor.h b/net/tools/quic/test_tools/mock_quic_session_visitor.h
similarity index 100%
rename from net/tools/quic/test_tools/mock_quic_server_session_visitor.h
rename to net/tools/quic/test_tools/mock_quic_session_visitor.h
diff --git a/remoting/client/ios/app_runtime.cc b/remoting/client/ios/app_runtime.cc
index f03b9067..5e0ad6b82 100644
--- a/remoting/client/ios/app_runtime.cc
+++ b/remoting/client/ios/app_runtime.cc
@@ -9,6 +9,7 @@
 #include "base/logging.h"
 #include "base/memory/ptr_util.h"
 #include "base/synchronization/waitable_event.h"
+#include "base/task_scheduler/task_scheduler.h"
 #include "jingle/glue/thread_wrapper.h"
 #include "net/socket/client_socket_factory.h"
 #include "remoting/base/chromium_url_request.h"
@@ -28,6 +29,17 @@
 namespace ios {
 
 AppRuntime::AppRuntime() {
+  // TODO(sergeyu): Consider adding separate pools for different task classes.
+  const int kMaxBackgroundThreads = 5;
+  if (TaskScheduler::GetInstance()) {
+    // Make sure TaskScheduler is initialized.
+    base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+  }
+
+  // TODO(sergeyu): AppRuntime is not singleton, but it owns MessageLoop for the
+  // current thread. This means that it's not safe to create multiple AppRuntime
+  // instances on the same thread. AppRuntime should be a singleton, or this
+  // code needs to be moved somewhere else.
   if (!base::MessageLoop::current()) {
     ui_loop_.reset(new base::MessageLoopForUI());
     base::MessageLoopForUI::current()->Attach();
diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc
index 1505e44..c581653 100644
--- a/remoting/client/jni/chromoting_jni_runtime.cc
+++ b/remoting/client/jni/chromoting_jni_runtime.cc
@@ -14,6 +14,7 @@
 #include "base/memory/singleton.h"
 #include "base/stl_util.h"
 #include "base/synchronization/waitable_event.h"
+#include "base/task_scheduler/task_scheduler.h"
 #include "jni/JniInterface_jni.h"
 #include "remoting/base/chromium_url_request.h"
 #include "remoting/base/url_request_context_getter.h"
@@ -42,6 +43,10 @@
 static void LoadNative(JNIEnv* env, const JavaParamRef<jclass>& clazz) {
   base::CommandLine::Init(0, nullptr);
 
+  // TODO(sergeyu): Consider adding separate pools for different task classes.
+  const int kMaxBackgroundThreads = 5;
+  base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+
   // Create the singleton now so that the Chromoting threads will be set up.
   remoting::ChromotingJniRuntime::GetInstance();
 }
diff --git a/remoting/host/it2me/it2me_native_messaging_host_main.cc b/remoting/host/it2me/it2me_native_messaging_host_main.cc
index 44d319e4..b6451df 100644
--- a/remoting/host/it2me/it2me_native_messaging_host_main.cc
+++ b/remoting/host/it2me/it2me_native_messaging_host_main.cc
@@ -11,6 +11,7 @@
 #include "base/i18n/icu_util.h"
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
+#include "base/task_scheduler/task_scheduler.h"
 #include "build/build_config.h"
 #include "remoting/base/auto_thread_task_runner.h"
 #include "remoting/base/breakpad.h"
@@ -45,7 +46,13 @@
 
 // Creates a It2MeNativeMessagingHost instance, attaches it to stdin/stdout and
 // runs the message loop until It2MeNativeMessagingHost signals shutdown.
-int StartIt2MeNativeMessagingHost() {
+int It2MeNativeMessagingHostMain(int argc, char** argv) {
+  // This object instance is required by Chrome code (such as MessageLoop).
+  base::AtExitManager exit_manager;
+
+  base::CommandLine::Init(argc, argv);
+  remoting::InitHostLogging();
+
 #if defined(OS_MACOSX)
   // Needed so we don't leak objects when threads are created.
   base::mac::ScopedNSAutoreleasePool pool;
@@ -72,6 +79,10 @@
   // Required to find the ICU data file, used by some file_util routines.
   base::i18n::InitializeICU();
 
+  // TODO(sergeyu): Consider adding separate pools for different task classes.
+  const int kMaxBackgroundThreads = 5;
+  base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+
   remoting::LoadResources("");
 
 #if defined(OS_LINUX)
@@ -192,14 +203,4 @@
   return kSuccessExitCode;
 }
 
-int It2MeNativeMessagingHostMain(int argc, char** argv) {
-  // This object instance is required by Chrome code (such as MessageLoop).
-  base::AtExitManager exit_manager;
-
-  base::CommandLine::Init(argc, argv);
-  remoting::InitHostLogging();
-
-  return StartIt2MeNativeMessagingHost();
-}
-
 }  // namespace remoting
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index aaae9db..73c87aa 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -26,6 +26,7 @@
 #include "base/strings/string_util.h"
 #include "base/strings/stringize_macros.h"
 #include "base/strings/utf_string_conversions.h"
+#include "base/task_scheduler/task_scheduler.h"
 #include "build/build_config.h"
 #include "components/policy/policy_constants.h"
 #include "ipc/ipc_channel.h"
@@ -1641,6 +1642,10 @@
   base::GetLinuxDistro();
 #endif
 
+  // TODO(sergeyu): Consider adding separate pools for different task classes.
+  const int kMaxBackgroundThreads = 5;
+  base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+
   // Create the main message loop and start helper threads.
   base::MessageLoopForUI message_loop;
   std::unique_ptr<ChromotingHostContext> context =
diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc
index b7a8140..d91e348 100644
--- a/remoting/host/setup/me2me_native_messaging_host_main.cc
+++ b/remoting/host/setup/me2me_native_messaging_host_main.cc
@@ -16,6 +16,7 @@
 #include "base/message_loop/message_loop.h"
 #include "base/run_loop.h"
 #include "base/strings/string_number_conversions.h"
+#include "base/task_scheduler/task_scheduler.h"
 #include "base/threading/thread.h"
 #include "build/build_config.h"
 #include "net/url_request/url_fetcher.h"
@@ -51,7 +52,13 @@
 
 namespace remoting {
 
-int StartMe2MeNativeMessagingHost() {
+int Me2MeNativeMessagingHostMain(int argc, char** argv) {
+  // This object instance is required by Chrome code (such as MessageLoop).
+  base::AtExitManager exit_manager;
+
+  base::CommandLine::Init(argc, argv);
+  remoting::InitHostLogging();
+
 #if defined(OS_MACOSX)
   // Needed so we don't leak objects when threads are created.
   base::mac::ScopedNSAutoreleasePool pool;
@@ -79,6 +86,10 @@
   // }
 #endif  // defined(REMOTING_ENABLE_BREAKPAD)
 
+  // TODO(sergeyu): Consider adding separate pools for different task classes.
+  const int kMaxBackgroundThreads = 5;
+  base::TaskScheduler::CreateAndSetSimpleTaskScheduler(kMaxBackgroundThreads);
+
   // Mac OS X requires that the main thread be a UI message loop in order to
   // receive distributed notifications from the System Preferences pane. An
   // IO thread is needed for the pairing registry and URL context getter.
@@ -261,14 +272,4 @@
   return kSuccessExitCode;
 }
 
-int Me2MeNativeMessagingHostMain(int argc, char** argv) {
-  // This object instance is required by Chrome code (such as MessageLoop).
-  base::AtExitManager exit_manager;
-
-  base::CommandLine::Init(argc, argv);
-  remoting::InitHostLogging();
-
-  return StartMe2MeNativeMessagingHost();
-}
-
 }  // namespace remoting
diff --git a/services/README.md b/services/README.md
index 810535bf..b8e1540 100644
--- a/services/README.md
+++ b/services/README.md
@@ -37,8 +37,10 @@
 for each service, products consuming these services may package them
 differently, e.g. by combining them into a single package.
 
-### High-level Design Doc
-https://docs.google.com/document/d/15I7sQyQo6zsqXVNAlVd520tdGaS8FCicZHrN0yRu-oU/edit#heading=h.p37l9e7o0io5
+### Documentation
+
+[High-level Design Doc](https://docs.google.com/document/d/15I7sQyQo6zsqXVNAlVd520tdGaS8FCicZHrN0yRu-oU)
+[Homepage](https://sites.google.com/a/chromium.org/dev/servicification)
 
 ### Relationship to other top-level directories in //
 
@@ -51,3 +53,8 @@
 Think of //components as sort of like a //lib. Individual //components can
 define, implement and use mojom interfaces, but only //services have unique
 identities with the Service Manager.
+
+### Adding a new service
+
+Please start a thread on [services-dev](https://groups.google.com/a/chromium.org/forum/#!forum/services-dev)
+
diff --git a/services/navigation/view_impl.cc b/services/navigation/view_impl.cc
index 578cb90..655ccaa 100644
--- a/services/navigation/view_impl.cc
+++ b/services/navigation/view_impl.cc
@@ -300,11 +300,6 @@
 void ViewImpl::OnPointerEventObserved(const ui::PointerEvent& event,
                                       aura::Window* target) {}
 
-aura::client::CaptureClient* ViewImpl::GetCaptureClient() {
-  // TODO: wire this up. This typically comes from WMState.
-  return nullptr;
-}
-
 aura::PropertyConverter* ViewImpl::GetPropertyConverter() {
   // TODO: wire this up.
   return nullptr;
diff --git a/services/navigation/view_impl.h b/services/navigation/view_impl.h
index 233c9e3..bf34ffc 100644
--- a/services/navigation/view_impl.h
+++ b/services/navigation/view_impl.h
@@ -85,7 +85,6 @@
   void OnLostConnection(aura::WindowTreeClient* client) override;
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override;
-  aura::client::CaptureClient* GetCaptureClient() override;
   aura::PropertyConverter* GetPropertyConverter() override;
 
   // views::WidgetDelegate:
diff --git a/services/ui/demo/mus_demo.cc b/services/ui/demo/mus_demo.cc
index 0ae145c..0fbcd356 100644
--- a/services/ui/demo/mus_demo.cc
+++ b/services/ui/demo/mus_demo.cc
@@ -118,10 +118,6 @@
 void MusDemo::OnPointerEventObserved(const PointerEvent& event,
                                      aura::Window* target) {}
 
-aura::client::CaptureClient* MusDemo::GetCaptureClient() {
-  return capture_client_.get();
-}
-
 aura::PropertyConverter* MusDemo::GetPropertyConverter() {
   return property_converter_.get();
 }
diff --git a/services/ui/demo/mus_demo.h b/services/ui/demo/mus_demo.h
index f78e948..c4e490b 100644
--- a/services/ui/demo/mus_demo.h
+++ b/services/ui/demo/mus_demo.h
@@ -64,7 +64,6 @@
   void OnLostConnection(aura::WindowTreeClient* client) override;
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override;
-  aura::client::CaptureClient* GetCaptureClient() override;
   aura::PropertyConverter* GetPropertyConverter() override;
 
   // aura::WindowManagerDelegate:
diff --git a/services/ui/public/interfaces/window_tree.mojom b/services/ui/public/interfaces/window_tree.mojom
index d2343db..e606490 100644
--- a/services/ui/public/interfaces/window_tree.mojom
+++ b/services/ui/public/interfaces/window_tree.mojom
@@ -253,9 +253,8 @@
   // Otherwise the existing state is used.
   SetImeVisibility(uint32 window_id, bool visible, mojo.TextInputState? state);
 
-  // Set whether the specified window can accept events. If a window does not
-  // accept events, none of its descendant windows accept events either.
-  SetCanAcceptEvents(uint32 window_id, bool accept_events);
+  // Sets the EventTargetingPolicy. See EventTargetingPolicy for details.
+  SetEventTargetingPolicy(uint32 window_id, EventTargetingPolicy policy);
 
   // See documentation for WindowTreeClient::OnWindowInputEvent().
   OnWindowInputEventAck(uint32 event_id, EventResult result);
diff --git a/services/ui/public/interfaces/window_tree_constants.mojom b/services/ui/public/interfaces/window_tree_constants.mojom
index c23d42d..19a5fdf 100644
--- a/services/ui/public/interfaces/window_tree_constants.mojom
+++ b/services/ui/public/interfaces/window_tree_constants.mojom
@@ -35,6 +35,21 @@
   UNHANDLED,
 };
 
+enum EventTargetingPolicy {
+  // The target is a valid target for events, but none of its descendants are
+  // considered.
+  TARGET_ONLY,
+
+  // The target and its descendants are possible targets. This is the default.
+  TARGET_AND_DESCENDANTS,
+
+  // The target is not a valid target, but its descendants are possible targets.
+  DESCENDANTS_ONLY,
+
+  // Neither the target nor its descendants are valid targets.
+  NONE
+};
+
 // A bitfield of what drag operations are possible.
 const uint32 kDropEffectNone = 0;
 const uint32 kDropEffectMove = 1;
diff --git a/services/ui/service.cc b/services/ui/service.cc
index 2e789c89..95d1791 100644
--- a/services/ui/service.cc
+++ b/services/ui/service.cc
@@ -188,7 +188,6 @@
   // so keep this line below both of those.
   input_device_server_.RegisterAsObserver();
 
-  // Gpu must be running before the ScreenManager can be initialized.
   window_server_.reset(new ws::WindowServer(this));
 
   ime_server_.Init(context()->connector(), test_config_);
diff --git a/services/ui/test_wm/test_wm.cc b/services/ui/test_wm/test_wm.cc
index 743db072..8d2463a 100644
--- a/services/ui/test_wm/test_wm.cc
+++ b/services/ui/test_wm/test_wm.cc
@@ -87,9 +87,6 @@
                               aura::Window* target) override {
     // Don't care.
   }
-  aura::client::CaptureClient* GetCaptureClient() override {
-    return wm_state_.capture_controller();
-  }
   aura::PropertyConverter* GetPropertyConverter() override {
     return &property_converter_;
   }
diff --git a/services/ui/ws/access_policy.h b/services/ui/ws/access_policy.h
index fa5b236..c29e3988 100644
--- a/services/ui/ws/access_policy.h
+++ b/services/ui/ws/access_policy.h
@@ -59,7 +59,7 @@
   virtual bool CanSetClientArea(const ServerWindow* window) const = 0;
   virtual bool CanSetHitTestMask(const ServerWindow* window) const = 0;
   virtual bool CanSetAcceptDrops(const ServerWindow* window) const = 0;
-  virtual bool CanSetAcceptEvents(const ServerWindow* window) const = 0;
+  virtual bool CanSetEventTargetingPolicy(const ServerWindow* window) const = 0;
   virtual bool CanStackAbove(const ServerWindow* above,
                              const ServerWindow* below) const = 0;
   virtual bool CanStackAtTop(const ServerWindow* window) const = 0;
diff --git a/services/ui/ws/default_access_policy.cc b/services/ui/ws/default_access_policy.cc
index 689108d..b9c8658 100644
--- a/services/ui/ws/default_access_policy.cc
+++ b/services/ui/ws/default_access_policy.cc
@@ -151,7 +151,8 @@
          delegate_->HasRootForAccessPolicy(window);
 }
 
-bool DefaultAccessPolicy::CanSetAcceptEvents(const ServerWindow* window) const {
+bool DefaultAccessPolicy::CanSetEventTargetingPolicy(
+    const ServerWindow* window) const {
   return WasCreatedByThisClient(window) ||
          delegate_->HasRootForAccessPolicy(window);
 }
diff --git a/services/ui/ws/default_access_policy.h b/services/ui/ws/default_access_policy.h
index 92f13765f..74cbde7 100644
--- a/services/ui/ws/default_access_policy.h
+++ b/services/ui/ws/default_access_policy.h
@@ -52,7 +52,7 @@
   bool CanSetClientArea(const ServerWindow* window) const override;
   bool CanSetHitTestMask(const ServerWindow* window) const override;
   bool CanSetAcceptDrops(const ServerWindow* window) const override;
-  bool CanSetAcceptEvents(const ServerWindow* window) const override;
+  bool CanSetEventTargetingPolicy(const ServerWindow* window) const override;
   bool CanStackAbove(const ServerWindow* above,
                      const ServerWindow* below) const override;
   bool CanStackAtTop(const ServerWindow* window) const override;
diff --git a/services/ui/ws/display.cc b/services/ui/ws/display.cc
index e93c880..68e8657 100644
--- a/services/ui/ws/display.cc
+++ b/services/ui/ws/display.cc
@@ -256,6 +256,8 @@
   root_.reset(window_server_->CreateServerWindow(
       display_manager()->GetAndAdvanceNextRootId(),
       ServerWindow::Properties()));
+  root_->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   root_->SetBounds(gfx::Rect(size));
   root_->SetVisible(true);
   focus_controller_ = base::MakeUnique<FocusController>(this, root_.get());
diff --git a/services/ui/ws/event_dispatcher.cc b/services/ui/ws/event_dispatcher.cc
index 80a0ed6..f045ac6 100644
--- a/services/ui/ws/event_dispatcher.cc
+++ b/services/ui/ws/event_dispatcher.cc
@@ -86,19 +86,16 @@
   delegate_->OnMouseCursorLocationChanged(screen_location);
 }
 
-bool EventDispatcher::GetCurrentMouseCursor(ui::mojom::Cursor* cursor_out) {
-  if (drag_controller_) {
-    *cursor_out = drag_controller_->current_cursor();
-    return true;
-  }
+ui::mojom::Cursor EventDispatcher::GetCurrentMouseCursor() const {
+  if (drag_controller_)
+    return drag_controller_->current_cursor();
 
   if (!mouse_cursor_source_window_)
-    return false;
+    return ui::mojom::Cursor::POINTER;
 
-  *cursor_out = mouse_cursor_in_non_client_area_
-                    ? mouse_cursor_source_window_->non_client_cursor()
-                    : mouse_cursor_source_window_->cursor();
-  return true;
+  return mouse_cursor_in_non_client_area_
+             ? mouse_cursor_source_window_->non_client_cursor()
+             : mouse_cursor_source_window_->cursor();
 }
 
 bool EventDispatcher::SetCaptureWindow(ServerWindow* window,
diff --git a/services/ui/ws/event_dispatcher.h b/services/ui/ws/event_dispatcher.h
index 6e146ab..cd05854c 100644
--- a/services/ui/ws/event_dispatcher.h
+++ b/services/ui/ws/event_dispatcher.h
@@ -63,9 +63,9 @@
     return mouse_pointer_last_location_;
   }
 
-  // If we still have the window of the last mouse move, returns true and sets
-  // the current cursor to use to |cursor_out|.
-  bool GetCurrentMouseCursor(ui::mojom::Cursor* cursor_out);
+  // Returns the cursor for the current target, or POINTER if the mouse is not
+  // over a valid target.
+  ui::mojom::Cursor GetCurrentMouseCursor() const;
 
   // |capture_window_| will receive all input. See window_tree.mojom for
   // details.
diff --git a/services/ui/ws/event_dispatcher_unittest.cc b/services/ui/ws/event_dispatcher_unittest.cc
index 5e059270..fee43f4b 100644
--- a/services/ui/ws/event_dispatcher_unittest.cc
+++ b/services/ui/ws/event_dispatcher_unittest.cc
@@ -286,7 +286,6 @@
       new ServerWindow(window_delegate_.get(), id));
   parent->Add(child.get());
   child->SetVisible(true);
-  EnableHitTest(child.get());
   return child;
 }
 
@@ -323,7 +322,6 @@
   window_delegate_ = base::MakeUnique<TestServerWindowDelegate>();
   root_window_ =
       base::MakeUnique<ServerWindow>(window_delegate_.get(), WindowId(1, 2));
-  EnableHitTest(root_window_.get());
   window_delegate_->set_root_window(root_window_.get());
   root_window_->SetVisible(true);
 
@@ -1663,11 +1661,11 @@
 
 TEST_F(EventDispatcherTest, CaptureNotResetOnParentChange) {
   std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
-  DisableHitTest(w1.get());
+  w1->set_event_targeting_policy(mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   std::unique_ptr<ServerWindow> w11 =
       CreateChildWindowWithParent(WindowId(1, 4), w1.get());
   std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
-  DisableHitTest(w2.get());
+  w2->set_event_targeting_policy(mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
 
   root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
   w1->SetBounds(gfx::Rect(0, 0, 100, 100));
@@ -1713,7 +1711,8 @@
 
 TEST_F(EventDispatcherTest, MoveMouseFromNoTargetToValidTarget) {
   ServerWindow* root = root_window();
-  DisableHitTest(root);
+  root->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
 
   root->SetBounds(gfx::Rect(0, 0, 100, 100));
@@ -1738,7 +1737,8 @@
 
 TEST_F(EventDispatcherTest, NoTargetToTargetWithMouseDown) {
   ServerWindow* root = root_window();
-  DisableHitTest(root);
+  root->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
 
   root->SetBounds(gfx::Rect(0, 0, 100, 100));
@@ -1770,7 +1770,8 @@
 
 TEST_F(EventDispatcherTest, DontSendExitToSameClientWhenCaptureChanges) {
   ServerWindow* root = root_window();
-  DisableHitTest(root);
+  root->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   std::unique_ptr<ServerWindow> c1 = CreateChildWindow(WindowId(1, 3));
   std::unique_ptr<ServerWindow> c2 = CreateChildWindow(WindowId(1, 4));
 
diff --git a/services/ui/ws/server_window.cc b/services/ui/ws/server_window.cc
index ea3cbfc6..d52bf66e 100644
--- a/services/ui/ws/server_window.cc
+++ b/services/ui/ws/server_window.cc
@@ -35,7 +35,6 @@
       non_client_cursor_id_(mojom::Cursor::CURSOR_NULL),
       opacity_(1),
       can_focus_(true),
-      can_accept_events_(true),
       properties_(properties),
       // Don't notify newly added observers during notification. This causes
       // problems for code that adds an observer as part of an observer
diff --git a/services/ui/ws/server_window.h b/services/ui/ws/server_window.h
index 6ae3f21..cdd5034 100644
--- a/services/ui/ws/server_window.h
+++ b/services/ui/ws/server_window.h
@@ -164,8 +164,12 @@
   void set_can_focus(bool can_focus) { can_focus_ = can_focus; }
   bool can_focus() const { return can_focus_; }
 
-  void set_can_accept_events(bool value) { can_accept_events_ = value; }
-  bool can_accept_events() const { return can_accept_events_; }
+  void set_event_targeting_policy(mojom::EventTargetingPolicy policy) {
+    event_targeting_policy_ = policy;
+  }
+  mojom::EventTargetingPolicy event_targeting_policy() const {
+    return event_targeting_policy_;
+  }
 
   // Returns true if this window is attached to a root and all ancestors are
   // visible.
@@ -245,7 +249,8 @@
   mojom::Cursor non_client_cursor_id_;
   float opacity_;
   bool can_focus_;
-  bool can_accept_events_;
+  mojom::EventTargetingPolicy event_targeting_policy_ =
+      mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS;
   gfx::Transform transform_;
   ui::TextInputState text_input_state_;
 
diff --git a/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.cc b/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.cc
index 70bfe18..acb08193 100644
--- a/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.cc
+++ b/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.cc
@@ -27,17 +27,5 @@
   manager_->frame_sink_data_.reset();
 }
 
-void EnableHitTest(ServerWindow* window) {
-  ServerWindowCompositorFrameSinkManagerTestApi test_api(
-      window->GetOrCreateCompositorFrameSinkManager());
-  test_api.CreateEmptyDefaultCompositorFrameSink();
-}
-
-void DisableHitTest(ServerWindow* window) {
-  ServerWindowCompositorFrameSinkManagerTestApi test_api(
-      window->GetOrCreateCompositorFrameSinkManager());
-  test_api.DestroyDefaultCompositorFrameSink();
-}
-
 }  // namespace ws
 }  // namespace ui
diff --git a/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.h b/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.h
index 7b0271f..c70319415 100644
--- a/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.h
+++ b/services/ui/ws/server_window_compositor_frame_sink_manager_test_api.h
@@ -11,8 +11,6 @@
 namespace ui {
 namespace ws {
 
-class ServerWindow;
-
 // Use to poke at the internals of ServerWindowCompositorFrameSinkManager.
 class ServerWindowCompositorFrameSinkManagerTestApi {
  public:
@@ -29,10 +27,6 @@
   DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManagerTestApi);
 };
 
-// Use to make |window| a target for events.
-void EnableHitTest(ServerWindow* window);
-void DisableHitTest(ServerWindow* window);
-
 }  // namespace ws
 }  // namespace ui
 
diff --git a/services/ui/ws/test_utils.cc b/services/ui/ws/test_utils.cc
index 5d87a75..acfbae9 100644
--- a/services/ui/ws/test_utils.cc
+++ b/services/ui/ws/test_utils.cc
@@ -525,6 +525,8 @@
   const uint32_t embed_flags = 0;
   wm_tree->Embed(embed_window_id, std::move(client), embed_flags);
   ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id);
+  embed_window->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
   EXPECT_NE(nullptr, tree1);
   EXPECT_NE(tree1, wm_tree);
@@ -554,7 +556,6 @@
 
   child1->SetVisible(true);
   child1->SetBounds(window_bounds);
-  EnableHitTest(child1);
 
   TestWindowTreeClient* embed_client =
       ws_test_helper_.window_server_delegate()->last_client();
diff --git a/services/ui/ws/test_utils.h b/services/ui/ws/test_utils.h
index 9469b95..b928869ed 100644
--- a/services/ui/ws/test_utils.h
+++ b/services/ui/ws/test_utils.h
@@ -106,8 +106,9 @@
   void set_window_manager_internal(mojom::WindowManager* wm_internal) {
     tree_->window_manager_internal_ = wm_internal;
   }
-  void SetCanAcceptEvents(Id transport_window_id, bool can_accept_events) {
-    tree_->SetCanAcceptEvents(transport_window_id, can_accept_events);
+  void SetEventTargetingPolicy(Id transport_window_id,
+                               mojom::EventTargetingPolicy policy) {
+    tree_->SetEventTargetingPolicy(transport_window_id, policy);
   }
   void AckOldestEvent(
       mojom::EventResult result = mojom::EventResult::UNHANDLED) {
@@ -139,6 +140,8 @@
 
   void OnEvent(const ui::Event& event) { display_->OnEvent(event); }
 
+  mojom::Cursor last_cursor() const { return display_->last_cursor_; }
+
  private:
   Display* display_;
 
diff --git a/services/ui/ws/window_finder.cc b/services/ui/ws/window_finder.cc
index c687378d..4a75999a 100644
--- a/services/ui/ws/window_finder.cc
+++ b/services/ui/ws/window_finder.cc
@@ -6,7 +6,6 @@
 
 #include "base/containers/adapters.h"
 #include "services/ui/ws/server_window.h"
-#include "services/ui/ws/server_window_compositor_frame_sink_manager.h"
 #include "services/ui/ws/server_window_delegate.h"
 #include "services/ui/ws/window_coordinate_conversions.h"
 #include "ui/gfx/geometry/point.h"
@@ -17,19 +16,9 @@
 namespace ws {
 namespace {
 
-bool IsValidWindowForEvents(ServerWindow* window) {
-  ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager =
-      window->compositor_frame_sink_manager();
-  // Valid windows have at least one of the two surface types. Only an underlay
-  // is valid as we assume the window manager will likely get the event in this
-  // case.
-  return compositor_frame_sink_manager &&
-         compositor_frame_sink_manager->HasCompositorFrameSink();
-}
-
 bool IsLocationInNonclientArea(const ServerWindow* target,
                                const gfx::Point& location) {
-  if (!target->parent())
+  if (!target->parent() || target->bounds().size().IsEmpty())
     return false;
 
   gfx::Rect client_area(target->bounds().size());
@@ -48,47 +37,54 @@
 bool FindDeepestVisibleWindowForEventsImpl(ServerWindow* window,
                                            const gfx::Point& location,
                                            DeepestWindow* deepest_window) {
-  if (!window->can_accept_events()) {
-    if (!IsLocationInNonclientArea(window, location) ||
-        !IsValidWindowForEvents(window)) {
-      return false;
-    }
+  // The non-client area takes precedence over descendants, as otherwise the
+  // user would likely not be able to hit the non-client area as it's common
+  // for descendants to go into the non-client area.
+  if (IsLocationInNonclientArea(window, location)) {
     deepest_window->window = window;
     deepest_window->in_non_client_area = true;
     return true;
   }
+  const mojom::EventTargetingPolicy event_targeting_policy =
+      window->event_targeting_policy();
 
-  const ServerWindow::Windows& children = window->children();
-  for (ServerWindow* child : base::Reversed(children)) {
-    if (!child->visible())
-      continue;
+  if (event_targeting_policy == ui::mojom::EventTargetingPolicy::NONE)
+    return false;
 
-    // TODO(sky): support transform.
-    gfx::Point location_in_child(location.x() - child->bounds().x(),
-                                 location.y() - child->bounds().y());
-    gfx::Rect child_bounds(child->bounds().size());
-    child_bounds.Inset(-child->extended_hit_test_region().left(),
-                       -child->extended_hit_test_region().top(),
-                       -child->extended_hit_test_region().right(),
-                       -child->extended_hit_test_region().bottom());
-    if (!child_bounds.Contains(location_in_child) ||
-        (child->hit_test_mask() &&
-         !child->hit_test_mask()->Contains(location_in_child))) {
-      continue;
-    }
+  if (event_targeting_policy ==
+          mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS ||
+      event_targeting_policy == mojom::EventTargetingPolicy::DESCENDANTS_ONLY) {
+    const ServerWindow::Windows& children = window->children();
+    for (ServerWindow* child : base::Reversed(children)) {
+      if (!child->visible())
+        continue;
 
-    if (FindDeepestVisibleWindowForEventsImpl(child, location_in_child,
-                                              deepest_window)) {
-      return true;
+      // TODO(sky): support transform.
+      gfx::Point location_in_child(location.x() - child->bounds().x(),
+                                   location.y() - child->bounds().y());
+      gfx::Rect child_bounds(child->bounds().size());
+      child_bounds.Inset(-child->extended_hit_test_region().left(),
+                         -child->extended_hit_test_region().top(),
+                         -child->extended_hit_test_region().right(),
+                         -child->extended_hit_test_region().bottom());
+      if (!child_bounds.Contains(location_in_child) ||
+          (child->hit_test_mask() &&
+           !child->hit_test_mask()->Contains(location_in_child))) {
+        continue;
+      }
+
+      if (FindDeepestVisibleWindowForEventsImpl(child, location_in_child,
+                                                deepest_window)) {
+        return true;
+      }
     }
   }
 
-  if (!IsValidWindowForEvents(window))
+  if (event_targeting_policy == mojom::EventTargetingPolicy::DESCENDANTS_ONLY)
     return false;
 
   deepest_window->window = window;
-  deepest_window->in_non_client_area =
-      IsLocationInNonclientArea(window, location);
+  deepest_window->in_non_client_area = false;
   return true;
 }
 
diff --git a/services/ui/ws/window_finder_unittest.cc b/services/ui/ws/window_finder_unittest.cc
index 71b6c94..1663033 100644
--- a/services/ui/ws/window_finder_unittest.cc
+++ b/services/ui/ws/window_finder_unittest.cc
@@ -17,19 +17,19 @@
 TEST(WindowFinderTest, FindDeepestVisibleWindow) {
   TestServerWindowDelegate window_delegate;
   ServerWindow root(&window_delegate, WindowId(1, 2));
+  root.set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   window_delegate.set_root_window(&root);
   root.SetVisible(true);
   root.SetBounds(gfx::Rect(0, 0, 100, 100));
 
   ServerWindow child1(&window_delegate, WindowId(1, 3));
   root.Add(&child1);
-  EnableHitTest(&child1);
   child1.SetVisible(true);
   child1.SetBounds(gfx::Rect(10, 10, 20, 20));
 
   ServerWindow child2(&window_delegate, WindowId(1, 4));
   root.Add(&child2);
-  EnableHitTest(&child2);
   child2.SetVisible(true);
   child2.SetBounds(gfx::Rect(15, 15, 20, 20));
 
@@ -41,7 +41,7 @@
       &child1,
       FindDeepestVisibleWindowForEvents(&root, gfx::Point(13, 14)).window);
 
-  child1.set_can_accept_events(false);
+  child1.set_event_targeting_policy(mojom::EventTargetingPolicy::NONE);
   EXPECT_EQ(
       nullptr,
       FindDeepestVisibleWindowForEvents(&root, gfx::Point(13, 14)).window);
@@ -55,14 +55,12 @@
 TEST(WindowFinderTest, FindDeepestVisibleWindowNonClientArea) {
   TestServerWindowDelegate window_delegate;
   ServerWindow root(&window_delegate, WindowId(1, 2));
-  EnableHitTest(&root);
   window_delegate.set_root_window(&root);
   root.SetVisible(true);
   root.SetBounds(gfx::Rect(0, 0, 100, 100));
 
   ServerWindow child1(&window_delegate, WindowId(1, 3));
   root.Add(&child1);
-  EnableHitTest(&child1);
   child1.SetVisible(true);
   child1.SetBounds(gfx::Rect(10, 10, 20, 20));
 
@@ -86,15 +84,15 @@
   EXPECT_EQ(&child1, result.window);
   EXPECT_FALSE(result.in_non_client_area);
 
-  // set_can_accept_events(false) should not impact the result for the
+  // EventTargetingPolicy::NONE should not impact the result for the
   // non-client area.
-  child1.set_can_accept_events(false);
+  child1.set_event_targeting_policy(mojom::EventTargetingPolicy::NONE);
   result = FindDeepestVisibleWindowForEvents(&root, gfx::Point(11, 11));
   child1.SetClientArea(gfx::Insets(2, 3, 4, 5), std::vector<gfx::Rect>());
   EXPECT_EQ(&child1, result.window);
   EXPECT_TRUE(result.in_non_client_area);
 
-  // set_can_accept_events(false) means the client area won't be matched though.
+  // EventTargetingPolicy::NONE means the client area won't be matched though.
   result = FindDeepestVisibleWindowForEvents(&root, gfx::Point(15, 15));
   EXPECT_EQ(&root, result.window);
   EXPECT_FALSE(result.in_non_client_area);
@@ -104,13 +102,11 @@
   TestServerWindowDelegate window_delegate;
   ServerWindow root(&window_delegate, WindowId(1, 2));
   window_delegate.set_root_window(&root);
-  EnableHitTest(&root);
   root.SetVisible(true);
   root.SetBounds(gfx::Rect(0, 0, 100, 100));
 
   ServerWindow child_with_mask(&window_delegate, WindowId(1, 4));
   root.Add(&child_with_mask);
-  EnableHitTest(&child_with_mask);
   child_with_mask.SetVisible(true);
   child_with_mask.SetBounds(gfx::Rect(10, 10, 20, 20));
   child_with_mask.SetHitTestMask(gfx::Rect(2, 2, 16, 16));
@@ -137,12 +133,12 @@
   // not a valid event target.
   ServerWindow child1(&window_delegate, WindowId(1, 3));
   root.Add(&child1);
-  EnableHitTest(&child1);
   child1.SetVisible(true);
   child1.SetBounds(gfx::Rect(10, 10, 20, 20));
 
   ServerWindow child2(&window_delegate, WindowId(1, 4));
   root.Add(&child2);
+  child2.set_event_targeting_policy(mojom::EventTargetingPolicy::NONE);
   child2.SetVisible(true);
   child2.SetBounds(gfx::Rect(15, 15, 20, 20));
 
@@ -153,5 +149,31 @@
       FindDeepestVisibleWindowForEvents(&root, gfx::Point(16, 16)).window);
 }
 
+TEST(WindowFinderTest, NonClientPreferredOverChild) {
+  TestServerWindowDelegate window_delegate;
+  ServerWindow root(&window_delegate, WindowId(1, 2));
+  window_delegate.set_root_window(&root);
+  root.SetVisible(true);
+  root.SetBounds(gfx::Rect(0, 0, 100, 100));
+
+  // Create two windows, |child| and |child_child|; |child| is a child of the
+  // root and |child_child| and child of |child|. All share the same size with
+  // |child| having a non-client area.
+  ServerWindow child(&window_delegate, WindowId(1, 3));
+  root.Add(&child);
+  child.SetVisible(true);
+  child.SetBounds(gfx::Rect(0, 0, 100, 100));
+  child.SetClientArea(gfx::Insets(2, 3, 4, 5), std::vector<gfx::Rect>());
+
+  ServerWindow child_child(&window_delegate, WindowId(1, 4));
+  child.Add(&child_child);
+  child_child.SetVisible(true);
+  child_child.SetBounds(gfx::Rect(0, 0, 100, 100));
+
+  // |child| was should be returned as the event is over the non-client area.
+  EXPECT_EQ(&child,
+            FindDeepestVisibleWindowForEvents(&root, gfx::Point(1, 1)).window);
+}
+
 }  // namespace ws
 }  // namespace ui
diff --git a/services/ui/ws/window_manager_access_policy.cc b/services/ui/ws/window_manager_access_policy.cc
index 451fd98..32d9cae1 100644
--- a/services/ui/ws/window_manager_access_policy.cc
+++ b/services/ui/ws/window_manager_access_policy.cc
@@ -136,7 +136,7 @@
   return true;
 }
 
-bool WindowManagerAccessPolicy::CanSetAcceptEvents(
+bool WindowManagerAccessPolicy::CanSetEventTargetingPolicy(
     const ServerWindow* window) const {
   return WasCreatedByThisClient(window) ||
          delegate_->HasRootForAccessPolicy(window);
diff --git a/services/ui/ws/window_manager_access_policy.h b/services/ui/ws/window_manager_access_policy.h
index f15b36a5..1eebe33 100644
--- a/services/ui/ws/window_manager_access_policy.h
+++ b/services/ui/ws/window_manager_access_policy.h
@@ -51,7 +51,7 @@
   bool CanSetClientArea(const ServerWindow* window) const override;
   bool CanSetHitTestMask(const ServerWindow* window) const override;
   bool CanSetAcceptDrops(const ServerWindow* window) const override;
-  bool CanSetAcceptEvents(const ServerWindow* window) const override;
+  bool CanSetEventTargetingPolicy(const ServerWindow* window) const override;
   bool CanStackAbove(const ServerWindow* above,
                      const ServerWindow* below) const override;
   bool CanStackAtTop(const ServerWindow* window) const override;
diff --git a/services/ui/ws/window_manager_display_root.cc b/services/ui/ws/window_manager_display_root.cc
index f8ff144..03c69f8 100644
--- a/services/ui/ws/window_manager_display_root.cc
+++ b/services/ui/ws/window_manager_display_root.cc
@@ -16,6 +16,8 @@
   root_.reset(window_server()->CreateServerWindow(
       window_server()->display_manager()->GetAndAdvanceNextRootId(),
       ServerWindow::Properties()));
+  root_->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::DESCENDANTS_ONLY);
   // Our root is always a child of the Display's root. Do this
   // before the WindowTree has been created so that the client doesn't get
   // notified of the add, bounds change and visibility change.
diff --git a/services/ui/ws/window_manager_state.cc b/services/ui/ws/window_manager_state.cc
index ef09226..028e06c 100644
--- a/services/ui/ws/window_manager_state.cc
+++ b/services/ui/ws/window_manager_state.cc
@@ -528,11 +528,9 @@
 }
 
 void WindowManagerState::UpdateNativeCursorFromDispatcher() {
-  ui::mojom::Cursor cursor_id = mojom::Cursor::CURSOR_NULL;
-  if (event_dispatcher_.GetCurrentMouseCursor(&cursor_id)) {
-    for (Display* display : display_manager()->displays())
-      display->UpdateNativeCursor(cursor_id);
-  }
+  const ui::mojom::Cursor cursor_id = event_dispatcher_.GetCurrentMouseCursor();
+  for (Display* display : display_manager()->displays())
+    display->UpdateNativeCursor(cursor_id);
 }
 
 void WindowManagerState::OnCaptureChanged(ServerWindow* new_capture,
@@ -627,6 +625,8 @@
 void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) {
   window_server()->SendToPointerWatchers(event, user_id(), nullptr, /* window */
                                          nullptr /* ignore_tree */);
+  if (event.IsMousePointerEvent())
+    UpdateNativeCursorFromDispatcher();
 }
 
 void WindowManagerState::OnWindowEmbeddedAppDisconnected(ServerWindow* window) {
diff --git a/services/ui/ws/window_manager_state_unittest.cc b/services/ui/ws/window_manager_state_unittest.cc
index 6a03c5d..1de0f60 100644
--- a/services/ui/ws/window_manager_state_unittest.cc
+++ b/services/ui/ws/window_manager_state_unittest.cc
@@ -72,6 +72,9 @@
     return window_event_targeting_helper_.last_binding()->tree();
   }
   WindowManagerState* window_manager_state() { return window_manager_state_; }
+  WindowServer* window_server() {
+    return window_event_targeting_helper_.window_server();
+  }
 
   void EmbedAt(WindowTree* tree,
                const ClientWindowId& embed_window_id,
@@ -567,6 +570,25 @@
   window_server->DestroyTree(tree);
 }
 
+TEST_F(WindowManagerStateTest, CursorResetOverNoTarget) {
+  TestChangeTracker* tracker = window_tree_client()->tracker();
+  ASSERT_EQ(1u, window_server()->display_manager()->displays().size());
+  Display* display = *(window_server()->display_manager()->displays().begin());
+  DisplayTestApi display_test_api(display);
+  // This test assumes the default is not a pointer, otherwise it can't detect
+  // the change.
+  EXPECT_NE(ui::mojom::Cursor::POINTER, display_test_api.last_cursor());
+  ui::PointerEvent move(
+      ui::ET_POINTER_MOVED, gfx::Point(), gfx::Point(), 0, 0, 0,
+      ui::PointerDetails(EventPointerType::POINTER_TYPE_MOUSE),
+      base::TimeTicks());
+  window_manager_state()->ProcessEvent(move);
+  // The event isn't over a valid target, which should trigger resetting the
+  // cursor to POINTER.
+  EXPECT_EQ(ui::mojom::Cursor::POINTER, display_test_api.last_cursor());
+  EXPECT_TRUE(tracker->changes()->empty());
+}
+
 }  // namespace test
 }  // namespace ws
 }  // namespace ui
diff --git a/services/ui/ws/window_server.cc b/services/ui/ws/window_server.cc
index c4758a5..4a2cb7d6 100644
--- a/services/ui/ws/window_server.cc
+++ b/services/ui/ws/window_server.cc
@@ -583,9 +583,8 @@
     EventDispatcher* event_dispatcher =
         display_root->window_manager_state()->event_dispatcher();
     event_dispatcher->UpdateCursorProviderByLastKnownLocation();
-    mojom::Cursor cursor_id = mojom::Cursor::CURSOR_NULL;
-    if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
-      display_root->display()->UpdateNativeCursor(cursor_id);
+    display_root->display()->UpdateNativeCursor(
+        event_dispatcher->GetCurrentMouseCursor());
   }
 }
 
@@ -601,9 +600,8 @@
     return;
 
   event_dispatcher->UpdateNonClientAreaForCurrentWindow();
-  mojom::Cursor cursor_id = mojom::Cursor::CURSOR_NULL;
-  if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
-    display_root->display()->UpdateNativeCursor(cursor_id);
+  display_root->display()->UpdateNativeCursor(
+      event_dispatcher->GetCurrentMouseCursor());
 }
 
 bool WindowServer::IsUserInHighContrastMode(const UserId& user) const {
diff --git a/services/ui/ws/window_server_test_base.cc b/services/ui/ws/window_server_test_base.cc
index c6d4ee1bf..492bad0 100644
--- a/services/ui/ws/window_server_test_base.cc
+++ b/services/ui/ws/window_server_test_base.cc
@@ -143,10 +143,6 @@
 void WindowServerTestBase::OnPointerEventObserved(const ui::PointerEvent& event,
                                                   aura::Window* target) {}
 
-aura::client::CaptureClient* WindowServerTestBase::GetCaptureClient() {
-  return wm_state_.capture_controller();
-}
-
 aura::PropertyConverter* WindowServerTestBase::GetPropertyConverter() {
   return &property_converter_;
 }
diff --git a/services/ui/ws/window_server_test_base.h b/services/ui/ws/window_server_test_base.h
index e4a6e65..c983761 100644
--- a/services/ui/ws/window_server_test_base.h
+++ b/services/ui/ws/window_server_test_base.h
@@ -84,7 +84,6 @@
   void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override;
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override;
-  aura::client::CaptureClient* GetCaptureClient() override;
   aura::PropertyConverter* GetPropertyConverter() override;
 
   // WindowManagerDelegate:
diff --git a/services/ui/ws/window_tree.cc b/services/ui/ws/window_tree.cc
index 55838d3..5322466 100644
--- a/services/ui/ws/window_tree.cc
+++ b/services/ui/ws/window_tree.cc
@@ -1564,13 +1564,13 @@
   }
 }
 
-void WindowTree::SetCanAcceptEvents(Id transport_window_id,
-                                    bool can_accept_events) {
+void WindowTree::SetEventTargetingPolicy(Id transport_window_id,
+                                         mojom::EventTargetingPolicy policy) {
   ServerWindow* window =
       GetWindowByClientId(ClientWindowId(transport_window_id));
   // TODO(riajiang): check |event_queue_| is empty for |window|.
-  if (window && access_policy_->CanSetAcceptEvents(window))
-    window->set_can_accept_events(can_accept_events);
+  if (window && access_policy_->CanSetEventTargetingPolicy(window))
+    window->set_event_targeting_policy(policy);
 }
 
 void WindowTree::SetPredefinedCursor(uint32_t change_id,
diff --git a/services/ui/ws/window_tree.h b/services/ui/ws/window_tree.h
index 7ccf7d01..ea6dd8b 100644
--- a/services/ui/ws/window_tree.h
+++ b/services/ui/ws/window_tree.h
@@ -425,8 +425,8 @@
              const EmbedCallback& callback) override;
   void SetFocus(uint32_t change_id, Id transport_window_id) override;
   void SetCanFocus(Id transport_window_id, bool can_focus) override;
-  void SetCanAcceptEvents(Id transport_window_id,
-                          bool can_accept_events) override;
+  void SetEventTargetingPolicy(Id transport_window_id,
+                               mojom::EventTargetingPolicy policy) override;
   void SetPredefinedCursor(uint32_t change_id,
                            Id transport_window_id,
                            ui::mojom::Cursor cursor_id) override;
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc
index c82e7d0..356e40d 100644
--- a/services/ui/ws/window_tree_unittest.cc
+++ b/services/ui/ws/window_tree_unittest.cc
@@ -223,7 +223,9 @@
   ServerWindow* wm_root = FirstRoot(wm_tree());
   ASSERT_TRUE(wm_root);
   wm_root->SetBounds(gfx::Rect(0, 0, 100, 100));
-  EnableHitTest(wm_root);
+  // This tests expects |wm_root| to be a possible target.
+  wm_root->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
   display()->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
   mojom::WindowTreeClientPtr client;
   mojom::WindowTreeClientRequest client_request(&client);
@@ -244,7 +246,6 @@
   ASSERT_TRUE(child1);
   child1->SetVisible(true);
   child1->SetBounds(gfx::Rect(20, 20, 20, 20));
-  EnableHitTest(child1);
 
   TestWindowTreeClient* tree1_client = last_window_tree_client();
   tree1_client->tracker()->changes()->clear();
@@ -492,7 +493,7 @@
   // inside.
   DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
   window->SetPredefinedCursor(mojom::Cursor::IBEAM);
-  EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
+  EXPECT_EQ(mojom::Cursor::POINTER, cursor_id());
 
   DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
   EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
@@ -508,11 +509,11 @@
   // inside.
   DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
   window->SetPredefinedCursor(mojom::Cursor::IBEAM);
-  EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
+  EXPECT_EQ(mojom::Cursor::POINTER, cursor_id());
 
   // With a touch event, we shouldn't update the cursor.
   DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
-  EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
+  EXPECT_EQ(mojom::Cursor::POINTER, cursor_id());
 }
 
 TEST_F(WindowTreeTest, DragOutsideWindow) {
@@ -525,7 +526,7 @@
   // change the cursor.
   DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
   window->SetPredefinedCursor(mojom::Cursor::IBEAM);
-  EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
+  EXPECT_EQ(mojom::Cursor::POINTER, cursor_id());
 
   // Move the pointer to the inside of the window
   DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
@@ -554,7 +555,7 @@
   // Put the cursor just outside the bounds of the window.
   DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41));
   window->SetPredefinedCursor(mojom::Cursor::IBEAM);
-  EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
+  EXPECT_EQ(mojom::Cursor::POINTER, cursor_id());
 
   // Expand the bounds of the window so they now include where the cursor now
   // is.
@@ -581,7 +582,6 @@
   EXPECT_TRUE(tree->AddWindow(embed_window_id, child2_id));
   child2->SetVisible(true);
   child2->SetBounds(gfx::Rect(20, 20, 20, 20));
-  EnableHitTest(child2);
 
   // Give each window a different cursor.
   window1->SetPredefinedCursor(mojom::Cursor::IBEAM);
@@ -607,7 +607,9 @@
   ServerWindow* wm_root = FirstRoot(wm_tree());
   ASSERT_TRUE(wm_root);
   wm_root->SetBounds(gfx::Rect(0, 0, 100, 100));
-  EnableHitTest(wm_root);
+  // This tests expects |wm_root| to be a possible target.
+  wm_root->set_event_targeting_policy(
+      mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
 
   wm_client()->tracker()->changes()->clear();
   DispatchEventWithoutAck(CreateMouseMoveEvent(21, 22));
@@ -1305,10 +1307,13 @@
   ServerWindow* window = nullptr;
   EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
 
-  EXPECT_TRUE(window->can_accept_events());
-  WindowTreeTestApi(tree).SetCanAcceptEvents(
-      ClientWindowIdForWindow(tree, window).id, false);
-  EXPECT_FALSE(window->can_accept_events());
+  EXPECT_EQ(mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS,
+            window->event_targeting_policy());
+  WindowTreeTestApi(tree).SetEventTargetingPolicy(
+      ClientWindowIdForWindow(tree, window).id,
+      mojom::EventTargetingPolicy::NONE);
+  EXPECT_EQ(mojom::EventTargetingPolicy::NONE,
+            window->event_targeting_policy());
 }
 
 // Verifies wm observers capture changes in client.
diff --git a/testing/scripts/kasko_integration_tests.py b/testing/scripts/kasko_integration_tests.py
deleted file mode 100755
index 1be0474..0000000
--- a/testing/scripts/kasko_integration_tests.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Wrapper for the Kasko integration tests."""
-
-
-import json
-import os
-import sys
-
-
-import common
-
-
-# Bring in the Kasko test modules.
-KASKO_TEST_DIR = os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
-    'chrome', 'test', 'kasko')
-KASKO_INTEGRATION_TEST = os.path.join(KASKO_TEST_DIR,
-                                      'kasko_integration_test.py')
-
-
-def main_run(args):
-  if not sys.platform.startswith('win'):
-    json.dump({
-        'valid': False,
-        'failures': ['This script should only be called on win32.'],
-    }, args.output)
-
-  with common.temporary_file() as tempfile_path:
-    kasko_integration_test_res = common.run_integration_test(
-        KASKO_INTEGRATION_TEST,
-        ['--log-to-json', tempfile_path],
-        tempfile_path, args.output)
-
-  return kasko_integration_test_res
-
-
-def main_compile_targets(args):
-  json.dump(['chrome', 'chromedriver'], args.output)
-
-
-if __name__ == '__main__':
-  funcs = {
-    'run': main_run,
-    'compile_targets': main_compile_targets,
-  }
-  sys.exit(common.run_script(sys.argv[1:], funcs))
diff --git a/testing/scripts/syzyasan_integration_tests.py b/testing/scripts/syzyasan_integration_tests.py
deleted file mode 100755
index 5d6d847..0000000
--- a/testing/scripts/syzyasan_integration_tests.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-# 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.
-
-"""Wrapper for the SyzyAsan integration tests."""
-
-
-import json
-import os
-import sys
-
-
-import common
-
-
-# Bring in the SyzyAsan test modules.
-SYZYASAN_TEST_DIR = os.path.join(os.path.dirname(__file__), os.pardir,
-    os.pardir, 'chrome', 'test', 'kasko')
-SYZYASAN_INTEGRATION_TEST = os.path.join(SYZYASAN_TEST_DIR,
-                                         'syzyasan_integration_test.py')
-
-
-def main_run(args):
-  if not sys.platform.startswith('win'):
-    json.dump({
-        'valid': False,
-        'failures': ['This script should only be called on win32.'],
-    }, args.output)
-
-  with common.temporary_file() as tempfile_path:
-    syzyasan_integration_test_res = common.run_integration_test(
-        SYZYASAN_INTEGRATION_TEST,
-        ['--log-to-json', tempfile_path],
-        tempfile_path, args.output)
-
-  return syzyasan_integration_test_res
-
-
-def main_compile_targets(args):
-  json.dump(['chrome', 'chromedriver'], args.output)
-
-
-if __name__ == '__main__':
-  funcs = {
-    'run': main_run,
-    'compile_targets': main_compile_targets,
-  }
-  sys.exit(common.run_script(sys.argv[1:], funcs))
diff --git a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/historical.html b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/historical.html
index a9ae674..faefa7e 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/historical.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/historical.html
@@ -36,6 +36,10 @@
             assert_false(prefixes[i]+'BlobBuilder' in window, prefixes[i]+'BlobBuilder');
         }
     }, 'BlobBuilder should not be supported.');
+
+    test(function() {
+        assert_false('createFor' in URL);
+    }, 'createFor method should not be supported');
   </script>
  </body>
 </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness-expected.txt
index 74fd882..43946fe 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness-expected.txt
@@ -1,7 +1,6 @@
 CONSOLE MESSAGE: line 251: callback not yet supported
 This is a testharness.js-based test.
 PASS URL interface: operation createObjectURL(Blob) 
-FAIL URL interface: operation createFor(Blob) assert_own_property: interface object missing static operation expected property "createFor" missing
 PASS URL interface: operation revokeObjectURL(DOMString) 
 PASS Blob interface: existence and properties of interface object 
 PASS Blob interface object length 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness.idl b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness.idl
index d8f31b4..61704b2 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness.idl
+++ b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/idlharness.idl
@@ -89,6 +89,5 @@
 [Exposed=(Window,DedicatedWorker,SharedWorker)]
 partial interface URL {
   static DOMString createObjectURL(Blob blob);
-  static DOMString createFor(Blob blob);
   static void revokeObjectURL(DOMString url);
 };
diff --git a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob-expected.txt
deleted file mode 100644
index f0147f7..0000000
--- a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob-expected.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-This is a testharness.js-based test.
-PASS Check if the Blob URI starts with 'blob' using createObjectURL() 
-FAIL Check if the Blob URI starts with 'blob' using createFor() window.URL.createFor is not a function
-Harness: the test ran to completion.
-
diff --git a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob.html b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob.html
index db6b441..798df08d 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/FileAPI/url/url_createobjecturl_blob.html
@@ -16,11 +16,5 @@
     assert_equals(typeof testBlob, "string", "Blob URI is typeof string");
     assert_equals(testBlob.indexOf("blob"), 0, "Blob URI starts with 'blob'");
   }, "Check if the Blob URI starts with 'blob' using createObjectURL()");
-
-  test(function() {
-    var testBlob = window.URL.createFor(blob);
-    assert_equals(typeof testBlob, "string", "Blob URI is typeof string");
-    assert_equals(testBlob.indexOf("blob"), 0, "Blob URI starts with 'blob'");
-  }, "Check if the Blob URI starts with 'blob' using createFor()");
 </script>
 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json b/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json
index ebe5863..4dd294a1 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json
+++ b/third_party/WebKit/LayoutTests/external/wpt/MANIFEST.json
@@ -34251,7 +34251,7 @@
    "support"
   ],
   "FileAPI/historical.html": [
-   "6f411640cdbd67dfa11c8d04067ddbbfd24a1f79",
+   "d810a76f4209a5a580652988a355863c2b807e59",
    "testharness"
   ],
   "FileAPI/idlharness-expected.txt": [
@@ -34263,7 +34263,7 @@
    "testharness"
   ],
   "FileAPI/idlharness.idl": [
-   "10a36a1d69430ba6c958f58643ab70440702c796",
+   "061ce6ec6d0e7b8ceebeee53e7d49ff083fdd778",
    "support"
   ],
   "FileAPI/idlharness.worker.js": [
@@ -34327,7 +34327,7 @@
    "support"
   ],
   "FileAPI/url/url_createobjecturl_blob.html": [
-   "636d9016655cfbdec08cc02ddbf0ca7f35b6e539",
+   "bfd9cbe17c74e7b181156c47228beb694d8375af",
    "testharness"
   ],
   "FileAPI/url/url_xmlhttprequest.html": [
diff --git a/third_party/WebKit/LayoutTests/fast/workers/resources/worker-atomics-wait.js b/third_party/WebKit/LayoutTests/fast/workers/resources/worker-atomics-wait.js
new file mode 100644
index 0000000..552235d0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/workers/resources/worker-atomics-wait.js
@@ -0,0 +1,10 @@
+self.addEventListener('message', function(e) {
+    var view = e.data;
+    try {
+        Atomics.wait(view, 0, 0, 0);
+        postMessage("PASS: Atomics.wait is allowed in a worker.");
+    } catch(e) {
+        postMessage("FAIL: Atomics.wait is not allowed in a worker.");
+    }
+    postMessage("DONE");
+});
diff --git a/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait-expected.txt b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait-expected.txt
new file mode 100644
index 0000000..f10bb142
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait-expected.txt
@@ -0,0 +1,4 @@
+Test that Atomics.wait is not allowed on the main thread.
+
+SharedArrayBuffers are not enabled -- skipping test.
+
diff --git a/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html
new file mode 100644
index 0000000..bd47036
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/workers/worker-atomics-wait.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Test that Atomics.wait is not allowed on the main thread.</p>
+<div id="result"></div>
+<script type="text/javascript">
+function log(message)
+{
+    document.getElementById("result").innerHTML += message + "</br>";
+}
+
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+if (window.internals && internals.runtimeFlags.sharedArrayBufferEnabled && window.SharedArrayBuffer) {
+    var view = new Int32Array(new SharedArrayBuffer(4));
+    try {
+      Atomics.wait(view, 0, 0, 0);
+      log("FAIL: Calling Atomics.wait on the main thread did not throw.");
+    } catch (e) {
+      log("PASS: Calling Atomics.wait on the main thread throws.");
+    }
+
+    var worker = new Worker('resources/worker-atomics-wait.js');
+    worker.postMessage(view);
+
+    worker.onmessage = function(e) {
+        log(e.data);
+        if (e.data == 'DONE') {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+    };
+} else {
+    log("SharedArrayBuffers are not enabled -- skipping test.");
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+</script>
+</body>
+</html>
+
diff --git a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
index 46a1fa5..9dfe3af 100644
--- a/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
+++ b/third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js
@@ -93,6 +93,7 @@
 
 InspectorTest.dumpConsoleMessagesIntoArray = function(printOriginatingCommand, dumpClassNames, formatter)
 {
+    Common.settingForTest('messageLevelFilters2').set(SDK.ConsoleMessage.MessageLevel.Verbose);
     formatter = formatter || InspectorTest.prepareConsoleMessageText;
     var result = [];
     InspectorTest.disableConsoleViewport();
diff --git a/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt b/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt
index 6ab094d7..cc4b3cc 100644
--- a/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/user-metrics-expected.txt
@@ -5,6 +5,8 @@
     AnimationsPlaybackRateChanged : 11
     AuditsStarted : 7
     CommandEvaluatedInConsolePanel : 15
+    ConnectToNodeJSDirectly : 20
+    ConnectToNodeJSFromFrontend : 19
     ConsoleEvaluated : 8
     DOMPropertiesExpanded : 16
     DeviceModeEnabled : 10
diff --git a/third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/workers/worker-atomics-wait-expected.txt b/third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/workers/worker-atomics-wait-expected.txt
new file mode 100644
index 0000000..43d4b94b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/sharedarraybuffer/fast/workers/worker-atomics-wait-expected.txt
@@ -0,0 +1,6 @@
+Test that Atomics.wait is not allowed on the main thread.
+
+PASS: Calling Atomics.wait on the main thread throws.
+PASS: Atomics.wait is allowed in a worker.
+DONE
+
diff --git a/third_party/WebKit/LayoutTests/vr/multiple_requestAnimationFrame_called.html b/third_party/WebKit/LayoutTests/vr/multiple_requestAnimationFrame_called.html
new file mode 100644
index 0000000..1aa923b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/vr/multiple_requestAnimationFrame_called.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="../resources/mojo-helpers.js"></script>
+<script src="resources/fake-vr-displays.js"></script>
+<script src="resources/mock-vr-service.js"></script>
+<script>
+let fakeDisplays = fakeVRDisplays();
+
+vr_test( (t) => {
+  return navigator.getVRDisplays().then( (displays) => {
+    let display = displays[0];
+    let onAnimationFrame3_time = -1;
+    function onAnimationFrame() {
+      display.requestAnimationFrame(onAnimationFrame3);
+    }
+
+    function onAnimationFrame2() {
+      display.requestAnimationFrame(onAnimationFrame4);
+    }
+
+    function onAnimationFrame3(time) {
+      onAnimationFrame3_time = time;
+    }
+
+    function onAnimationFrame4(time) {
+      t.step(function() {
+        assert_equals(time, onAnimationFrame3_time);
+      });
+      t.done();
+    }
+
+    display.requestAnimationFrame(onAnimationFrame);
+    display.requestAnimationFrame(onAnimationFrame2);
+  }, (err) => {
+    t.step( () => {
+      assert_unreached("getVRDisplays rejected");
+    });
+    t.done();
+  });
+}, [fakeDisplays["Pixel"]],
+"multiple requestAnimationFrame requests call the correct callbacks");
+
+</script>
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h
index 951117d6..8fdb3a4 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.h
@@ -22,6 +22,7 @@
                               const String& source,
                               const String& fileName);
 
+  ScriptModule() {}
   ScriptModule(const ScriptModule& module) : m_module(module.m_module) {}
   ~ScriptModule();
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
index 906e829..6286d78 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp
@@ -55,7 +55,10 @@
 
 V8PerIsolateData::V8PerIsolateData(WebTaskRunner* taskRunner)
     : m_isolateHolder(WTF::makeUnique<gin::IsolateHolder>(
-          taskRunner ? taskRunner->toSingleThreadTaskRunner() : nullptr)),
+          taskRunner ? taskRunner->toSingleThreadTaskRunner() : nullptr,
+          gin::IsolateHolder::kSingleThread,
+          isMainThread() ? gin::IsolateHolder::kDisallowAtomicsWait
+                         : gin::IsolateHolder::kAllowAtomicsWait)),
       m_stringCache(WTF::wrapUnique(new StringCache(isolate()))),
       m_hiddenValue(V8HiddenValue::create()),
       m_privateProperty(V8PrivateProperty::create()),
diff --git a/third_party/WebKit/Source/core/dom/BUILD.gn b/third_party/WebKit/Source/core/dom/BUILD.gn
index d744cfc7..92ce567 100644
--- a/third_party/WebKit/Source/core/dom/BUILD.gn
+++ b/third_party/WebKit/Source/core/dom/BUILD.gn
@@ -181,6 +181,8 @@
     "MessagePort.cpp",
     "Modulator.cpp",
     "Modulator.h",
+    "ModuleScript.cpp",
+    "ModuleScript.h",
     "MutationCallback.h",
     "MutationObserver.cpp",
     "MutationObserver.h",
diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.cpp b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
new file mode 100644
index 0000000..0ab530f
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
@@ -0,0 +1,11 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/dom/ModuleScript.h"
+
+namespace blink {
+
+DEFINE_TRACE(ModuleScript) {}
+
+}  // namespace blink
diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.h b/third_party/WebKit/Source/core/dom/ModuleScript.h
new file mode 100644
index 0000000..5efe745b
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/ModuleScript.h
@@ -0,0 +1,98 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ModuleScript_h
+#define ModuleScript_h
+
+#include "bindings/core/v8/ScriptModule.h"
+#include "core/CoreExport.h"
+#include "platform/heap/Handle.h"
+#include "platform/loader/fetch/ResourceLoaderOptions.h"
+#include "platform/weborigin/KURL.h"
+#include "public/platform/WebURLRequest.h"
+
+namespace blink {
+
+// https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-instantiation-state
+enum class ModuleInstantiationState {
+  Uninstantiated,
+  Errored,
+  Instantiated,
+};
+
+// ModuleScript is a model object for the "module script" spec concept.
+// https://html.spec.whatwg.org/multipage/webappapis.html#module-script
+class CORE_EXPORT ModuleScript final
+    : public GarbageCollectedFinalized<ModuleScript> {
+ public:
+  static ModuleScript* create(
+      ScriptModule record,
+      const KURL& baseURL,
+      const String& nonce,
+      ParserDisposition parserState,
+      WebURLRequest::FetchCredentialsMode credentialsMode) {
+    return new ModuleScript(record, baseURL, nonce, parserState,
+                            credentialsMode);
+  }
+  ~ModuleScript() = default;
+
+  ScriptModule& record() { return m_record; }
+  void clearRecord() { m_record = ScriptModule(); }
+  const KURL& baseURL() const { return m_baseURL; }
+
+  ParserDisposition parserState() const { return m_parserState; }
+  WebURLRequest::FetchCredentialsMode credentialsMode() const {
+    return m_credentialsMode;
+  }
+  const String& nonce() const { return m_nonce; }
+
+  ModuleInstantiationState instantiationState() const {
+    return m_instantiationState;
+  }
+
+  DECLARE_TRACE();
+
+ private:
+  ModuleScript(ScriptModule record,
+               const KURL& baseURL,
+               const String& nonce,
+               ParserDisposition parserState,
+               WebURLRequest::FetchCredentialsMode credentialsMode)
+      : m_record(record),
+        m_baseURL(baseURL),
+        m_nonce(nonce),
+        m_parserState(parserState),
+        m_credentialsMode(credentialsMode) {}
+
+  // Note: A "module script"'s "setttings object" is ommitted, as we currently
+  // always have access to the corresponding Modulator when operating on a
+  // ModuleScript instance.
+  // https://html.spec.whatwg.org/multipage/webappapis.html#settings-object
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-module-record
+  ScriptModule m_record;
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-base-url
+  const KURL m_baseURL;
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-instantiation-state
+  ModuleInstantiationState m_instantiationState =
+      ModuleInstantiationState::Uninstantiated;
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-instantiation-error
+  // TODO(kouhei): Add a corresponding member.
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-nonce
+  const String m_nonce;
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-parser
+  const ParserDisposition m_parserState;
+
+  // https://html.spec.whatwg.org/multipage/webappapis.html#concept-module-script-credentials-mode
+  const WebURLRequest::FetchCredentialsMode m_credentialsMode;
+};
+
+}  // namespace blink
+
+#endif
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index d044bd9..ff7c319e 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -1447,6 +1447,7 @@
     WebNFCCancelPush = 1794,
     WebNFCWatch = 1795,
     WebNFCCancelWatch = 1796,
+    AudioParamCancelAndHoldAtTime = 1797,
 
     // Add new features immediately above this line. Don't change assigned
     // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
index 9a425115..4d8f1db9 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.cpp
@@ -59,7 +59,7 @@
 
 SubframeLoadingDisabler::SubtreeRootSet&
 SubframeLoadingDisabler::disabledSubtreeRoots() {
-  DEFINE_STATIC_LOCAL(SubtreeRootSet, nodes, (new SubtreeRootSet));
+  DEFINE_STATIC_LOCAL(SubtreeRootSet, nodes, ());
   return nodes;
 }
 
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
index e284c03..e49a47aa 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLFrameOwnerElement.h
@@ -151,7 +151,12 @@
   }
 
  private:
-  using SubtreeRootSet = HeapHashCountedSet<Member<Node>>;
+  // The use of UntracedMember<Node>  is safe as all SubtreeRootSet
+  // references are on the stack and reachable in case a conservative
+  // GC hits.
+  // TODO(sof): go back to HeapHashSet<> once crbug.com/684551 has been
+  // resolved.
+  using SubtreeRootSet = HashCountedSet<UntracedMember<Node>>;
 
   CORE_EXPORT static SubtreeRootSet& disabledSubtreeRoots();
 
diff --git a/third_party/WebKit/Source/core/layout/BUILD.gn b/third_party/WebKit/Source/core/layout/BUILD.gn
index 885a01e..e7214cb 100644
--- a/third_party/WebKit/Source/core/layout/BUILD.gn
+++ b/third_party/WebKit/Source/core/layout/BUILD.gn
@@ -312,14 +312,11 @@
     "ng/ng_inline_node.h",
     "ng/ng_layout_inline_items_builder.cc",
     "ng/ng_layout_inline_items_builder.h",
-    "ng/ng_layout_input_node.cc",
     "ng/ng_layout_input_node.h",
     "ng/ng_layout_opportunity_iterator.cc",
     "ng/ng_layout_opportunity_iterator.h",
     "ng/ng_layout_opportunity_tree_node.cc",
     "ng/ng_layout_opportunity_tree_node.h",
-    "ng/ng_legacy_block_layout_algorithm.cc",
-    "ng/ng_legacy_block_layout_algorithm.h",
     "ng/ng_length_utils.cc",
     "ng/ng_length_utils.h",
     "ng/ng_line_builder.cc",
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
index f7e50974..80c8779 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -260,8 +260,7 @@
     NGBlockNode* first_child,
     NGConstraintSpace* constraint_space,
     NGBreakToken* break_token)
-    : NGLayoutAlgorithm(kBlockLayoutAlgorithm),
-      style_(style),
+    : style_(style),
       first_child_(first_child),
       constraint_space_(constraint_space),
       break_token_(break_token),
@@ -719,16 +718,4 @@
   return space_builder_->ToConstraintSpace();
 }
 
-DEFINE_TRACE(NGBlockLayoutAlgorithm) {
-  NGLayoutAlgorithm::trace(visitor);
-  visitor->trace(first_child_);
-  visitor->trace(constraint_space_);
-  visitor->trace(break_token_);
-  visitor->trace(builder_);
-  visitor->trace(space_builder_);
-  visitor->trace(space_for_current_child_);
-  visitor->trace(current_child_);
-  visitor->trace(fragmentainer_mapper_);
-}
-
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
index daf2b69..f3d1040 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
@@ -8,6 +8,8 @@
 #include "core/CoreExport.h"
 #include "core/layout/ng/ng_block_node.h"
 #include "core/layout/ng/ng_box_fragment.h"
+#include "core/layout/ng/ng_break_token.h"
+#include "core/layout/ng/ng_column_mapper.h"
 #include "core/layout/ng/ng_layout_algorithm.h"
 #include "core/layout/ng/ng_units.h"
 #include "wtf/RefPtr.h"
@@ -16,8 +18,6 @@
 
 class ComputedStyle;
 class NGBlockBreakToken;
-class NGBreakToken;
-class NGColumnMapper;
 class NGConstraintSpace;
 class NGConstraintSpaceBuilder;
 class NGFragment;
@@ -44,8 +44,6 @@
   bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) const override;
   NGPhysicalFragment* Layout() override;
 
-  DECLARE_VIRTUAL_TRACE();
-
  private:
   NGBoxStrut CalculateMargins(const NGConstraintSpace& space,
                               const ComputedStyle& style);
@@ -123,21 +121,21 @@
 
   RefPtr<const ComputedStyle> style_;
 
-  Member<NGBlockNode> first_child_;
-  Member<NGConstraintSpace> constraint_space_;
+  Persistent<NGBlockNode> first_child_;
+  Persistent<NGConstraintSpace> constraint_space_;
 
   // The break token from which we are currently resuming layout.
-  Member<NGBreakToken> break_token_;
+  Persistent<NGBreakToken> break_token_;
 
-  Member<NGFragmentBuilder> builder_;
-  Member<NGConstraintSpaceBuilder> space_builder_;
-  Member<NGConstraintSpace> space_for_current_child_;
-  Member<NGBlockNode> current_child_;
+  Persistent<NGFragmentBuilder> builder_;
+  Persistent<NGConstraintSpaceBuilder> space_builder_;
+  Persistent<NGConstraintSpace> space_for_current_child_;
+  Persistent<NGBlockNode> current_child_;
 
   // Mapper from the fragmented flow coordinate space coordinates to visual
   // coordinates. Only set on fragmentation context roots, such as multicol
   // containers. Keeps track of the current fragmentainer.
-  Member<NGColumnMapper> fragmentainer_mapper_;
+  Persistent<NGColumnMapper> fragmentainer_mapper_;
 
   NGBoxStrut border_and_padding_;
   LayoutUnit content_size_;
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
index e531bfd..2e0d816 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc
@@ -13,6 +13,7 @@
 #include "core/layout/ng/ng_constraint_space.h"
 #include "core/layout/ng/ng_constraint_space_builder.h"
 #include "core/layout/ng/ng_fragment_builder.h"
+#include "core/layout/ng/ng_inline_layout_algorithm.h"
 #include "core/layout/ng/ng_inline_node.h"
 #include "core/layout/ng/ng_length_utils.h"
 #include "core/layout/ng/ng_writing_mode.h"
@@ -79,19 +80,29 @@
 NGBlockNode::~NGBlockNode() {}
 
 NGPhysicalFragment* NGBlockNode::Layout(NGConstraintSpace* constraint_space) {
-  // We can either use the new layout code to do the layout and then copy the
-  // resulting size to the LayoutObject, or use the old layout code and
-  // synthesize a fragment.
-  if (CanUseNewLayout()) {
-    NGLayoutAlgorithm* algorithm =
-        NGLayoutInputNode::AlgorithmForInputNode(this, constraint_space);
-    fragment_ = toNGPhysicalBoxFragment(algorithm->Layout());
-    CopyFragmentDataToLayoutBox(*constraint_space);
-  } else {
+  // Use the old layout code and synthesize a fragment.
+  if (!CanUseNewLayout()) {
     DCHECK(layout_box_);
     fragment_ = RunOldLayout(*constraint_space);
+    return fragment_;
   }
 
+  NGPhysicalFragment* fragment;
+
+  if (HasInlineChildren()) {
+    fragment =
+        NGInlineLayoutAlgorithm(GetLayoutObject(), &Style(),
+                                toNGInlineNode(FirstChild()), constraint_space)
+            .Layout();
+  } else {
+    fragment = NGBlockLayoutAlgorithm(GetLayoutObject(), &Style(),
+                                      toNGBlockNode(FirstChild()),
+                                      constraint_space, CurrentBreakToken())
+                   .Layout();
+  }
+
+  fragment_ = toNGPhysicalBoxFragment(fragment);
+  CopyFragmentDataToLayoutBox(*constraint_space);
   return fragment_;
 }
 
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc
index a6cd530..e308c50 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.cc
@@ -23,8 +23,7 @@
     NGInlineNode* first_child,
     NGConstraintSpace* constraint_space,
     NGBreakToken* break_token)
-    : NGLayoutAlgorithm(kInlineLayoutAlgorithm),
-      style_(style),
+    : style_(style),
       first_child_(first_child),
       constraint_space_(constraint_space),
       break_token_(break_token),
@@ -65,12 +64,4 @@
   return child_space;
 }
 
-DEFINE_TRACE(NGInlineLayoutAlgorithm) {
-  NGLayoutAlgorithm::trace(visitor);
-  visitor->trace(first_child_);
-  visitor->trace(constraint_space_);
-  visitor->trace(break_token_);
-  visitor->trace(builder_);
-}
-
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.h
index e37ba0d..5a58fe5 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_layout_algorithm.h
@@ -6,14 +6,15 @@
 #define NGInlineLayoutAlgorithm_h
 
 #include "core/CoreExport.h"
+#include "core/layout/ng/ng_break_token.h"
 #include "core/layout/ng/ng_layout_algorithm.h"
+#include "platform/heap/Handle.h"
 #include "wtf/RefPtr.h"
 
 namespace blink {
 
 class ComputedStyle;
 class LayoutObject;
-class NGBreakToken;
 class NGConstraintSpace;
 class NGFragmentBuilder;
 class NGInlineNode;
@@ -41,8 +42,6 @@
 
   NGPhysicalFragment* Layout() override;
 
-  DECLARE_VIRTUAL_TRACE();
-
  private:
   // Read-only Getters.
   const ComputedStyle& Style() const { return *style_; }
@@ -50,10 +49,10 @@
   NGConstraintSpace* CreateConstraintSpaceForChild(const NGInlineNode&) const;
 
   RefPtr<const ComputedStyle> style_;
-  Member<NGInlineNode> first_child_;
-  Member<NGConstraintSpace> constraint_space_;
-  Member<NGBreakToken> break_token_;
-  Member<NGFragmentBuilder> builder_;
+  Persistent<NGInlineNode> first_child_;
+  Persistent<NGConstraintSpace> constraint_space_;
+  Persistent<NGBreakToken> break_token_;
+  Persistent<NGFragmentBuilder> builder_;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc b/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc
index 8a797d9..5bb6c78 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_inline_node_test.cc
@@ -69,9 +69,9 @@
     NGConstraintSpace* constraint_space =
         NGConstraintSpaceBuilder(kHorizontalTopBottom).ToConstraintSpace();
     NGLineBuilder line_builder(node, constraint_space);
-    NGTextLayoutAlgorithm* algorithm =
-        new NGTextLayoutAlgorithm(node, constraint_space);
-    algorithm->LayoutInline(&line_builder);
+
+    NGTextLayoutAlgorithm algorithm(node, constraint_space);
+    algorithm.LayoutInline(&line_builder);
 
     NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox,
                                        /* layout_object */ nullptr);
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.h
index 59df65e..b3fc836 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.h
@@ -6,32 +6,19 @@
 #define NGLayoutAlgorithm_h
 
 #include "core/CoreExport.h"
-#include "platform/heap/Handle.h"
 #include "wtf/Allocator.h"
 #include "wtf/Noncopyable.h"
 
 namespace blink {
 
 struct MinAndMaxContentSizes;
-class NGConstraintSpace;
 class NGPhysicalFragment;
 
-enum NGLayoutStatus { kNotFinished, kChildAlgorithmRequired, kNewFragment };
-
-enum NGLayoutAlgorithmType {
-  kBlockLayoutAlgorithm,
-  kInlineLayoutAlgorithm,
-  kLegacyBlockLayoutAlgorithm,
-  kTextLayoutAlgorithm
-};
-
 // Base class for all LayoutNG algorithms.
-class CORE_EXPORT NGLayoutAlgorithm
-    : public GarbageCollectedFinalized<NGLayoutAlgorithm> {
-  WTF_MAKE_NONCOPYABLE(NGLayoutAlgorithm);
+class CORE_EXPORT NGLayoutAlgorithm {
+  STACK_ALLOCATED();
 
  public:
-  NGLayoutAlgorithm(NGLayoutAlgorithmType type) : type_(type) {}
   virtual ~NGLayoutAlgorithm() {}
 
   // Actual layout function. Lays out the children and descendents within the
@@ -40,8 +27,6 @@
   // TODO(layout-dev): attempt to make this function const.
   virtual NGPhysicalFragment* Layout() = 0;
 
-  enum MinAndMaxState { kSuccess, kPending, kNotImplemented };
-
   // Computes the min-content and max-content intrinsic sizes for the given box.
   // The result will not take any min-width, max-width or width properties into
   // account. Implementations can return false, in which case the caller is
@@ -51,13 +36,6 @@
   virtual bool ComputeMinAndMaxContentSizes(MinAndMaxContentSizes*) const {
     return false;
   }
-
-  DEFINE_INLINE_VIRTUAL_TRACE() {}
-
-  NGLayoutAlgorithmType algorithmType() const { return type_; }
-
- private:
-  NGLayoutAlgorithmType type_;
 };
 
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc
deleted file mode 100644
index dcb0e27..0000000
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc
+++ /dev/null
@@ -1,42 +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.
-
-#include "core/layout/ng/ng_layout_input_node.h"
-
-#include "core/layout/ng/ng_block_layout_algorithm.h"
-#include "core/layout/ng/ng_block_node.h"
-#include "core/layout/ng/ng_constraint_space.h"
-#include "core/layout/ng/ng_inline_layout_algorithm.h"
-#include "core/layout/ng/ng_inline_node.h"
-#include "core/layout/ng/ng_layout_algorithm.h"
-#include "core/layout/ng/ng_legacy_block_layout_algorithm.h"
-#include "core/style/ComputedStyle.h"
-
-namespace blink {
-
-NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode(
-    NGLayoutInputNode* input_node,
-    NGConstraintSpace* constraint_space) {
-  // At least for now, this should never be called on LegacyInline
-  // children. However, there will be other kinds of input_node so
-  // it makes sense to do this here.
-  DCHECK(input_node->Type() == kLegacyBlock);
-  NGBlockNode* block = toNGBlockNode(input_node);
-  if (!block->CanUseNewLayout())
-    return new NGLegacyBlockLayoutAlgorithm(block, constraint_space);
-  const ComputedStyle& style = block->Style();
-  LayoutObject* layout_object = input_node->GetLayoutObject();
-  if (block->HasInlineChildren()) {
-    NGInlineNode* child = toNGInlineNode(block->FirstChild());
-    return new NGInlineLayoutAlgorithm(layout_object, &style, child,
-                                       constraint_space);
-  }
-  NGBlockNode* child = toNGBlockNode(block->FirstChild());
-  // TODO(layout-ng): The break token should be passed as an argument to this
-  // method instead of getting it from the NGBlockNode
-  NGBreakToken* token = block->CurrentBreakToken();
-  return new NGBlockLayoutAlgorithm(layout_object, &style, child,
-                                    constraint_space, token);
-}
-}
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h
index 6e502df..f18a786 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.h
@@ -13,7 +13,6 @@
 class LayoutObject;
 class NGConstraintSpace;
 class NGPhysicalFragment;
-class NGLayoutAlgorithm;
 
 // Represents the input to a layout algorithm for a given node. The layout
 // engine should use the style, node type to determine which type of layout
@@ -38,9 +37,6 @@
     return static_cast<NGLayoutInputNodeType>(type_);
   }
 
-  static NGLayoutAlgorithm* AlgorithmForInputNode(NGLayoutInputNode*,
-                                                  NGConstraintSpace*);
-
   DEFINE_INLINE_VIRTUAL_TRACE() {}
 
  protected:
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_legacy_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_legacy_block_layout_algorithm.cc
deleted file mode 100644
index c19654d..0000000
--- a/third_party/WebKit/Source/core/layout/ng/ng_legacy_block_layout_algorithm.cc
+++ /dev/null
@@ -1,27 +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.
-
-#include "core/layout/ng/ng_legacy_block_layout_algorithm.h"
-
-#include "core/layout/ng/ng_physical_box_fragment.h"
-
-namespace blink {
-
-NGLegacyBlockLayoutAlgorithm::NGLegacyBlockLayoutAlgorithm(
-    NGBlockNode* block,
-    const NGConstraintSpace* constraint_space)
-    : NGLayoutAlgorithm(kLegacyBlockLayoutAlgorithm),
-      block_(block),
-      constraint_space_(constraint_space) {}
-
-NGPhysicalFragment* NGLegacyBlockLayoutAlgorithm::Layout() {
-  return block_->RunOldLayout(*constraint_space_);
-}
-
-DEFINE_TRACE(NGLegacyBlockLayoutAlgorithm) {
-  NGLayoutAlgorithm::trace(visitor);
-  visitor->trace(block_);
-  visitor->trace(constraint_space_);
-}
-}
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_legacy_block_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_legacy_block_layout_algorithm.h
deleted file mode 100644
index 189aaf5..0000000
--- a/third_party/WebKit/Source/core/layout/ng/ng_legacy_block_layout_algorithm.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NGLegacyBlockLayoutAlgorithm_h
-#define NGLegacyBlockLayoutAlgorithm_h
-
-#include "core/CoreExport.h"
-#include "core/layout/ng/ng_block_node.h"
-#include "core/layout/ng/ng_constraint_space.h"
-#include "core/layout/ng/ng_layout_algorithm.h"
-#include "wtf/RefPtr.h"
-
-namespace blink {
-
-// A class for legacy block layout (blocks that can't be handled by NG yet).
-// Defers to the old layout method of the block
-class CORE_EXPORT NGLegacyBlockLayoutAlgorithm : public NGLayoutAlgorithm {
- public:
-  NGLegacyBlockLayoutAlgorithm(NGBlockNode*, const NGConstraintSpace*);
-
-  NGPhysicalFragment* Layout() override;
-
-  DECLARE_VIRTUAL_TRACE();
-
- private:
-  Member<NGBlockNode> block_;
-  Member<const NGConstraintSpace> constraint_space_;
-};
-}
-
-#endif  // NGLegacyBlockLayoutAlgorithm_h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
index eaecb75..6c41377 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc
@@ -43,6 +43,8 @@
     LengthResolveType type) {
   DCHECK(!length.isMaxSizeNone());
   DCHECK_GE(constraint_space.AvailableSize().inline_size, LayoutUnit());
+  DCHECK_GE(constraint_space.PercentageResolutionSize().inline_size,
+            LayoutUnit());
 
   if (type == LengthResolveType::kMinSize && length.isAuto())
     return LayoutUnit();
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
index 64a1c1f..d3503ca 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.cc
@@ -19,8 +19,7 @@
     NGInlineNode* inline_box,
     NGConstraintSpace* constraint_space,
     NGBreakToken* break_token)
-    : NGLayoutAlgorithm(kTextLayoutAlgorithm),
-      inline_box_(inline_box),
+    : inline_box_(inline_box),
       constraint_space_(constraint_space),
       break_token_(break_token) {
   DCHECK(inline_box_);
@@ -68,11 +67,4 @@
   line_builder->CreateLine();
 }
 
-DEFINE_TRACE(NGTextLayoutAlgorithm) {
-  NGLayoutAlgorithm::trace(visitor);
-  visitor->trace(inline_box_);
-  visitor->trace(constraint_space_);
-  visitor->trace(break_token_);
-}
-
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.h
index 0287a0dd..61b0bd13 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_text_layout_algorithm.h
@@ -6,11 +6,12 @@
 #define NGInlineLayoutAlgorithm_h
 
 #include "core/CoreExport.h"
+#include "core/layout/ng/ng_break_token.h"
 #include "core/layout/ng/ng_layout_algorithm.h"
+#include "platform/heap/Handle.h"
 
 namespace blink {
 
-class NGBreakToken;
 class NGConstraintSpace;
 class NGInlineNode;
 class NGLineBuilder;
@@ -34,22 +35,14 @@
   NGPhysicalFragment* Layout() override;
   void LayoutInline(NGLineBuilder*);
 
-  DECLARE_VIRTUAL_TRACE();
-
  private:
-  Member<NGInlineNode> inline_box_;
-  Member<NGConstraintSpace> constraint_space_;
-  Member<NGBreakToken> break_token_;
+  Persistent<NGInlineNode> inline_box_;
+  Persistent<NGConstraintSpace> constraint_space_;
+  Persistent<NGBreakToken> break_token_;
 
   friend class NGInlineNodeTest;
 };
 
-DEFINE_TYPE_CASTS(NGTextLayoutAlgorithm,
-                  NGLayoutAlgorithm,
-                  algorithm,
-                  algorithm->algorithmType() == kTextLayoutAlgorithm,
-                  algorithm.algorithmType() == kTextLayoutAlgorithm);
-
 }  // namespace blink
 
 #endif  // NGInlineLayoutAlgorithm_h
diff --git a/third_party/WebKit/Source/core/loader/BUILD.gn b/third_party/WebKit/Source/core/loader/BUILD.gn
index 45f7b26..e0e57be8 100644
--- a/third_party/WebKit/Source/core/loader/BUILD.gn
+++ b/third_party/WebKit/Source/core/loader/BUILD.gn
@@ -62,6 +62,7 @@
     "appcache/ApplicationCache.h",
     "appcache/ApplicationCacheHost.cpp",
     "appcache/ApplicationCacheHost.h",
+    "modulescript/ModuleScriptFetchRequest.h",
     "resource/CSSStyleSheetResource.cpp",
     "resource/CSSStyleSheetResource.h",
     "resource/DocumentResource.cpp",
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetchRequest.h b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetchRequest.h
new file mode 100644
index 0000000..d2bc85b
--- /dev/null
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptFetchRequest.h
@@ -0,0 +1,69 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ModuleScriptFetchRequest_h
+#define ModuleScriptFetchRequest_h
+
+#include "platform/loader/fetch/ResourceLoaderOptions.h"
+#include "platform/weborigin/KURL.h"
+#include "platform/weborigin/Referrer.h"
+#include "public/platform/WebURLRequest.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+// A ModuleScriptFetchRequest is a "parameter object" for
+// Modulator::fetch{,New}SingleModule to avoid the methods having too many
+// arguments.
+// In terms of spec, a ModuleScriptFetchRequest carries most of the arguments
+// for "fetch a single module script" algorithm:
+// https://html.spec.whatwg.org/#fetch-a-single-module-script
+class ModuleScriptFetchRequest final {
+  STACK_ALLOCATED();
+
+ public:
+  ModuleScriptFetchRequest(const KURL& url,
+                           const String& nonce,
+                           ParserDisposition parserState,
+                           WebURLRequest::FetchCredentialsMode credentialsMode)
+      : ModuleScriptFetchRequest(url,
+                                 nonce,
+                                 parserState,
+                                 credentialsMode,
+                                 Referrer::noReferrer()) {}
+  ~ModuleScriptFetchRequest() = default;
+
+  const KURL& url() const { return m_url; }
+  const String& nonce() const { return m_nonce; }
+  const ParserDisposition& parserState() const { return m_parserState; }
+  WebURLRequest::FetchCredentialsMode credentialsMode() const {
+    return m_credentialsMode;
+  }
+  const AtomicString& referrer() const { return m_referrer; }
+
+ private:
+  // Referrer is set only for internal module script fetch algorithms triggered
+  // from ModuleTreeLinker to fetch descendant module scripts.
+  friend class ModuleTreeLinker;
+  ModuleScriptFetchRequest(const KURL& url,
+                           const String& nonce,
+                           ParserDisposition parserState,
+                           WebURLRequest::FetchCredentialsMode credentialsMode,
+                           const String& referrer)
+      : m_url(url),
+        m_nonce(nonce),
+        m_parserState(parserState),
+        m_credentialsMode(credentialsMode),
+        m_referrer(referrer) {}
+
+  const KURL m_url;
+  const String m_nonce;
+  const ParserDisposition m_parserState;
+  const WebURLRequest::FetchCredentialsMode m_credentialsMode;
+  const AtomicString m_referrer;
+};
+
+}  // namespace blink
+
+#endif
diff --git a/third_party/WebKit/Source/devtools/BUILD.gn b/third_party/WebKit/Source/devtools/BUILD.gn
index f3f90ba..89af8d25 100644
--- a/third_party/WebKit/Source/devtools/BUILD.gn
+++ b/third_party/WebKit/Source/devtools/BUILD.gn
@@ -597,6 +597,7 @@
   "front_end/ui/FilterBar.js",
   "front_end/ui/ForwardedInputEventHandler.js",
   "front_end/ui/Geometry.js",
+  "front_end/ui/GlassPane.js",
   "front_end/ui/HistoryInput.js",
   "front_end/ui/Icon.js",
   "front_end/ui/infobar.css",
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/checkboxCheckmark.png b/third_party/WebKit/Source/devtools/front_end/Images/checkboxCheckmark.png
new file mode 100644
index 0000000..3a80164
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/Images/checkboxCheckmark.png
Binary files differ
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/checkboxCheckmark_2x.png b/third_party/WebKit/Source/devtools/front_end/Images/checkboxCheckmark_2x.png
new file mode 100644
index 0000000..237e4199
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/Images/checkboxCheckmark_2x.png
Binary files differ
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/src/checkboxCheckmark.svg b/third_party/WebKit/Source/devtools/front_end/Images/src/checkboxCheckmark.svg
new file mode 100644
index 0000000..b54a738
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/Images/src/checkboxCheckmark.svg
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="11"
+   height="11"
+   id="svg3283"
+   version="1.1"
+   inkscape:version="0.48.4 r9939"
+   sodipodi:docname="New document 4">
+  <defs
+     id="defs3285" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="15.839192"
+     inkscape:cx="1.4668053"
+     inkscape:cy="9.4825906"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1280"
+     inkscape:window-height="747"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata3288">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-1041.3622)">
+    <path
+       d="m 3.65,1048.5722 -1.44,-2.03 -1.21,1.21 2.55,3.61 6.45,-7.67 -1.12,-1.33 z"
+       id="path3689"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes b/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes
index d2ae55d4..5146cee 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes
+++ b/third_party/WebKit/Source/devtools/front_end/Images/src/optimize_png.hashes
@@ -2,6 +2,7 @@
     "securityIcons.svg": "27676f7c1f1542659c7c49a8052259dc",
     "resourceGlyphs.svg": "ae5287ef4b10714c8858b5384c348b6a",
     "breakpointConditional.svg": "4cf90210b2af2ed84db2f60b07bcde28",
+    "checkboxCheckmark.svg": "f039bf85cee42ad5c30ca3bfdce7912a",
     "errorWave.svg": "e183fa242a22ed4784a92f6becbc2c45",
     "smallIcons.svg": "d884babbd1c785b92eb46ee736c95541",
     "toolbarButtonGlyphs.svg": "2b963249c94071016f109403ec246f00",
diff --git a/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes b/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes
index d2ae55d4..5146cee 100644
--- a/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes
+++ b/third_party/WebKit/Source/devtools/front_end/Images/src/svg2png.hashes
@@ -2,6 +2,7 @@
     "securityIcons.svg": "27676f7c1f1542659c7c49a8052259dc",
     "resourceGlyphs.svg": "ae5287ef4b10714c8858b5384c348b6a",
     "breakpointConditional.svg": "4cf90210b2af2ed84db2f60b07bcde28",
+    "checkboxCheckmark.svg": "f039bf85cee42ad5c30ca3bfdce7912a",
     "errorWave.svg": "e183fa242a22ed4784a92f6becbc2c45",
     "smallIcons.svg": "d884babbd1c785b92eb46ee736c95541",
     "toolbarButtonGlyphs.svg": "2b963249c94071016f109403ec246f00",
diff --git a/third_party/WebKit/Source/devtools/front_end/components/objectPropertiesSection.css b/third_party/WebKit/Source/devtools/front_end/components/objectPropertiesSection.css
index 180bf45..70e1f29 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/objectPropertiesSection.css
+++ b/third_party/WebKit/Source/devtools/front_end/components/objectPropertiesSection.css
@@ -56,11 +56,3 @@
     display: flex;
     flex-direction: row;
 }
-
-.object-properties-section-root-element::before {
-    -webkit-mask-position: -4px -97px !important;
-}
-
-.object-properties-section-root-element.expanded::before {
-    -webkit-mask-position: -20px -97px !important;
-}
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
index 0ca856d..12e5c1fd 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
+++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
@@ -43,6 +43,8 @@
 
     this._gutterContainer = this.listItemElement.createChild('div', 'gutter-container');
     this._gutterContainer.addEventListener('click', this._showContextMenu.bind(this));
+    var gutterMenuIcon = UI.Icon.create('largeicon-menu', 'gutter-menu-icon');
+    this._gutterContainer.appendChild(gutterMenuIcon);
     this._decorationsElement = this._gutterContainer.createChild('div', 'hidden');
 
     this._elementCloseTag = elementCloseTag;
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css b/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css
index 72a14ef8..b7b85bfba 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css
+++ b/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css
@@ -321,26 +321,22 @@
 .elements-disclosure .gutter-container {
     position: absolute;
     top: 0;
-}
-
-.elements-disclosure li.selected .gutter-container:not(.has-decorations) {
-    left: 0px;
-    width: 16.25px;
-    height: 18px;
-    transform: rotate(-90deg) translateX(-13px) scale(0.8);
-    transform-origin: 0% 0%;
-    -webkit-mask-image: url(Images/toolbarButtonGlyphs.png);
-    -webkit-mask-position: -201px -27px;
-    -webkit-mask-size: 352px 168px;
-    background-color: white;
+    left: 0;
     cursor: pointer;
 }
 
-@media (-webkit-min-device-pixel-ratio: 1.1) {
-.elements-disclosure li.selected .gutter-container:not(.has-decorations) {
-    -webkit-mask-image: url(Images/toolbarButtonGlyphs_2x.png);
+.gutter-menu-icon {
+    display: none;
+    transform: rotate(-90deg) scale(0.8);
+    background-color: white;
+    position: relative;
+    left: -7px;
+    top: -3px;
 }
-} /* media */
+
+.elements-disclosure li.selected .gutter-container:not(.has-decorations) .gutter-menu-icon {
+    display: block;
+}
 
 /** Guide line */
 li.selected {
diff --git a/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js b/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js
index 156a1ca..e947a4dbd 100644
--- a/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js
+++ b/third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js
@@ -80,7 +80,9 @@
   CommandEvaluatedInConsolePanel: 15,
   DOMPropertiesExpanded: 16,
   ResizedViewInResponsiveMode: 17,
-  TimelinePageReloadStarted: 18
+  TimelinePageReloadStarted: 18,
+  ConnectToNodeJSFromFrontend: 19,
+  ConnectToNodeJSDirectly: 20,
 };
 
 Host.UserMetrics._PanelCodes = {
diff --git a/third_party/WebKit/Source/devtools/front_end/quick_open/FilteredListWidget.js b/third_party/WebKit/Source/devtools/front_end/quick_open/FilteredListWidget.js
index 7b9266ec6..d1f59e3d 100644
--- a/third_party/WebKit/Source/devtools/front_end/quick_open/FilteredListWidget.js
+++ b/third_party/WebKit/Source/devtools/front_end/quick_open/FilteredListWidget.js
@@ -119,7 +119,7 @@
   showAsDialog() {
     this._dialog = new UI.Dialog();
     this._dialog.setWrapsContent(true);
-    this._dialog.setPosition(undefined, 22);
+    this._dialog.setPosition(null, 22);
     this.show(this._dialog.element);
     this._dialog.show();
     this._updateShowMatchingItems();
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
index 992546e..ad7ae10 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/TargetManager.js
@@ -331,6 +331,7 @@
           this, Common.UIString('Node'), SDK.Target.Capability.Target, this._createMainConnection.bind(this), null);
       target.subTargetsManager = new SDK.SubTargetsManager(target);
       target.setInspectedURL('Node');
+      Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSFromFrontend);
       return;
     }
 
@@ -341,6 +342,7 @@
           SDK.Target.Capability.Target;
     } else if (Runtime.queryParam('v8only')) {
       capabilities = SDK.Target.Capability.JS;
+      Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirectly);
     }
 
     var target = this.createTarget(Common.UIString('Main'), capabilities, this._createMainConnection.bind(this), null);
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
index f4379fb..9fa8219f 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Dialog.js
@@ -39,11 +39,16 @@
 
     this.contentElement.createChild('content');
     this.contentElement.tabIndex = 0;
-    this.contentElement.addEventListener('focus', this._onFocus.bind(this), false);
-    this._keyDownBound = this._onKeyDown.bind(this);
-
-    this._wrapsContent = false;
+    this.contentElement.addEventListener('focus', this.focus.bind(this), false);
+    this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this), false);
     this._dimmed = false;
+    this._wrapsContent = false;
+    this._maxSize = null;
+    /** @type {?number} */
+    this._positionX = null;
+    /** @type {?number} */
+    this._positionY = null;
+
     /** @type {!Map<!HTMLElement, number>} */
     this._tabIndexMap = new Map();
   }
@@ -56,44 +61,25 @@
   }
 
   /**
-   * @param {!UI.Widget} view
-   */
-  static setModalHostView(view) {
-    UI.Dialog._modalHostView = view;
-  }
-
-  /**
-   * FIXME: make utility method in Dialog, so clients use it instead of this getter.
-   * Method should be like Dialog.showModalElement(position params, reposition callback).
-   * @return {?UI.Widget}
-   */
-  static modalHostView() {
-    return UI.Dialog._modalHostView;
-  }
-
-  static modalHostRepositioned() {
-    if (UI.Dialog._instance)
-      UI.Dialog._instance._position();
-  }
-
-  /**
    * @override
+   * @suppressGlobalPropertiesCheck
+   * TODO(dgozman): pass document in constructor.
    */
   show() {
     if (UI.Dialog._instance)
       UI.Dialog._instance.detach();
     UI.Dialog._instance = this;
 
-    var document = /** @type {!Document} */ (UI.Dialog._modalHostView.element.ownerDocument);
     this._disableTabIndexOnElements(document);
 
-    this._glassPane = new UI.GlassPane(document, this._dimmed);
-    this._glassPane.element.addEventListener('click', this._onGlassPaneClick.bind(this), false);
-    this.element.ownerDocument.body.addEventListener('keydown', this._keyDownBound, false);
-
-    super.show(this._glassPane.element);
-
-    this._position();
+    this._glassPane = new UI.GlassPane(document, this._dimmed, true /* blockPointerEvents*/, event => {
+      this.detach();
+      event.consume(true);
+    });
+    this._glassPane.show();
+    super.show(this._glassPane.contentElement);
+    this._glassPane.setContentPosition(this._positionX, this._positionY);
+    this._glassPane.setMaxContentSize(this._effectiveMaxSize());
     this._focusRestorer = new UI.WidgetFocusRestorer(this);
   }
 
@@ -103,10 +89,8 @@
   detach() {
     this._focusRestorer.restore();
 
-    this.element.ownerDocument.body.removeEventListener('keydown', this._keyDownBound, false);
     super.detach();
-
-    this._glassPane.dispose();
+    this._glassPane.hide();
     delete this._glassPane;
 
     this._restoreTabIndexOnElements();
@@ -121,12 +105,12 @@
   }
 
   /**
-   * @param {number=} positionX
-   * @param {number=} positionY
+   * @param {?number} positionX
+   * @param {?number} positionY
    */
   setPosition(positionX, positionY) {
-    this._defaultPositionX = positionX;
-    this._defaultPositionY = positionY;
+    this._positionX = positionX;
+    this._positionY = positionY;
   }
 
   /**
@@ -137,11 +121,20 @@
   }
 
   /**
+   * @return {?UI.Size}
+   */
+  _effectiveMaxSize() {
+    if (!this._wrapsContent)
+      return this._maxSize;
+    return new UI.Size(this.contentElement.offsetWidth, this.contentElement.offsetHeight).clipTo(this._maxSize);
+  }
+
+  /**
    * @param {boolean} wraps
    */
   setWrapsContent(wraps) {
-    this.element.classList.toggle('wraps-content', wraps);
     this._wrapsContent = wraps;
+    this.element.classList.toggle('wraps-content', wraps);
   }
 
   /**
@@ -152,8 +145,9 @@
   }
 
   contentResized() {
-    if (this._wrapsContent)
-      this._position();
+    if (!this._wrapsContent || !this._glassPane)
+      return;
+    this._glassPane.setMaxContentSize(this._effectiveMaxSize());
   }
 
   /**
@@ -182,58 +176,6 @@
   /**
    * @param {!Event} event
    */
-  _onFocus(event) {
-    this.focus();
-  }
-
-  /**
-   * @param {!Event} event
-   */
-  _onGlassPaneClick(event) {
-    if (!this.element.isSelfOrAncestor(/** @type {?Node} */ (event.target)))
-      this.detach();
-  }
-
-  _position() {
-    var container = UI.Dialog._modalHostView.element;
-
-    var width = container.offsetWidth - 10;
-    var height = container.offsetHeight - 10;
-
-    if (this._wrapsContent) {
-      width = Math.min(width, this.contentElement.offsetWidth);
-      height = Math.min(height, this.contentElement.offsetHeight);
-    }
-
-    if (this._maxSize) {
-      width = Math.min(width, this._maxSize.width);
-      height = Math.min(height, this._maxSize.height);
-    }
-
-    var positionX;
-    if (typeof this._defaultPositionX === 'number') {
-      positionX = this._defaultPositionX;
-    } else {
-      positionX = (container.offsetWidth - width) / 2;
-      positionX = Number.constrain(positionX, 0, container.offsetWidth - width);
-    }
-
-    var positionY;
-    if (typeof this._defaultPositionY === 'number') {
-      positionY = this._defaultPositionY;
-    } else {
-      positionY = (container.offsetHeight - height) / 2;
-      positionY = Number.constrain(positionY, 0, container.offsetHeight - height);
-    }
-
-    this.element.style.width = width + 'px';
-    this.element.style.height = height + 'px';
-    this.element.positionAt(positionX, positionY, container);
-  }
-
-  /**
-   * @param {!Event} event
-   */
   _onKeyDown(event) {
     if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) {
       event.consume(true);
@@ -241,10 +183,3 @@
     }
   }
 };
-
-
-/** @type {?Element} */
-UI.Dialog._previousFocusedElement = null;
-
-/** @type {?UI.Widget} */
-UI.Dialog._modalHostView = null;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Geometry.js b/third_party/WebKit/Source/devtools/front_end/ui/Geometry.js
index f6e0f5b..d4e94f94 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Geometry.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Geometry.js
@@ -346,6 +346,16 @@
     this.width = width;
     this.height = height;
   }
+
+  /**
+   * @param {?UI.Size} size
+   * @return {!UI.Size}
+   */
+  clipTo(size) {
+    if (!size)
+      return this;
+    return new UI.Size(Math.min(this.width, size.width), Math.min(this.height, size.height));
+  }
 };
 
 /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
new file mode 100644
index 0000000..835b6af
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/front_end/ui/GlassPane.js
@@ -0,0 +1,208 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+UI.GlassPane = class {
+  /**
+   * @param {!Document} document
+   * @param {boolean} dimmed
+   * @param {boolean} blockPointerEvents
+   * @param {function(!Event)} onClickOutside
+   */
+  constructor(document, dimmed, blockPointerEvents, onClickOutside) {
+    this._element = createElementWithClass('div', 'glass-pane');
+    this._element.style.backgroundColor = dimmed ? 'rgba(255, 255, 255, 0.5)' : 'transparent';
+    if (!blockPointerEvents)
+      this._element.style.pointerEvents = 'none';
+    this._onMouseDown = event => {
+      if (!this.contentElement.isSelfOrAncestor(/** @type {?Node} */ (event.target)))
+        onClickOutside.call(null, event);
+    };
+
+    this.contentElement = this._element.createChild('div', 'glass-pane-content');
+    this._document = document;
+    this._visible = false;
+    /** @type {?UI.Size} */
+    this._maxSize = null;
+    /** @type {?number} */
+    this._positionX = null;
+    /** @type {?number} */
+    this._positionY = null;
+    /** @type {?AnchorBox} */
+    this._anchorBox = null;
+    this._anchorBehavior = UI.GlassPane.AnchorBehavior.PreferTop;
+  }
+
+  /**
+   * @param {?UI.Size} size
+   */
+  setMaxContentSize(size) {
+    this._maxSize = size;
+    this._positionContent();
+  }
+
+  /**
+   * @param {?number} x
+   * @param {?number} y
+   * Position is relative to root element.
+   */
+  setContentPosition(x, y) {
+    this._positionX = x;
+    this._positionY = y;
+    this._positionContent();
+  }
+
+  /**
+   * @param {?AnchorBox} anchorBox
+   * Anchor box is relative to the document.
+   */
+  setContentAnchorBox(anchorBox) {
+    this._anchorBox = anchorBox;
+    this._positionContent();
+  }
+
+  /**
+   * @param {!UI.GlassPane.AnchorBehavior} behavior
+   */
+  setAnchorBehavior(behavior) {
+    this._anchorBehavior = behavior;
+  }
+
+  show() {
+    if (this._visible)
+      return;
+    this._visible = true;
+    // Deliberately starts with 3000 to hide other z-indexed elements below.
+    this._element.style.zIndex = 3000 + 1000 * UI.GlassPane._panes.size;
+    this._document.body.appendChild(this._element);
+    this._document.body.addEventListener('mousedown', this._onMouseDown, true);
+    UI.GlassPane._panes.add(this);
+  }
+
+  hide() {
+    if (!this._visible)
+      return;
+    UI.GlassPane._panes.delete(this);
+    this._document.body.removeEventListener('mousedown', this._onMouseDown, true);
+    this._document.body.removeChild(this._element);
+    this._visible = false;
+  }
+
+  /**
+   * @return {boolean}
+   */
+  visible() {
+    return this._visible;
+  }
+
+  _positionContent() {
+    if (!this._visible)
+      return;
+
+    var gutterSize = 5;
+    var container = UI.GlassPane._containers.get(this._document);
+    var containerWidth = container.offsetWidth;
+    var containerHeight = container.offsetHeight;
+
+    var width = containerWidth - gutterSize * 2;
+    var height = containerHeight - gutterSize * 2;
+    var positionX = gutterSize;
+    var positionY = gutterSize;
+
+    if (this._maxSize) {
+      width = Math.min(width, this._maxSize.width);
+      height = Math.min(height, this._maxSize.height);
+    }
+
+    if (this._anchorBox) {
+      var anchorBox = this._anchorBox.relativeToElement(container);
+      var behavior = this._anchorBehavior;
+
+      if (behavior === UI.GlassPane.AnchorBehavior.PreferTop || behavior === UI.GlassPane.AnchorBehavior.PreferBottom) {
+        var top = anchorBox.y - gutterSize;
+        var bottom = containerHeight - anchorBox.y - anchorBox.height - gutterSize;
+        if (behavior === UI.GlassPane.AnchorBehavior.PreferTop && top < height && bottom >= height)
+          behavior = UI.GlassPane.AnchorBehavior.PreferBottom;
+        if (behavior === UI.GlassPane.AnchorBehavior.PreferBottom && bottom < height && top >= height)
+          behavior = UI.GlassPane.AnchorBehavior.PreferTop;
+
+        positionX = Math.max(gutterSize, Math.min(anchorBox.x, containerWidth - width - gutterSize));
+        width = Math.min(width, containerWidth - positionX - gutterSize);
+        if (behavior === UI.GlassPane.AnchorBehavior.PreferTop) {
+          positionY = Math.max(gutterSize, anchorBox.y - height);
+          height = Math.min(height, anchorBox.y - positionY);
+        } else {
+          positionY = anchorBox.y + anchorBox.height;
+          height = Math.min(height, containerHeight - positionY - gutterSize);
+        }
+      } else {
+        var left = anchorBox.x - gutterSize;
+        var right = containerWidth - anchorBox.x - anchorBox.width - gutterSize;
+        if (behavior === UI.GlassPane.AnchorBehavior.PreferLeft && left < width && right >= width)
+          behavior = UI.GlassPane.AnchorBehavior.PreferRight;
+        if (behavior === UI.GlassPane.AnchorBehavior.PreferRight && right < width && left >= width)
+          behavior = UI.GlassPane.AnchorBehavior.PreferLeft;
+
+        positionY = Math.max(gutterSize, Math.min(anchorBox.y, containerHeight - height - gutterSize));
+        height = Math.min(height, containerHeight - positionY - gutterSize);
+        if (behavior === UI.GlassPane.AnchorBehavior.PreferLeft) {
+          positionX = Math.max(gutterSize, anchorBox.x - width);
+          width = Math.min(width, anchorBox.x - positionX);
+        } else {
+          positionX = anchorBox.x + anchorBox.width;
+          width = Math.min(width, containerWidth - positionX - gutterSize);
+        }
+      }
+    } else {
+      positionX = this._positionX !== null ? this._positionX : (containerWidth - width) / 2;
+      positionY = this._positionY !== null ? this._positionY : (containerHeight - height) / 2;
+      width = Math.min(width, containerWidth - positionX - gutterSize);
+      height = Math.min(height, containerHeight - positionY - gutterSize);
+    }
+
+    this.contentElement.style.width = width + 'px';
+    this.contentElement.style.height = height + 'px';
+    this.contentElement.positionAt(positionX, positionY, container);
+  }
+
+  /**
+   * @param {!Element} element
+   */
+  static setContainer(element) {
+    UI.GlassPane._containers.set(/** @type {!Document} */ (element.ownerDocument), element);
+    UI.GlassPane.containerMoved(element);
+  }
+
+  /**
+   * @param {!Document} document
+   * @return {!Element}
+   */
+  static container(document) {
+    return UI.GlassPane._containers.get(document);
+  }
+
+  /**
+   * @param {!Element} element
+   */
+  static containerMoved(element) {
+    for (var pane of UI.GlassPane._panes) {
+      if (pane._document === element.ownerDocument)
+        pane._positionContent();
+    }
+  }
+};
+
+/**
+ * @enum {symbol}
+ */
+UI.GlassPane.AnchorBehavior = {
+  PreferTop: Symbol('PreferTop'),
+  PreferBottom: Symbol('PreferBottom'),
+  PreferLeft: Symbol('PreferLeft'),
+  PreferRight: Symbol('PreferRight'),
+};
+
+/** @type {!Map<!Document, !Element>} */
+UI.GlassPane._containers = new Map();
+/** @type {!Set<!UI.GlassPane>} */
+UI.GlassPane._panes = new Set();
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/InspectorView.js b/third_party/WebKit/Source/devtools/front_end/ui/InspectorView.js
index c964632..1b989e9 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/InspectorView.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/InspectorView.js
@@ -34,7 +34,7 @@
 UI.InspectorView = class extends UI.VBox {
   constructor() {
     super();
-    UI.Dialog.setModalHostView(this);
+    UI.GlassPane.setContainer(this.element);
     this.setMinimumSize(240, 72);
 
     // DevTools sidebar is a vertical split of panels tabbed pane and a drawer.
@@ -268,7 +268,7 @@
    * @override
    */
   onResize() {
-    UI.Dialog.modalHostRepositioned();
+    UI.GlassPane.containerMoved(this.element);
   }
 
   /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Popover.js b/third_party/WebKit/Source/devtools/front_end/ui/Popover.js
index 7953b7a..375a9c0d1 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Popover.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Popover.js
@@ -165,7 +165,7 @@
     // Skinny tooltips are not pretty, their arrow location is not nice.
     preferredWidth = Math.max(preferredWidth, 50);
     // Position relative to main DevTools element.
-    const container = UI.Dialog.modalHostView().element;
+    const container = UI.GlassPane.container(/** @type {!Document} */ (this._containerElement.ownerDocument));
     const totalWidth = container.offsetWidth;
     const totalHeight = container.offsetHeight;
 
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
index 2081f99..ed7e23c 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js
@@ -82,8 +82,9 @@
     }
 
     // Re-position menu in case it does not fit.
-    var hostLeft = UI.Dialog.modalHostView().element.totalOffsetLeft();
-    var hostRight = hostLeft + UI.Dialog.modalHostView().element.offsetWidth;
+    var containerElement = UI.GlassPane.container(document);
+    var hostLeft = containerElement.totalOffsetLeft();
+    var hostRight = hostLeft + containerElement.offsetWidth;
     if (hostRight < this.element.offsetLeft + this.element.offsetWidth) {
       var left = this._parentMenu ? this._parentMenu.element.offsetLeft - this.element.offsetWidth + subMenuOverlap :
                                     hostRight - this.element.offsetWidth;
@@ -92,13 +93,12 @@
 
     // Move submenus upwards if it does not fit.
     if (this._parentMenu && document.body.offsetHeight < this.element.offsetTop + this.element.offsetHeight) {
-      y = Math.max(
-          UI.Dialog.modalHostView().element.totalOffsetTop(), document.body.offsetHeight - this.element.offsetHeight);
+      y = Math.max(containerElement.totalOffsetTop(), document.body.offsetHeight - this.element.offsetHeight);
       this.element.style.top = y + 'px';
     }
 
-    var maxHeight = UI.Dialog.modalHostView().element.offsetHeight;
-    maxHeight -= y - UI.Dialog.modalHostView().element.totalOffsetTop();
+    var maxHeight = containerElement.offsetHeight;
+    maxHeight -= y - containerElement.totalOffsetTop();
     this.element.style.maxHeight = maxHeight + 'px';
 
     this._focus();
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
index 33cd18b..9c5a8ba 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/SuggestBox.js
@@ -53,97 +53,64 @@
    * @param {!UI.SuggestBoxDelegate} suggestBoxDelegate
    * @param {number=} maxItemsHeight
    * @param {boolean=} captureEnter
+   * @suppressGlobalPropertiesCheck
    */
   constructor(suggestBoxDelegate, maxItemsHeight, captureEnter) {
     this._suggestBoxDelegate = suggestBoxDelegate;
     this._maxItemsHeight = maxItemsHeight;
-    this._maybeHideBound = this._maybeHide.bind(this);
-    this._hideBound = this.hide.bind(this);
-    this._container = createElementWithClass('div', 'suggest-box-container');
+    this._captureEnter = captureEnter;
     this._rowHeight = 17;
+    this._userInteracted = false;
+    this._userEnteredText = '';
+    /** @type {?string} */
+    this._onlyCompletion = null;
+
     /** @type {!UI.ListControl<!UI.SuggestBox.Suggestion>} */
     this._list = new UI.ListControl(this, UI.ListMode.EqualHeightItems);
     this._element = this._list.element;
     this._element.classList.add('suggest-box');
-    this._container.appendChild(this._element);
-    this._element.addEventListener('mousedown', this._onBoxMouseDown.bind(this), true);
-    this._userInteracted = false;
-    this._captureEnter = captureEnter;
-    this._hasVerticalScroll = false;
-    this._userEnteredText = '';
+    this._element.addEventListener('mousedown', event => event.preventDefault(), true);
 
-    /** @type {?UI.SuggestBox.Overlay} */
-    this._overlay = null;
-    /** @type {?AnchorBox} */
-    this._lastAnchorBox = null;
-    this._lastItemCount = 0;
-    this._hideTimeoutId = 0;
-    /** @type {?Element} */
-    this._bodyElement = null;
-    /** @type {?string} */
-    this._onlyCompletion = null;
+    // TODO(dgozman): take document in constructor.
+    this._glassPane =
+        new UI.GlassPane(document, false /* dimmed */, false /* blockPointerEvents */, this.hide.bind(this));
+    this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom);
+    var shadowRoot = UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'ui/suggestBox.css');
+    shadowRoot.appendChild(this._element);
   }
 
   /**
    * @return {boolean}
    */
   visible() {
-    return !!this._container.parentElement;
+    return this._glassPane.visible();
   }
 
   /**
    * @param {!AnchorBox} anchorBox
    */
   setPosition(anchorBox) {
-    this._updateBoxPosition(anchorBox, this._list.length());
-  }
-
-  /**
-   * @param {!AnchorBox} anchorBox
-   * @param {number} length
-   */
-  _updateBoxPosition(anchorBox, length) {
-    console.assert(this._overlay);
-    if (this._lastAnchorBox && this._lastAnchorBox.equals(anchorBox) && this._lastItemCount === length)
-      return;
-    this._lastItemCount = length;
-    this._lastAnchorBox = anchorBox;
-
-    // Position relative to main DevTools element.
-    var container = UI.Dialog.modalHostView().element;
-    anchorBox = anchorBox.relativeToElement(container);
-    var totalHeight = container.offsetHeight;
-    var aboveHeight = anchorBox.y;
-    var underHeight = totalHeight - anchorBox.y - anchorBox.height;
-
-    this._overlay.setLeftOffset(anchorBox.x);
-
-    var under = underHeight >= aboveHeight;
-    if (under)
-      this._overlay.setVerticalOffset(anchorBox.y + anchorBox.height, true);
-    else
-      this._overlay.setVerticalOffset(totalHeight - anchorBox.y, false);
-
-    var spacer = 6;
-    var maxHeight = Math.min(
-        Math.max(underHeight, aboveHeight) - spacer,
-        this._maxItemsHeight ? this._maxItemsHeight * this._rowHeight : Infinity);
-    var height = this._rowHeight * length;
-    this._hasVerticalScroll = height > maxHeight;
-    this._element.style.height = Math.min(maxHeight, height) + 'px';
+    this._glassPane.setContentAnchorBox(anchorBox);
   }
 
   /**
    * @param {!UI.SuggestBox.Suggestions} items
    */
-  _updateWidth(items) {
-    if (this._hasVerticalScroll) {
-      this._element.style.width = '100vw';
-      return;
-    }
+  _updateMaxSize(items) {
+    var maxWidth = this._maxWidth(items);
+    var length = this._maxItemsHeight ? Math.min(this._maxItemsHeight, items.length) : items.length;
+    var maxHeight = length * this._rowHeight;
+    this._glassPane.setMaxContentSize(new UI.Size(maxWidth, maxHeight));
+  }
+
+  /**
+   * @param {!UI.SuggestBox.Suggestions} items
+   * @return {number}
+   */
+  _maxWidth(items) {
+    var kMaxWidth = 300;
     if (!items.length)
-      return;
-    // If there are no scrollbars, set the width to the width of the largest row.
+      return kMaxWidth;
     var maxItem;
     var maxLength = -Infinity;
     for (var i = 0; i < items.length; i++) {
@@ -153,41 +120,14 @@
         maxItem = items[i];
       }
     }
-    this._element.style.width =
-        UI.measurePreferredSize(
-              this.createElementForItem(/** @type {!UI.SuggestBox.Suggestion} */ (maxItem)), this._element)
-            .width +
-        'px';
+    var element = this.createElementForItem(/** @type {!UI.SuggestBox.Suggestion} */ (maxItem));
+    return Math.min(kMaxWidth, UI.measurePreferredSize(element, this._element).width);
   }
 
-  /**
-   * @param {!Event} event
-   */
-  _onBoxMouseDown(event) {
-    if (this._hideTimeoutId) {
-      window.clearTimeout(this._hideTimeoutId);
-      this._hideTimeoutId = 0;
-    }
-    event.preventDefault();
-  }
-
-  _maybeHide() {
-    if (!this._hideTimeoutId)
-      this._hideTimeoutId = window.setTimeout(this._hideBound, 0);
-  }
-
-  /**
-   * // FIXME: make SuggestBox work for multiple documents.
-   * @suppressGlobalPropertiesCheck
-   */
   _show() {
     if (this.visible())
       return;
-    this._bodyElement = document.body;
-    this._bodyElement.addEventListener('mousedown', this._maybeHideBound, true);
-    this._element.ownerDocument.defaultView.addEventListener('resize', this._hideBound, false);
-    this._overlay = new UI.SuggestBox.Overlay();
-    this._overlay.setContentElement(this._container);
+    this._glassPane.show();
     this._rowHeight =
         UI.measurePreferredSize(this.createElementForItem({title: '1', subtitle: '12'}), this._element).height;
   }
@@ -195,15 +135,8 @@
   hide() {
     if (!this.visible())
       return;
-
     this._userInteracted = false;
-    this._bodyElement.removeEventListener('mousedown', this._maybeHideBound, true);
-    this._element.ownerDocument.defaultView.removeEventListener('resize', this._hideBound, false);
-    this._bodyElement = null;
-    this._container.remove();
-    this._overlay.dispose();
-    this._overlay = null;
-    this._lastAnchorBox = null;
+    this._glassPane.hide();
   }
 
   /**
@@ -349,8 +282,8 @@
       this._userEnteredText = userEnteredText;
 
       this._show();
-      this._updateBoxPosition(anchorBox, completions.length);
-      this._updateWidth(completions);
+      this._updateMaxSize(completions);
+      this._glassPane.setContentAnchorBox(anchorBox);
       this._list.invalidateItemHeight();
       this._list.replaceAllItems(completions);
 
@@ -431,64 +364,3 @@
  * @typedef {!Array<!UI.SuggestBox.Suggestion>}
  */
 UI.SuggestBox.Suggestions;
-
-UI.SuggestBox.Overlay = class {
-  /**
-   * // FIXME: make SuggestBox work for multiple documents.
-   * @suppressGlobalPropertiesCheck
-   */
-  constructor() {
-    this.element = createElementWithClass('div', 'suggest-box-overlay');
-    var root = UI.createShadowRootWithCoreStyles(this.element, 'ui/suggestBox.css');
-    this._leftSpacerElement = root.createChild('div', 'suggest-box-left-spacer');
-    this._horizontalElement = root.createChild('div', 'suggest-box-horizontal');
-    this._topSpacerElement = this._horizontalElement.createChild('div', 'suggest-box-top-spacer');
-    this._bottomSpacerElement = this._horizontalElement.createChild('div', 'suggest-box-bottom-spacer');
-    this._resize();
-    document.body.appendChild(this.element);
-  }
-
-  /**
-   * @param {number} offset
-   */
-  setLeftOffset(offset) {
-    this._leftSpacerElement.style.flexBasis = offset + 'px';
-  }
-
-  /**
-   * @param {number} offset
-   * @param {boolean} isTopOffset
-   */
-  setVerticalOffset(offset, isTopOffset) {
-    this.element.classList.toggle('under-anchor', isTopOffset);
-
-    if (isTopOffset) {
-      this._bottomSpacerElement.style.flexBasis = 'auto';
-      this._topSpacerElement.style.flexBasis = offset + 'px';
-    } else {
-      this._bottomSpacerElement.style.flexBasis = offset + 'px';
-      this._topSpacerElement.style.flexBasis = 'auto';
-    }
-  }
-
-  /**
-   * @param {!Element} element
-   */
-  setContentElement(element) {
-    this._horizontalElement.insertBefore(element, this._bottomSpacerElement);
-  }
-
-  _resize() {
-    var container = UI.Dialog.modalHostView().element;
-    var containerBox = container.boxInWindow(container.ownerDocument.defaultView);
-
-    this.element.style.left = containerBox.x + 'px';
-    this.element.style.top = containerBox.y + 'px';
-    this.element.style.height = containerBox.height + 'px';
-    this.element.style.width = containerBox.width + 'px';
-  }
-
-  dispose() {
-    this.element.remove();
-  }
-};
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index 80c23c5..121478bf 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -123,8 +123,9 @@
       var document = button.element.ownerDocument;
       document.documentElement.addEventListener('mouseup', mouseUp, false);
 
-      var optionsGlassPane = new UI.GlassPane(document);
-      var optionsBar = new UI.Toolbar('fill', optionsGlassPane.element);
+      var optionsGlassPane = new UI.GlassPane(document, false /* dimmed */, true /* blockPointerEvents */, event => {});
+      optionsGlassPane.show();
+      var optionsBar = new UI.Toolbar('fill', optionsGlassPane.contentElement);
       optionsBar._contentElement.classList.add('floating');
       const buttonHeight = 26;
 
@@ -167,7 +168,7 @@
       function mouseUp(e) {
         if (e.which !== 1)
           return;
-        optionsGlassPane.dispose();
+        optionsGlassPane.hide();
         document.documentElement.removeEventListener('mouseup', mouseUp, false);
 
         for (var i = 0; i < buttons.length; ++i) {
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Tooltip.js b/third_party/WebKit/Source/devtools/front_end/ui/Tooltip.js
index 9b8d07d1..165d2b54 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Tooltip.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Tooltip.js
@@ -113,7 +113,7 @@
     this._tooltipLastOpened = instant ? now : now + UI.Tooltip.Timing.OpeningDelay;
 
     // Get container element.
-    var container = UI.Dialog.modalHostView().element;
+    var container = UI.GlassPane.container(/** @type {!Document} */ (anchorElement.ownerDocument));
     // Position tooltip based on the anchor element.
     var containerBox = container.boxInWindow(this.element.window());
     var anchorBox = this._anchorElement.boxInWindow(this.element.window());
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
index 1e79d22..02e9c83 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -94,8 +94,11 @@
 
   _createGlassPane() {
     this._glassPaneInUse = true;
-    if (!UI.DragHandler._glassPaneUsageCount++)
-      UI.DragHandler._glassPane = new UI.GlassPane(UI.DragHandler._documentForMouseOut);
+    if (!UI.DragHandler._glassPaneUsageCount++) {
+      UI.DragHandler._glassPane = new UI.GlassPane(
+          UI.DragHandler._documentForMouseOut, false /* dimmed */, true /* blockPointerEvents */, event => {});
+      UI.DragHandler._glassPane.show();
+    }
   }
 
   _disposeGlassPane() {
@@ -104,7 +107,7 @@
     this._glassPaneInUse = false;
     if (--UI.DragHandler._glassPaneUsageCount)
       return;
-    UI.DragHandler._glassPane.dispose();
+    UI.DragHandler._glassPane.hide();
     delete UI.DragHandler._glassPane;
     delete UI.DragHandler._documentForMouseOut;
   }
@@ -299,35 +302,6 @@
 };
 
 /**
- * @unrestricted
- */
-UI.GlassPane = class {
-  /**
-   * @param {!Document} document
-   * @param {boolean=} dimmed
-   */
-  constructor(document, dimmed) {
-    this.element = createElement('div');
-    var background = dimmed ? 'rgba(255, 255, 255, 0.5)' : 'transparent';
-    this._zIndex = UI._glassPane ? UI._glassPane._zIndex + 1000 :
-                                   3000;  // Deliberately starts with 3000 to hide other z-indexed elements below.
-    this.element.style.cssText = 'position:absolute;top:0;bottom:0;left:0;right:0;background-color:' + background +
-        ';z-index:' + this._zIndex + ';overflow:hidden;';
-    document.body.appendChild(this.element);
-    UI._glassPane = this;
-    // TODO(dgozman): disallow focus outside of glass pane?
-  }
-
-  dispose() {
-    delete UI._glassPane;
-    this.element.remove();
-  }
-};
-
-/** @type {!UI.GlassPane|undefined} */
-UI._glassPane;
-
-/**
  * @param {?Node=} node
  * @return {boolean}
  */
@@ -1217,6 +1191,7 @@
   var body = /** @type {!Element} */ (document.body);
   UI.appendStyle(body, 'ui/inspectorStyle.css');
   UI.appendStyle(body, 'ui/popover.css');
+  UI.GlassPane.setContainer(/** @type {!Element} */ (document.body));
 };
 
 /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/checkboxTextLabel.css b/third_party/WebKit/Source/devtools/front_end/ui/checkboxTextLabel.css
index 47e91dd..fe58a0a 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/checkboxTextLabel.css
+++ b/third_party/WebKit/Source/devtools/front_end/ui/checkboxTextLabel.css
@@ -47,14 +47,14 @@
 }
 
 input.dt-checkbox-themed:after {
-    -webkit-mask-image: url(Images/toolbarButtonGlyphs.png);
-    -webkit-mask-size: 352px 168px;
-    -webkit-mask-position: -128px -110px;
+    -webkit-mask-image: url(Images/checkboxCheckmark.png);
+    -webkit-mask-size: 11px 11px;
+    -webkit-mask-position: 0 0;
 }
 
 @media (-webkit-min-device-pixel-ratio: 1.1) {
 input.dt-checkbox-themed:after {
-    -webkit-mask-image: url(Images/toolbarButtonGlyphs_2x.png);
+    -webkit-mask-image: url(Images/checkboxCheckmark_2x.png);
 }
 
 } /* media */
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/dialog.css b/third_party/WebKit/Source/devtools/front_end/ui/dialog.css
index 7a3df44..730596e 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/dialog.css
+++ b/third_party/WebKit/Source/devtools/front_end/ui/dialog.css
@@ -5,10 +5,7 @@
  */
 
 :host {
-    position: absolute;
-    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2),
-                0 2px 4px rgba(0, 0, 0, 0.2),
-                0 2px 6px rgba(0, 0, 0, 0.1);
+    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2), 0 2px 4px rgba(0, 0, 0, 0.2), 0 2px 6px rgba(0, 0, 0, 0.1);
     background: white;
     justify-content: flex-start;
     align-items: stretch;
@@ -22,14 +19,12 @@
 }
 
 :host-context(.wraps-content) {
-    justify-content: center;
     align-items: flex-start;
     overflow: hidden;
 }
 
 :host-context(.wraps-content) .widget {
     flex: none !important;
-    justify-content: center;
     align-items: center;
 }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/inspectorCommon.css b/third_party/WebKit/Source/devtools/front_end/ui/inspectorCommon.css
index d475f15c..e233db7 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/inspectorCommon.css
+++ b/third_party/WebKit/Source/devtools/front_end/ui/inspectorCommon.css
@@ -386,4 +386,17 @@
     background-size: unset;
     background: unset;
     background-color: white;
-}
\ No newline at end of file
+}
+
+.glass-pane {
+    position: absolute;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    right: 0;
+    overflow: hidden;
+}
+
+.glass-pane-content {
+    display: flex;
+}
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/module.json b/third_party/WebKit/Source/devtools/front_end/ui/module.json
index e94ac589..8539bb1 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/module.json
+++ b/third_party/WebKit/Source/devtools/front_end/ui/module.json
@@ -29,6 +29,7 @@
         "KeyboardShortcut.js",
         "ListControl.js",
         "ListWidget.js",
+        "GlassPane.js",
         "Panel.js",
         "Popover.js",
         "ProgressIndicator.js",
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css b/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css
index c88cecfb..816bc72 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css
+++ b/third_party/WebKit/Source/devtools/front_end/ui/suggestBox.css
@@ -29,41 +29,12 @@
  */
 
 :host {
-    position: absolute;
-    background-color: transparent;
-    z-index: 1000;
-    pointer-events: none;
-    overflow: hidden;
     display: flex;
-    flex-direction: row;
-}
-
-.suggest-box-left-spacer {
-    flex: 0 1 auto;
-}
-
-.suggest-box-horizontal {
-    display: flex;
-    flex-direction: column;
-    flex: 0 0 auto;
-    max-width: 300px;
-}
-
-.suggest-box-top-spacer {
     flex: auto;
 }
 
-:host(.under-anchor) .suggest-box-top-spacer,
-:host(:not(.under-anchor)) .suggest-box-bottom-spacer {
-    flex: 0 0 auto;
-}
-
-.suggest-box-container {
-    display: flex;
-    flex-direction: row;
-}
-
 .suggest-box {
+    flex: auto;
     background-color: #FFFFFF;
     pointer-events: auto;
     margin-left: -3px;
@@ -73,16 +44,15 @@
     overflow-x: hidden;
 }
 
-.suggest-box .suggest-box-content-item {
-    padding: 1px;
+.suggest-box-content-item {
+    padding: 1px 0 1px 1px;
     margin: 0;
     border: 1px solid transparent;
-    padding-right: 0;
     white-space: nowrap;
     display: flex;
 }
 
-.suggest-box .suggest-box-content-item.secondary {
+.suggest-box-content-item.secondary {
     background-color: #f9f9f9;
 }
 
@@ -106,23 +76,23 @@
     flex-shrink: 0;
 }
 
-.suggest-box .suggest-box-content-item .query {
+.suggest-box-content-item .query {
     font-weight: bold;
 }
 
-.suggest-box .suggest-box-content-item .spacer {
+.suggest-box-content-item .spacer {
     display: inline-block;
     width: 20px;
 }
 
-.suggest-box .suggest-box-content-item.selected {
+.suggest-box-content-item.selected {
     background-color: rgb(56, 121, 217);
 }
 
-.suggest-box .suggest-box-content-item.selected > span {
+.suggest-box-content-item.selected > span {
     color: #FFF;
 }
 
-.suggest-box .suggest-box-content-item:hover:not(.selected) {
+.suggest-box-content-item:hover:not(.selected) {
     background-color: rgba(56, 121, 217, 0.1);
 }
diff --git a/third_party/WebKit/Source/devtools/tests/TestExpectations b/third_party/WebKit/Source/devtools/tests/TestExpectations
index e6b564ab..15e9798 100644
--- a/third_party/WebKit/Source/devtools/tests/TestExpectations
+++ b/third_party/WebKit/Source/devtools/tests/TestExpectations
@@ -43,6 +43,9 @@
 inspector/sources/debugger-async/async-await/async-pause-on-exception.html [ Skip ]
 inspector/sources/debugger-ui/async-call-stack-async-function.html [ Skip ]
 
+# Skipping b/c 1.2 content shell (DevTools runtime) does not support async await
+inspector/console/console-functions.html [ Skip ]
+
 # 1.2 content shell does not support inspector-unit
 http/tests/inspector-unit/filtered-item-selection-dialog-filtering.js [ Skip ]
 http/tests/inspector-unit/list-control-equal-height.js [ Skip ]
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/command-line-api-getEventListeners-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/command-line-api-getEventListeners-expected.txt
new file mode 100644
index 0000000..3498742
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/command-line-api-getEventListeners-expected.txt
@@ -0,0 +1,124 @@
+CONSOLE ERROR: line 26: Uncaught SyntaxError: Unexpected identifier
+Tests getEventListeners() method of console command line API.
+
+ 
+[page] - inner -
+[page] keydown: {
+[page]     0: {
+[page]         listener: function listener1() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "keydown"
+[page]         useCapture: false
+[page]     }
+[page]     1: {
+[page]         listener: function listener2() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "keydown"
+[page]         useCapture: true
+[page]     }
+[page] }
+[page] wheel: {
+[page]     0: {
+[page]         listener: function listener2() { }
+[page]         passive: true
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "wheel"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] - inner after a removal -
+[page] keydown: {
+[page]     0: {
+[page]         listener: function listener2() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "keydown"
+[page]         useCapture: true
+[page]     }
+[page] }
+[page] - outer -
+[page] keydown: {
+[page]     0: {
+[page]         listener: function listener2() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "keydown"
+[page]         useCapture: true
+[page]     }
+[page] }
+[page] keyup: {
+[page]     0: {
+[page]         listener: function listener2() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "keyup"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] mousedown: {
+[page]     0: {
+[page]         listener: function listener2() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "mousedown"
+[page]         useCapture: true
+[page]     }
+[page] }
+[page] mousemove: {
+[page]     0: {
+[page]         listener: function listener1() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "mousemove"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] - attribute event listeners -
+[page] click: {
+[page]     0: {
+[page]         listener: function onclick(event) { alert(1) }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "click"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] mouseover: {
+[page]     0: {
+[page]         listener: function onmouseover(event) { listener2() }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "mouseover"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] - window -
+[page] load: {
+[page]     0: {
+[page]         listener: function onload(event) { runTest() }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "load"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] popstate: {
+[page]     0: {
+[page]         listener: function listener1() { }
+[page]         passive: false
+[page]         remove: function remove() { [Command Line API] }
+[page]         type: "popstate"
+[page]         useCapture: false
+[page]     }
+[page] }
+[page] - empty -
+[page] - invalid -
+[page] - object -
+[page] object
+[page] - null -
+[page] object
+[page] - undefined -
+[page] object
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-big-array-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-big-array-expected.txt
new file mode 100644
index 0000000..f5ce3e2
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-big-array-expected.txt
@@ -0,0 +1,220 @@
+CONSOLE MESSAGE: line 13: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100
+CONSOLE MESSAGE: line 18: ,,,,,,,,,
+CONSOLE MESSAGE: line 24: 0,1,2,3,4,5,6,7,8,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100
+CONSOLE MESSAGE: line 29: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404
+CONSOLE MESSAGE: line 42: %O
+CONSOLE MESSAGE: line 52: %O
+CONSOLE MESSAGE: line 55: [object Uint8Array]
+Tests that console logging dumps large arrays properly.
+
+console-big-array.html:13 Array[101]
+    [0 … 19]
+        0: 0
+        1: 1
+        2: 2
+        3: 3
+        4: 4
+        5: 5
+        6: 6
+        7: 7
+        8: 8
+        9: 9
+        10: 10
+        11: 11
+        12: 12
+        13: 13
+        14: 14
+        15: 15
+        16: 16
+        17: 17
+        18: 18
+        19: 19
+    [20 … 39]
+        20: 20
+        21: 21
+        22: 22
+        23: 23
+        24: 24
+        25: 25
+        26: 26
+        27: 27
+        28: 28
+        29: 29
+        30: 30
+        31: 31
+        32: 32
+        33: 33
+        34: 34
+        35: 35
+        36: 36
+        37: 37
+        38: 38
+        39: 39
+    [40 … 100]
+        40: 40
+        41: 41
+        100: 100
+    length: 101
+    __proto__: Array[0]
+console-big-array.html:18 Array[10]
+    0: undefined
+    1: undefined
+    2: undefined
+    3: undefined
+    4: undefined
+    5: undefined
+    6: undefined
+    7: undefined
+    8: undefined
+    9: undefined
+    length: 10
+    __proto__: Array[0]
+console-big-array.html:24 Array[101]
+    0: 0
+    1: 1
+    2: 2
+    3: 3
+    4: 4
+    5: 5
+    6: 6
+    7: 7
+    8: 8
+    9: 9
+    100: 100
+    length: 101
+    __proto__: Array[0]
+console-big-array.html:29 Array[405]
+    [0 … 399]
+        [0 … 19]
+        [20 … 39]
+        [40 … 59]
+        [60 … 79]
+        [80 … 99]
+        [100 … 119]
+        [120 … 139]
+        [140 … 159]
+        [160 … 179]
+        [180 … 199]
+        [200 … 219]
+        [220 … 239]
+        [240 … 259]
+        [260 … 279]
+        [280 … 299]
+        [300 … 319]
+        [320 … 339]
+        [340 … 359]
+        [360 … 379]
+        [380 … 399]
+    [400 … 404]
+        400: 400
+        401: 401
+        402: 402
+        403: 403
+        404: 404
+    length: 405
+    __proto__: Array[0]
+console-big-array.html:42 Array[124]
+    0: 0
+    1: 1
+    2: 2
+    3: 3
+    4: 4
+    5: 5
+    6: 6
+    7: 7
+    8: 8
+    9: 9
+    123: 123
+    -Infinity: -Infinity
+    3.14: 3.14
+    4294967295: 4294967295
+    4294967296: 4294967296
+    Infinity: Infinity
+    -123: -123
+    NaN: NaN
+    length: 124
+    __proto__: Array[0]
+console-big-array.html:52 Array[4294967295]
+    [0 … 19]
+        0: 0
+        1: 1
+        2: 2
+        3: 3
+        4: 4
+        5: 5
+        6: 6
+        7: 7
+        8: 8
+        9: 9
+        10: 10
+        11: 11
+        12: 12
+        13: 13
+        14: 14
+        15: 15
+        16: 16
+        17: 17
+        18: 18
+        19: 19
+    [20 … 8388608]
+        20: 20
+        32: 32
+        64: 64
+        128: 128
+        256: 256
+        512: 512
+        1024: 1024
+        2048: 2048
+        4096: 4096
+        8192: 8192
+        16384: 16384
+        32768: 32768
+        65536: 65536
+        131072: 131072
+        262144: 262144
+        524288: 524288
+        1048576: 1048576
+        2097152: 2097152
+        4194304: 4194304
+        8388608: 8388608
+    [16777216 … 4294967294]
+        16777216: 16777216
+        33554432: 33554432
+        67108864: 67108864
+        134217728: 134217728
+        268435456: 268435456
+        536870912: 536870912
+        1073741824: 1073741824
+        2147483648: 2147483648
+        4294967294: 4294967294
+    4294967296: 4294967296
+    8589934592: 8589934592
+    length: 4294967295
+    __proto__: Array[0]
+console-big-array.html:55 Uint8Array[64160003]
+    [0 … 63999999]
+        [0 … 3199999]
+        [3200000 … 6399999]
+        [6400000 … 9599999]
+        [9600000 … 12799999]
+        [12800000 … 15999999]
+        [16000000 … 19199999]
+        [19200000 … 22399999]
+        [22400000 … 25599999]
+        [25600000 … 28799999]
+        [28800000 … 31999999]
+        [32000000 … 35199999]
+        [35200000 … 38399999]
+        [38400000 … 41599999]
+        [41600000 … 44799999]
+        [44800000 … 47999999]
+        [48000000 … 51199999]
+        [51200000 … 54399999]
+        [54400000 … 57599999]
+        [57600000 … 60799999]
+        [60800000 … 63999999]
+    [64000000 … 64160002]
+        [64000000 … 64159999]
+        [64160000 … 64160002]
+    __proto__: TypedArray
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-clear-function-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-clear-function-expected.txt
new file mode 100644
index 0000000..d2bbb2c
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-clear-function-expected.txt
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: line 10: one
+CONSOLE MESSAGE: line 11: two
+CONSOLE MESSAGE: line 12: three
+CONSOLE MESSAGE: line 19: console.clear
+Tests that console is cleared via console.clear() method
+
+Bug 101021
+=== Before clear ===
+console-clear-function.html:10 one
+console-clear-function.html:11 two
+console-clear-function.html:12 three
+=== After clear ===
+console-clear-function.html:19 Console was cleared
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-command-clear-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-command-clear-expected.txt
new file mode 100644
index 0000000..75760b6
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-command-clear-expected.txt
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: line 9: one
+CONSOLE MESSAGE: line 10: two
+CONSOLE MESSAGE: line 11: three
+CONSOLE MESSAGE: line 1: console.clear
+Tests that console is cleared upon clear() eval in console.
+
+=== Before clear ===
+console-command-clear.html:9 one
+console-command-clear.html:10 two
+console-command-clear.html:11 three
+=== After clear ===
+VM:1 Console was cleared
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-dir-es6-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-dir-es6-expected.txt
new file mode 100644
index 0000000..91045d5
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-dir-es6-expected.txt
@@ -0,0 +1,147 @@
+CONSOLE MESSAGE: line 15: [object Object]
+CONSOLE MESSAGE: line 18: Symbol()
+CONSOLE MESSAGE: line 22: [object Map]
+CONSOLE MESSAGE: line 22: [object WeakMap]
+CONSOLE MESSAGE: line 26: [object Set]
+CONSOLE MESSAGE: line 26: [object WeakSet]
+CONSOLE MESSAGE: line 34: [object Set]
+CONSOLE MESSAGE: line 37: [object WeakMap]
+CONSOLE MESSAGE: line 45: [object Map Iterator]
+CONSOLE MESSAGE: line 46: [object Map Iterator]
+CONSOLE MESSAGE: line 47: [object Map Iterator]
+CONSOLE MESSAGE: line 45: [object Set Iterator]
+CONSOLE MESSAGE: line 46: [object Set Iterator]
+CONSOLE MESSAGE: line 47: [object Set Iterator]
+CONSOLE MESSAGE: line 85: class{method(){ return 1 }},class        classWithWhitespace     {       method(){ return 1 }     },class FooClass {
+        jump(x) { return 1 }
+        badArrow(x = a => 2) { return "looooooooooooooooooooooooooooooooooooooooooooooooooooong" }
+    },jump(x) { return 1 },class BarClass extends FooClass{},class BarClass2 extends class base{} {},class BarClass3 extends function base2(a, b) {} {},_ => { return 1 },(x) => { return 1 },(x, y, z) => { return 1 },({}) => { return 1 },([]) => { return 1 },() => { return "short" },() => { return "looooooooooooooooooooooooooooooooooooooooooooooooooooong" },(...x) => { return 1 },(x, y, ...z) => { return 1 },function (...x) { return 1 },function (x, y, ...z) { return 1 },function ({a}){ return 1 },function ([a]){ return 1 },function ({a, b}){ return 1 },function (...{a}){ return 1 },function (a = (1), b){ return 1 },function (a = {x: (1)}, b){ return 1 },function (a = (x) => { return 1 }, b){ return 2 },function ({a: b}){ return 1 },function (c = ")", {a: b}){ return 1 }
+CONSOLE MESSAGE: line 93: badArrow(x = a => 2) { return "looooooooooooooooooooooooooooooooooooooooooooooooooooong" },function (a = ") {", b){ return 1 },function (a = function(){ return 1 }, b){ return 2 },function (a = class{ constructor(){} }){ return 2 }
+Tests that console logging dumps proper messages.
+
+console-dir-es6.html:15 Object
+    a: 1
+    Symbol(): 2
+    Symbol(Symbol.iterator): Symbol(foo)
+    Symbol(a): 3
+    Symbol(a): Symbol(Symbol.iterator)
+    __proto__: Object
+console-dir-es6.html:18 Symbol()
+console-dir-es6.html:22 Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Object => Object}
+        length: 1
+console-dir-es6.html:22 WeakMap
+    __proto__: WeakMap
+    [[Entries]]: Array[1]
+        0: {Object => Object}
+        length: 1
+console-dir-es6.html:26 Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-dir-es6.html:26 WeakSet
+    __proto__: WeakSet
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-dir-es6.html:34 Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: Set
+        length: 1
+console-dir-es6.html:37 WeakMap
+    __proto__: WeakMap
+    [[Entries]]: Array[0]
+        length: 0
+console-dir-es6.html:45 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "keys"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-dir-es6.html:46 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-dir-es6.html:47 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "entries"
+    [[Entries]]: Array[1]
+        0: Array[2]
+        length: 1
+console-dir-es6.html:45 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-dir-es6.html:46 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-dir-es6.html:47 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "entries"
+    [[Entries]]: Array[1]
+        0: Array[2]
+        length: 1
+console-dir-es6.html:85 Array[27]
+    0: class 
+    1: class classWithWhitespace
+    2: class FooClass
+    3: function jump(x)
+    4: class BarClass
+    5: class BarClass2
+    6: class BarClass3
+    7: _ => { return 1 }
+    8: (x) => { return 1 }
+    9: (x, y, z) => { return 1 }
+    10: ({}) => { return 1 }
+    11: ([]) => { return 1 }
+    12: () => { return "short" }
+    13: () => {…}
+    14: (...x) => { return 1 }
+    15: (x, y, ...z) => { return 1 }
+    16: function (...x)
+    17: function (x, y, ...z)
+    18: function ({a})
+    19: function ([a])
+    20: function ({a, b})
+    21: function (...{a})
+    22: function (a = (1), b)
+    23: function (a = {x: (1)}, b)
+    24: function (a = (x) => { return 1 }, b)
+    25: function ({a: b})
+    26: function (c = ")", {a: b})
+    length: 27
+    __proto__: Array[0]
+console-dir-es6.html:93 Array[4]
+    0: badArrow(x = a => {…}
+    1: function (a = ")
+    2: function (a = function()
+    3: function (a = class{ constructor()
+    length: 4
+    __proto__: Array[0]
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-edit-property-value-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-edit-property-value-expected.txt
new file mode 100644
index 0000000..73e66a1
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-edit-property-value-expected.txt
@@ -0,0 +1,14 @@
+CONSOLE MESSAGE: line 10: [object Object]
+Tests that property values can be edited inline in the console via double click.
+
+Node was hidden after dblclick: true
+Node was hidden after dblclick: true
+Node was hidden after dblclick: true
+logToConsole()
+console-edit-property-value.html:10 Object
+    a: 3
+    b: "foo"
+    c: Array[3]
+    __proto__: Object
+undefined
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-error-on-call-frame-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-error-on-call-frame-expected.txt
new file mode 100644
index 0000000..e8ba2b5
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-error-on-call-frame-expected.txt
@@ -0,0 +1,13 @@
+CONSOLE ERROR: line 1: 42
+Tests that console.error does not throw exception when executed in console on call frame.
+
+Set timer for test function.
+Script execution paused.
+Script execution resumed.
+console.error(42)
+VM:1 42
+(anonymous) @ VM:1
+evaluate
+testFunction @ console-error-on-call-frame.html:10
+undefined
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-external-array-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-external-array-expected.txt
new file mode 100644
index 0000000..aa98b649
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-external-array-expected.txt
@@ -0,0 +1,35 @@
+CONSOLE MESSAGE: line 9: [object Int8Array]
+CONSOLE MESSAGE: line 10: [object Int16Array]
+CONSOLE MESSAGE: line 11: [object Int32Array]
+CONSOLE MESSAGE: line 12: [object Uint8Array]
+CONSOLE MESSAGE: line 13: [object Uint16Array]
+CONSOLE MESSAGE: line 14: [object Uint32Array]
+CONSOLE MESSAGE: line 15: [object Float32Array]
+CONSOLE MESSAGE: line 16: [object Float64Array]
+CONSOLE MESSAGE: line 18: [object Int8Array]
+CONSOLE MESSAGE: line 19: [object Int16Array]
+CONSOLE MESSAGE: line 20: [object Int32Array]
+CONSOLE MESSAGE: line 21: [object Uint8Array]
+CONSOLE MESSAGE: line 22: [object Uint16Array]
+CONSOLE MESSAGE: line 23: [object Uint32Array]
+CONSOLE MESSAGE: line 24: [object Float32Array]
+CONSOLE MESSAGE: line 25: [object Float64Array]
+Tests that console logging detects external arrays as arrays.
+
+console-external-array.html:9 Int8Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:10 Int16Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:11 Int32Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:12 Uint8Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:13 Uint16Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:14 Uint32Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:15 Float32Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:16 Float64Array[10] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
+console-external-array.html:18 Int8Array[10]
+console-external-array.html:19 Int16Array[10]
+console-external-array.html:20 Int32Array[10]
+console-external-array.html:21 Uint8Array[10]
+console-external-array.html:22 Uint16Array[10]
+console-external-array.html:23 Uint32Array[10]
+console-external-array.html:24 Float32Array[10]
+console-external-array.html:25 Float64Array[10]
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-filter-level-test-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-filter-level-test-expected.txt
new file mode 100644
index 0000000..6c9f40c
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-filter-level-test-expected.txt
@@ -0,0 +1,100 @@
+CONSOLE INFO: line 10: sample info
+CONSOLE MESSAGE: line 11: sample log
+CONSOLE WARNING: line 12: sample warning
+CONSOLE DEBUG: line 13: sample debug
+CONSOLE ERROR: line 14: sample error
+CONSOLE INFO: line 16: abc info
+CONSOLE INFO: line 17: def info
+CONSOLE WARNING: line 19: abc warn
+CONSOLE WARNING: line 20: def warn
+Tests that console can filter messages by source.
+
+
+Running: beforeFilter
+beforeFilter
+>console-filter-level-test.html:5 sample info
+>console-filter-level-test.html:6 sample log
+>console-filter-level-test.html:7 sample warning
+onload @ console-filter-level-test.html:7
+>console-filter-level-test.html:9 sample error
+onload @ console-filter-level-test.html:9
+>console-filter-level-test.html:11 abc info
+>console-filter-level-test.html:12 def info
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>console-filter-level-test.html:15 def warn
+onload @ console-filter-level-test.html:15
+>'Should be always visible'
+>"Should be always visible"
+
+Running: verbose
+>console-filter-level-test.html:5 sample info
+>console-filter-level-test.html:6 sample log
+>console-filter-level-test.html:7 sample warning
+onload @ console-filter-level-test.html:7
+>console-filter-level-test.html:8 sample debug
+>console-filter-level-test.html:9 sample error
+onload @ console-filter-level-test.html:9
+>console-filter-level-test.html:11 abc info
+>console-filter-level-test.html:12 def info
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>console-filter-level-test.html:15 def warn
+onload @ console-filter-level-test.html:15
+>'Should be always visible'
+>"Should be always visible"
+
+Running: info
+>console-filter-level-test.html:5 sample info
+>console-filter-level-test.html:6 sample log
+>console-filter-level-test.html:7 sample warning
+onload @ console-filter-level-test.html:7
+>console-filter-level-test.html:9 sample error
+onload @ console-filter-level-test.html:9
+>console-filter-level-test.html:11 abc info
+>console-filter-level-test.html:12 def info
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>console-filter-level-test.html:15 def warn
+onload @ console-filter-level-test.html:15
+>'Should be always visible'
+>"Should be always visible"
+
+Running: warning
+>console-filter-level-test.html:7 sample warning
+onload @ console-filter-level-test.html:7
+>console-filter-level-test.html:9 sample error
+onload @ console-filter-level-test.html:9
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>console-filter-level-test.html:15 def warn
+onload @ console-filter-level-test.html:15
+>'Should be always visible'
+>"Should be always visible"
+
+Running: error
+>console-filter-level-test.html:9 sample error
+onload @ console-filter-level-test.html:9
+>'Should be always visible'
+>"Should be always visible"
+
+Running: abcMessagePlain
+>console-filter-level-test.html:11 abc info
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>'Should be always visible'
+>"Should be always visible"
+
+Running: abcMessageRegex
+>console-filter-level-test.html:11 abc info
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>'Should be always visible'
+>"Should be always visible"
+
+Running: abcMessageRegexWarning
+>console-filter-level-test.html:14 abc warn
+onload @ console-filter-level-test.html:14
+>'Should be always visible'
+>"Should be always visible"
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-collections-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-collections-expected.txt
new file mode 100644
index 0000000..49e7b737
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-collections-expected.txt
@@ -0,0 +1,75 @@
+CONSOLE MESSAGE: line 15: [object HTMLCollection]
+CONSOLE MESSAGE: line 19: [object HTMLCollection]
+CONSOLE MESSAGE: line 23: [object HTMLOptionsCollection]
+CONSOLE MESSAGE: line 27: [object HTMLAllCollection]
+CONSOLE MESSAGE: line 31: [object HTMLFormControlsCollection]
+CONSOLE MESSAGE: line 35: [object RadioNodeList]
+CONSOLE MESSAGE: line 41: 1,2,
+CONSOLE MESSAGE: line 44: [object Object]
+CONSOLE MESSAGE: line 51: [object Arguments]
+CONSOLE MESSAGE: line 55: [object DOMTokenList]
+CONSOLE MESSAGE: line 58: [object Object]
+CONSOLE MESSAGE: line 59: [object Object]
+CONSOLE MESSAGE: line 61: [object Object]
+CONSOLE MESSAGE: line 62: [object Object]
+CONSOLE MESSAGE: line 63: [object Object]
+CONSOLE MESSAGE: line 64: [object Object]
+CONSOLE MESSAGE: line 65: [object Object]
+CONSOLE MESSAGE: line 66: [object Object]
+CONSOLE MESSAGE: line 15: [object HTMLCollection]
+CONSOLE MESSAGE: line 19: [object HTMLCollection]
+CONSOLE MESSAGE: line 23: [object HTMLOptionsCollection]
+CONSOLE MESSAGE: line 27: [object HTMLAllCollection]
+CONSOLE MESSAGE: line 31: [object HTMLFormControlsCollection]
+CONSOLE MESSAGE: line 35: [object RadioNodeList]
+CONSOLE MESSAGE: line 41: 1,2,
+CONSOLE MESSAGE: line 44: [object Object]
+CONSOLE MESSAGE: line 51: [object Arguments]
+CONSOLE MESSAGE: line 55: [object DOMTokenList]
+CONSOLE MESSAGE: line 58: [object Object]
+CONSOLE MESSAGE: line 59: [object Object]
+CONSOLE MESSAGE: line 61: [object Object]
+CONSOLE MESSAGE: line 62: [object Object]
+CONSOLE MESSAGE: line 63: [object Object]
+CONSOLE MESSAGE: line 64: [object Object]
+CONSOLE MESSAGE: line 65: [object Object]
+CONSOLE MESSAGE: line 66: [object Object]
+Tests that console nicely formats HTML Collections, NodeLists and DOMTokenLists.
+
+console-format-collections.html:15 HTMLCollection[1]
+console-format-collections.html:19 HTMLCollection[3]
+console-format-collections.html:23 HTMLOptionsCollection[2]
+console-format-collections.html:27 HTMLAllCollection[14]
+console-format-collections.html:31 HTMLFormControlsCollection[3]
+console-format-collections.html:35 RadioNodeList[2]
+console-format-collections.html:41 Array[2]
+console-format-collections.html:44 NonArrayWithLength
+console-format-collections.html:51 Arguments[2]
+console-format-collections.html:55 DOMTokenList[3]
+console-format-collections.html:58 ArrayLike[5]
+console-format-collections.html:59 ArrayLike[4294967295]
+console-format-collections.html:61 ArrayLike
+console-format-collections.html:62 ArrayLike
+console-format-collections.html:63 ArrayLike
+console-format-collections.html:64 ArrayLike
+console-format-collections.html:65 ArrayLike
+console-format-collections.html:66 ArrayLike
+console-format-collections.html:15 [select#sel, sel: select#sel]
+console-format-collections.html:19 [script, script, script]
+console-format-collections.html:23 [option, option, selectedIndex: 0]
+console-format-collections.html:27 [html, head, script, script, script, body, p, div.c1.c2.c3, form#f, select#sel, option, option, input, input, f: form#f, sel: select#sel, x: NodeList[2]]
+console-format-collections.html:31 [select#sel, input, input, sel: select#sel, x: RadioNodeList[2]]
+console-format-collections.html:35 [input, input, value: ""]
+console-format-collections.html:41 [1, Array[2]]
+console-format-collections.html:44 NonArrayWithLength {keys: Array[0]}
+console-format-collections.html:51 [1, "2"]
+console-format-collections.html:55 ["c1", "c2", "c3", value: "c1 c2 c3"]
+console-format-collections.html:58 [undefined × 5]
+console-format-collections.html:59 [undefined × 4294967295]
+console-format-collections.html:61 ArrayLike {length: -5}
+console-format-collections.html:62 ArrayLike {length: 5.6}
+console-format-collections.html:63 ArrayLike {length: NaN}
+console-format-collections.html:64 ArrayLike {length: Infinity}
+console-format-collections.html:65 ArrayLike {length: -0}
+console-format-collections.html:66 ArrayLike {length: 4294967296}
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-es6-2-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-es6-2-expected.txt
new file mode 100644
index 0000000..50e2f18
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-es6-2-expected.txt
@@ -0,0 +1,232 @@
+CONSOLE MESSAGE: line 11: [object Map Iterator]
+CONSOLE MESSAGE: line 12: [object Map Iterator]
+CONSOLE MESSAGE: line 11: [object Map Iterator]
+CONSOLE MESSAGE: line 12: [object Map Iterator]
+CONSOLE MESSAGE: line 11: [object Map Iterator]
+CONSOLE MESSAGE: line 12: [object Map Iterator]
+CONSOLE MESSAGE: line 11: [object Set Iterator]
+CONSOLE MESSAGE: line 12: [object Set Iterator]
+CONSOLE MESSAGE: line 11: [object Set Iterator]
+CONSOLE MESSAGE: line 12: [object Set Iterator]
+CONSOLE MESSAGE: line 11: [object Set Iterator]
+CONSOLE MESSAGE: line 12: [object Set Iterator]
+CONSOLE MESSAGE: line 11: [object Map Iterator]
+CONSOLE MESSAGE: line 12: [object Map Iterator]
+CONSOLE MESSAGE: line 11: [object Set Iterator]
+CONSOLE MESSAGE: line 12: [object Set Iterator]
+Tests that console properly displays information about ES6 features.
+
+console-format-es6-2.html:11 MapIterator {41, Object {foo: 1}}
+console-format-es6-2.html:12 [MapIterator]
+globals[0]
+MapIterator {41, Object {foo: 1}}
+console-format-es6-2.html:11 MapIterator {42, Object {foo: 2}}
+console-format-es6-2.html:12 [MapIterator]
+globals[1]
+MapIterator {42, Object {foo: 2}}
+console-format-es6-2.html:11 MapIterator {[41, 42], [Object, Object]}
+console-format-es6-2.html:12 [MapIterator]
+globals[2]
+MapIterator {[41, 42], [Object, Object]}
+console-format-es6-2.html:11 SetIterator {41, Object {foo: 1}}
+console-format-es6-2.html:12 [SetIterator]
+globals[3]
+SetIterator {41, Object {foo: 1}}
+console-format-es6-2.html:11 SetIterator {41, Object {foo: 1}}
+console-format-es6-2.html:12 [SetIterator]
+globals[4]
+SetIterator {41, Object {foo: 1}}
+console-format-es6-2.html:11 SetIterator {[41, 41], [Object, Object]}
+console-format-es6-2.html:12 [SetIterator]
+globals[5]
+SetIterator {[41, 41], [Object, Object]}
+console-format-es6-2.html:11 MapIterator {Object {foo: 2}}
+console-format-es6-2.html:12 [MapIterator]
+globals[6]
+MapIterator {Object {foo: 2}}
+console-format-es6-2.html:11 SetIterator {Object {foo: 1}}
+console-format-es6-2.html:12 [SetIterator]
+globals[7]
+SetIterator {Object {foo: 1}}
+Expanded all messages
+console-format-es6-2.html:11 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "keys"
+    [[Entries]]: Array[2]
+        0: 41
+        1: Object
+        length: 2
+console-format-es6-2.html:12 Array[1]
+    0: MapIterator
+    length: 1
+    __proto__: Array[0]
+globals[0]
+MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "keys"
+    [[Entries]]: Array[2]
+        0: 41
+        1: Object
+        length: 2
+console-format-es6-2.html:11 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[2]
+        0: 42
+        1: Object
+        length: 2
+console-format-es6-2.html:12 Array[1]
+    0: MapIterator
+    length: 1
+    __proto__: Array[0]
+globals[1]
+MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[2]
+        0: 42
+        1: Object
+        length: 2
+console-format-es6-2.html:11 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "entries"
+    [[Entries]]: Array[2]
+        0: Array[2]
+        1: Array[2]
+        length: 2
+console-format-es6-2.html:12 Array[1]
+    0: MapIterator
+    length: 1
+    __proto__: Array[0]
+globals[2]
+MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "entries"
+    [[Entries]]: Array[2]
+        0: Array[2]
+        1: Array[2]
+        length: 2
+console-format-es6-2.html:11 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[2]
+        0: 41
+        1: Object
+        length: 2
+console-format-es6-2.html:12 Array[1]
+    0: SetIterator
+    length: 1
+    __proto__: Array[0]
+globals[3]
+SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[2]
+        0: 41
+        1: Object
+        length: 2
+console-format-es6-2.html:11 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[2]
+        0: 41
+        1: Object
+        length: 2
+console-format-es6-2.html:12 Array[1]
+    0: SetIterator
+    length: 1
+    __proto__: Array[0]
+globals[4]
+SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[2]
+        0: 41
+        1: Object
+        length: 2
+console-format-es6-2.html:11 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "entries"
+    [[Entries]]: Array[2]
+        0: Array[2]
+        1: Array[2]
+        length: 2
+console-format-es6-2.html:12 Array[1]
+    0: SetIterator
+    length: 1
+    __proto__: Array[0]
+globals[5]
+SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 0
+    [[IteratorKind]]: "entries"
+    [[Entries]]: Array[2]
+        0: Array[2]
+        1: Array[2]
+        length: 2
+console-format-es6-2.html:11 MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 1
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6-2.html:12 Array[1]
+    0: MapIterator
+    length: 1
+    __proto__: Array[0]
+globals[6]
+MapIterator
+    __proto__: Map Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 1
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6-2.html:11 SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 1
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6-2.html:12 Array[1]
+    0: SetIterator
+    length: 1
+    __proto__: Array[0]
+globals[7]
+SetIterator
+    __proto__: Set Iterator
+    [[IteratorHasMore]]: true
+    [[IteratorIndex]]: 1
+    [[IteratorKind]]: "values"
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-es6-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-es6-expected.txt
new file mode 100644
index 0000000..dbbb33e
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-es6-expected.txt
@@ -0,0 +1,285 @@
+CONSOLE MESSAGE: line 11: [object Promise]
+CONSOLE MESSAGE: line 12: [object Promise]
+CONSOLE MESSAGE: line 11: Symbol()
+CONSOLE MESSAGE: line 12: Symbol()
+CONSOLE MESSAGE: line 11: Symbol(a)
+CONSOLE MESSAGE: line 12: Symbol(a)
+CONSOLE MESSAGE: line 11: [object Object]
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 11: [object Map]
+CONSOLE MESSAGE: line 12: [object Map]
+CONSOLE MESSAGE: line 11: [object WeakMap]
+CONSOLE MESSAGE: line 12: [object WeakMap]
+CONSOLE MESSAGE: line 11: [object Set]
+CONSOLE MESSAGE: line 12: [object Set]
+CONSOLE MESSAGE: line 11: [object WeakSet]
+CONSOLE MESSAGE: line 12: [object WeakSet]
+CONSOLE MESSAGE: line 11: [object Map]
+CONSOLE MESSAGE: line 12: [object Map]
+CONSOLE MESSAGE: line 11: [object Map]
+CONSOLE MESSAGE: line 12: [object Map]
+CONSOLE MESSAGE: line 11: [object Set]
+CONSOLE MESSAGE: line 12: [object Set]
+CONSOLE MESSAGE: line 11: [object Set]
+CONSOLE MESSAGE: line 12: [object Set]
+CONSOLE MESSAGE: line 11: [object Map]
+CONSOLE MESSAGE: line 12: [object Map]
+Tests that console properly displays information about ES6 features.
+
+console-format-es6.html:11 Promise {[[PromiseStatus]]: "rejected", [[PromiseValue]]: -0}
+console-format-es6.html:12 [Promise]
+globals[0]
+Promise {[[PromiseStatus]]: "rejected", [[PromiseValue]]: -0}
+console-format-es6.html:11 Symbol()
+console-format-es6.html:12 [Symbol()]
+globals[1]
+Symbol()
+console-format-es6.html:11 Symbol(a)
+console-format-es6.html:12 [Symbol(a)]
+globals[2]
+Symbol(a)
+console-format-es6.html:11 Object {a: Symbol(), Symbol(a): 2}
+console-format-es6.html:12 [Object]
+globals[3]
+Object {a: Symbol(), Symbol(a): 2}
+console-format-es6.html:11 Map {Object {a: Symbol(), Symbol(a): 2} => Object {foo: 1}}
+console-format-es6.html:12 [Map]
+globals[4]
+Map {Object {a: Symbol(), Symbol(a): 2} => Object {foo: 1}}
+console-format-es6.html:11 WeakMap {Object {a: Symbol(), Symbol(a): 2} => Object {foo: 1}}
+console-format-es6.html:12 [WeakMap]
+globals[5]
+WeakMap {Object {a: Symbol(), Symbol(a): 2} => Object {foo: 1}}
+console-format-es6.html:11 Set {Object {a: Symbol(), Symbol(a): 2}}
+console-format-es6.html:12 [Set]
+globals[6]
+Set {Object {a: Symbol(), Symbol(a): 2}}
+console-format-es6.html:11 WeakSet {Object {a: Symbol(), Symbol(a): 2}}
+console-format-es6.html:12 [WeakSet]
+globals[7]
+WeakSet {Object {a: Symbol(), Symbol(a): 2}}
+console-format-es6.html:11 Map {Map {} => WeakMap {}}
+console-format-es6.html:12 [Map]
+globals[8]
+Map {Map {} => WeakMap {}}
+console-format-es6.html:11 Map {Map {…} => WeakMap {…}}
+console-format-es6.html:12 [Map]
+globals[9]
+Map {Map {…} => WeakMap {…}}
+console-format-es6.html:11 Set {WeakSet {}}
+console-format-es6.html:12 [Set]
+globals[10]
+Set {WeakSet {}}
+console-format-es6.html:11 Set {WeakSet {…}}
+console-format-es6.html:12 [Set]
+globals[11]
+Set {WeakSet {…}}
+console-format-es6.html:11 Map {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, Object {foo: "from"} => Object {foo: "to"}…}
+console-format-es6.html:12 [Map]
+globals[12]
+Map {" from str " => " to str ", undefined => undefined, null => null, 42 => 42, Object {foo: "from"} => Object {foo: "to"}…}
+Expanded all messages
+console-format-es6.html:11 Promise
+    __proto__: Promise
+    [[PromiseStatus]]: "rejected"
+    [[PromiseValue]]: -0
+console-format-es6.html:12 Array[1]
+    0: Promise
+    length: 1
+    __proto__: Array[0]
+globals[0]
+Promise
+    __proto__: Promise
+    [[PromiseStatus]]: "rejected"
+    [[PromiseValue]]: -0
+console-format-es6.html:11 Symbol()
+console-format-es6.html:12 Array[1]
+    0: Symbol()
+    length: 1
+    __proto__: Array[0]
+globals[1]
+Symbol()
+console-format-es6.html:11 Symbol(a)
+console-format-es6.html:12 Array[1]
+    0: Symbol(a)
+    length: 1
+    __proto__: Array[0]
+globals[2]
+Symbol(a)
+console-format-es6.html:11 Object
+    a: Symbol()
+    getter: (...)
+    Symbol(a): 2
+    get getter: function getter()
+    __proto__: Object
+console-format-es6.html:12 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[3]
+Object
+    a: Symbol()
+    getter: (...)
+    Symbol(a): 2
+    get getter: function getter()
+    __proto__: Object
+console-format-es6.html:11 Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Object => Object}
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: Map
+    length: 1
+    __proto__: Array[0]
+globals[4]
+Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Object => Object}
+        length: 1
+console-format-es6.html:11 WeakMap
+    __proto__: WeakMap
+    [[Entries]]: Array[1]
+        0: {Object => Object}
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: WeakMap
+    length: 1
+    __proto__: Array[0]
+globals[5]
+WeakMap
+    __proto__: WeakMap
+    [[Entries]]: Array[1]
+        0: {Object => Object}
+        length: 1
+console-format-es6.html:11 Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: Set
+    length: 1
+    __proto__: Array[0]
+globals[6]
+Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6.html:11 WeakSet
+    __proto__: WeakSet
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: WeakSet
+    length: 1
+    __proto__: Array[0]
+globals[7]
+WeakSet
+    __proto__: WeakSet
+    [[Entries]]: Array[1]
+        0: Object
+        length: 1
+console-format-es6.html:11 Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Map => WeakMap}
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: Map
+    length: 1
+    __proto__: Array[0]
+globals[8]
+Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Map => WeakMap}
+        length: 1
+console-format-es6.html:11 Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Map => WeakMap}
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: Map
+    length: 1
+    __proto__: Array[0]
+globals[9]
+Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[1]
+        0: {Map => WeakMap}
+        length: 1
+console-format-es6.html:11 Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: WeakSet
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: Set
+    length: 1
+    __proto__: Array[0]
+globals[10]
+Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: WeakSet
+        length: 1
+console-format-es6.html:11 Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: WeakSet
+        length: 1
+console-format-es6.html:12 Array[1]
+    0: Set
+    length: 1
+    __proto__: Array[0]
+globals[11]
+Set
+    size: (...)
+    __proto__: Set
+    [[Entries]]: Array[1]
+        0: WeakSet
+        length: 1
+console-format-es6.html:11 Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[6]
+        0: {" from str " => " to str "}
+        1: {undefined => undefined}
+        2: {null => null}
+        3: {42 => 42}
+        4: {Object => Object}
+        5: {Array[1] => Array[1]}
+        length: 6
+console-format-es6.html:12 Array[1]
+    0: Map
+    length: 1
+    __proto__: Array[0]
+globals[12]
+Map
+    size: (...)
+    __proto__: Map
+    [[Entries]]: Array[6]
+        0: {" from str " => " to str "}
+        1: {undefined => undefined}
+        2: {null => null}
+        3: {42 => 42}
+        4: {Object => Object}
+        5: {Array[1] => Array[1]}
+        length: 6
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-expected.txt
new file mode 100644
index 0000000..efbc763
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-expected.txt
@@ -0,0 +1,812 @@
+CONSOLE MESSAGE: line 27: test,test2,,,test4,,,,,
+CONSOLE MESSAGE: line 28: %o
+CONSOLE MESSAGE: line 29: %O
+CONSOLE MESSAGE: line 30: Test for zero "%f" in formatter
+CONSOLE MESSAGE: line 31: %% self-escape1
+CONSOLE MESSAGE: line 32: %%s self-escape2
+CONSOLE MESSAGE: line 33: %%ss self-escape3
+CONSOLE MESSAGE: line 34: %%s%s%%s self-escape4
+CONSOLE MESSAGE: line 35: %%%%% self-escape5
+CONSOLE MESSAGE: line 36: %%%s self-escape6
+CONSOLE MESSAGE: line 12: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+CONSOLE MESSAGE: line 13: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+CONSOLE MESSAGE: line 12: /foo\\bar\sbaz/i
+CONSOLE MESSAGE: line 13: /foo\\bar\sbaz/i
+CONSOLE MESSAGE: line 12: test
+CONSOLE MESSAGE: line 13: test
+CONSOLE MESSAGE: line 12: test named "test"
+CONSOLE MESSAGE: line 13: test named "test"
+CONSOLE MESSAGE: line 12: Error
+CONSOLE MESSAGE: line 13: Error
+CONSOLE MESSAGE: line 12: Error: my error message
+CONSOLE MESSAGE: line 13: Error: my error message
+CONSOLE MESSAGE: line 12: Error: my multiline
+error message
+CONSOLE MESSAGE: line 13: Error: my multiline
+error message
+CONSOLE MESSAGE: line 12: [object HTMLParagraphElement]
+CONSOLE MESSAGE: line 13: [object HTMLParagraphElement]
+CONSOLE MESSAGE: line 12: function () { return 1; }
+CONSOLE MESSAGE: line 13: function () { return 1; }
+CONSOLE MESSAGE: line 12: function () {
+        return 2;
+    }
+CONSOLE MESSAGE: line 13: function () {
+        return 2;
+    }
+CONSOLE MESSAGE: line 12: 0.12
+CONSOLE MESSAGE: line 13: 0.12
+CONSOLE MESSAGE: line 12: http://webkit.org/
+CONSOLE MESSAGE: line 13: http://webkit.org/
+CONSOLE MESSAGE: line 12: null
+CONSOLE MESSAGE: line 13: 
+CONSOLE MESSAGE: line 12: undefined
+CONSOLE MESSAGE: line 13: 
+CONSOLE MESSAGE: line 12: [object Attr]
+CONSOLE MESSAGE: line 13: [object Attr]
+CONSOLE MESSAGE: line 12: [object Attr]
+CONSOLE MESSAGE: line 13: [object Attr]
+CONSOLE MESSAGE: line 12: [object Attr]
+CONSOLE MESSAGE: line 13: [object Attr]
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: NaN
+CONSOLE MESSAGE: line 13: NaN
+CONSOLE MESSAGE: line 12: Infinity
+CONSOLE MESSAGE: line 13: Infinity
+CONSOLE MESSAGE: line 12: -Infinity
+CONSOLE MESSAGE: line 13: -Infinity
+CONSOLE MESSAGE: line 12: test,test2,,,test4,,,,,
+CONSOLE MESSAGE: line 13: test,test2,,,test4,,,,,
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: function () {}
+CONSOLE MESSAGE: line 13: function () {}
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: [object SVGSVGElement]
+CONSOLE MESSAGE: line 13: [object SVGSVGElement]
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: 0
+CONSOLE MESSAGE: line 13: 0
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: function Object() { [native code] }
+CONSOLE MESSAGE: line 13: function Object() { [native code] }
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: function ( /**/ foo/**/, /*/**/bar,
+    /**/baz) {}
+CONSOLE MESSAGE: line 13: function ( /**/ foo/**/, /*/**/bar,
+    /**/baz) {}
+CONSOLE MESSAGE: line 12: 42
+CONSOLE MESSAGE: line 13: 42
+CONSOLE MESSAGE: line 12: abc
+CONSOLE MESSAGE: line 13: abc
+CONSOLE MESSAGE: line 12: [object Uint16Array]
+CONSOLE MESSAGE: line 13: [object Uint16Array]
+CONSOLE MESSAGE: line 12: [object Text]
+CONSOLE MESSAGE: line 13: [object Text]
+CONSOLE MESSAGE: line 12: [object DOMException]
+CONSOLE MESSAGE: line 13: [object DOMException]
+CONSOLE MESSAGE: line 12: [object Uint8Array]
+CONSOLE MESSAGE: line 13: [object Uint8Array]
+CONSOLE MESSAGE: line 12: [object Uint8Array]
+CONSOLE MESSAGE: line 13: [object Uint8Array]
+CONSOLE MESSAGE: line 12: [object Uint8Array]
+CONSOLE MESSAGE: line 13: [object Uint8Array]
+CONSOLE MESSAGE: line 12: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 12: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+CONSOLE MESSAGE: line 13: 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
+CONSOLE MESSAGE: line 12: test
+CONSOLE MESSAGE: line 13: test
+Tests that console logging dumps proper messages.
+
+ console-format.html:22 Array[10]
+console-format.html:23 Array[10]
+console-format.html:24 Array[10]
+console-format.html:25 Test for zero "0" in formatter
+console-format.html:26 % self-escape1 dummy
+console-format.html:27 %s self-escape2 dummy
+console-format.html:28 %ss self-escape3 dummy
+console-format.html:29 %sdummy%s self-escape4
+console-format.html:30 %%% self-escape5 dummy
+console-format.html:31 %dummy self-escape6
+console-format.html:7 /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+console-format.html:8 [/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\…?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i]
+globals[0]
+/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+console-format.html:7 /foo\\bar\sbaz/i
+console-format.html:8 [/foo\\bar\sbaz/i]
+globals[1]
+/foo\\bar\sbaz/i
+console-format.html:7 test
+console-format.html:8 ["test"]
+globals[2]
+"test"
+console-format.html:7 test named "test"
+console-format.html:8 ["test named "test""]
+globals[3]
+"test named "test""
+console-format.html:7 Error
+console-format.html:8 [Error
+]
+globals[4]
+Error
+console-format.html:7 Error: my error message
+console-format.html:8 [Error: my error message
+]
+globals[5]
+Error: my error message
+console-format.html:7 Error: my multiline
+error message
+console-format.html:8 [Error: my multiline
+error message
+]
+globals[6]
+Error: my multiline
+error message
+console-format.html:7 
+    <p id="p">Tests that console logging dumps proper messages.</p>
+console-format.html:8 [p#p]
+globals[7]
+    <p id="p">Tests that console logging dumps proper messages.</p>
+console-format.html:7 function () { return 1; }
+console-format.html:8 [function]
+globals[8]
+function () { return 1; }
+console-format.html:7 function () {
+        return 2;
+    }
+console-format.html:8 [function]
+globals[9]
+function () {
+        return 2;
+    }
+console-format.html:7 0.12
+console-format.html:8 [0.12]
+globals[10]
+0.12
+console-format.html:7 http://webkit.org/
+console-format.html:8 ["http://webkit.org/"]
+globals[11]
+"http://webkit.org/"
+console-format.html:7 null
+console-format.html:8 [null]
+globals[12]
+null
+console-format.html:7 undefined
+console-format.html:8 [undefined]
+globals[13]
+undefined
+console-format.html:7 
+    attr=""
+console-format.html:8 [attr]
+globals[14]
+    attr=""
+console-format.html:7 
+    attr="value"
+console-format.html:8 [attr]
+globals[15]
+    attr="value"
+console-format.html:7 
+    id="x"
+console-format.html:8 [id]
+globals[16]
+    id="x"
+console-format.html:7 Object {}
+console-format.html:8 [Object]
+globals[17]
+Object {}
+console-format.html:7 NaN
+console-format.html:8 [NaN]
+globals[18]
+NaN
+console-format.html:7 Infinity
+console-format.html:8 [Infinity]
+globals[19]
+Infinity
+console-format.html:7 -Infinity
+console-format.html:8 [-Infinity]
+globals[20]
+-Infinity
+console-format.html:7 ["test", "test2", undefined × 2, "test4", undefined × 5, foo: Object]
+console-format.html:8 [Array[10]]
+globals[21]
+["test", "test2", undefined × 2, "test4", undefined × 5, foo: Object]
+console-format.html:7 Object {}
+console-format.html:8 [Object]
+globals[22]
+Object {}
+console-format.html:7 [function]
+console-format.html:8 [Array[1]]
+globals[23]
+[function]
+console-format.html:7 Object {bar: "bar"}
+console-format.html:8 [Object]
+globals[24]
+Object {bar: "bar"}
+console-format.html:7 
+    <svg id="svg-node"></svg>
+console-format.html:8 [svg#svg-node]
+globals[25]
+    <svg id="svg-node"></svg>
+console-format.html:7 Object {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3}
+console-format.html:8 [Object]
+globals[26]
+Object {enumerableProp: 4, __underscoreEnumerableProp__: 5, __underscoreNonEnumerableProp: 2, abc: 3}
+console-format.html:7 -0
+console-format.html:8 [-0]
+globals[27]
+-0
+console-format.html:7 Object {}
+console-format.html:8 [Object]
+globals[28]
+Object {}
+console-format.html:7 function Object() { [native code] }
+console-format.html:8 [function]
+globals[29]
+function Object() { [native code] }
+console-format.html:7 Object {}
+console-format.html:8 [Object]
+globals[30]
+Object {}
+console-format.html:7 function ( /**/ foo/**/, /*/**/bar,
+    /**/baz) {}
+console-format.html:8 [function]
+globals[31]
+function ( /**/ foo/**/, /*/**/bar,
+    /**/baz) {}
+console-format.html:7 Number {[[PrimitiveValue]]: 42}
+console-format.html:8 [Number]
+globals[32]
+Number {[[PrimitiveValue]]: 42}
+console-format.html:7 String {0: "a", 1: "b", 2: "c", length: 3, [[PrimitiveValue]]: "abc"}
+console-format.html:8 [String]
+globals[33]
+String {0: "a", 1: "b", 2: "c", length: 3, [[PrimitiveValue]]: "abc"}
+console-format.html:7 Uint16Array[3] [1, 2, 3]
+console-format.html:8 [Uint16Array[3]]
+globals[34]
+Uint16Array[3] [1, 2, 3]
+console-format.html:7 #text
+console-format.html:8 [text]
+globals[35]
+#text
+console-format.html:7 DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
+console-format.html:8 [DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of th…]
+globals[36]
+DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
+console-format.html:7 Uint8Array[1] [3]
+console-format.html:8 [Uint8Array[1]]
+globals[37]
+Uint8Array[1] [3]
+console-format.html:7 Uint8Array[400] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…]
+console-format.html:8 [Uint8Array[400]]
+globals[38]
+Uint8Array[400] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…]
+console-format.html:7 Uint8Array[400000000] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…]
+console-format.html:8 [Uint8Array[400000000]]
+globals[39]
+Uint8Array[400000000] [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…]
+console-format.html:7 namespace.longSubNamespace.x.className {}
+console-format.html:8 [n…e.l…e.x.className]
+globals[40]
+namespace.longSubNamespace.x.className {}
+console-format.html:7 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…]
+console-format.html:8 [Array[200]]
+globals[41]
+[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…]
+console-format.html:7 ["test"]
+console-format.html:8 [Array[1]]
+globals[42]
+["test"]
+Expanded all messages
+console-format.html:22 Array[10]
+    0: "test"
+    1: "test2"
+    4: "test4"
+    foo: Object
+    length: 10
+    __proto__: Array[0]
+console-format.html:23 Array[10]
+    0: "test"
+    1: "test2"
+    4: "test4"
+    foo: Object
+    length: 10
+    __proto__: Array[0]
+console-format.html:24 Array[10]
+    0: "test"
+    1: "test2"
+    4: "test4"
+    foo: Object
+    length: 10
+    __proto__: Array[0]
+console-format.html:25 Test for zero "0" in formatter
+console-format.html:26 % self-escape1 dummy
+console-format.html:27 %s self-escape2 dummy
+console-format.html:28 %ss self-escape3 dummy
+console-format.html:29 %sdummy%s self-escape4
+console-format.html:30 %%% self-escape5 dummy
+console-format.html:31 %dummy self-escape6
+console-format.html:7 /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+console-format.html:8 Array[1]
+    0: /^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+    length: 1
+    __proto__: Array[0]
+globals[0]
+/^url\(\s*(?:(?:"(?:[^\\\"]|(?:\\[\da-f]{1,6}\s?|\.))*"|'(?:[^\\\']|(?:\\[\da-f]{1,6}\s?|\.))*')|(?:[!#$%&*-~\w]|(?:\\[\da-f]{1,6}\s?|\.))*)\s*\)/i
+console-format.html:7 /foo\\bar\sbaz/i
+console-format.html:8 Array[1]
+    0: /foo\\bar\sbaz/i
+    length: 1
+    __proto__: Array[0]
+globals[1]
+/foo\\bar\sbaz/i
+console-format.html:7 test
+console-format.html:8 Array[1]
+    0: "test"
+    length: 1
+    __proto__: Array[0]
+globals[2]
+"test"
+console-format.html:7 test named "test"
+console-format.html:8 Array[1]
+    0: "test named "test""
+    length: 1
+    __proto__: Array[0]
+globals[3]
+"test named "test""
+console-format.html:7 Error
+console-format.html:8 Array[1]
+    0: Error
+    length: 1
+    __proto__: Array[0]
+globals[4]
+Error
+console-format.html:7 Error: my error message
+console-format.html:8 Array[1]
+    0: Error: my error message
+    length: 1
+    __proto__: Array[0]
+globals[5]
+Error: my error message
+console-format.html:7 Error: my multiline
+error message
+console-format.html:8 Array[1]
+    0: Error: my multiline
+error message
+    length: 1
+    __proto__: Array[0]
+globals[6]
+Error: my multiline
+error message
+console-format.html:7 
+    <p id="p">Tests that console logging dumps proper messages.</p>
+console-format.html:8 Array[1]
+    0: p#p
+    length: 1
+    __proto__: Array[0]
+globals[7]
+    <p id="p">Tests that console logging dumps proper messages.</p>
+console-format.html:7 function () { return 1; }
+console-format.html:8 Array[1]
+    0: function ()
+    length: 1
+    __proto__: Array[0]
+globals[8]
+function () { return 1; }
+console-format.html:7 function () {
+        return 2;
+    }
+console-format.html:8 Array[1]
+    0: function ()
+    length: 1
+    __proto__: Array[0]
+globals[9]
+function () {
+        return 2;
+    }
+console-format.html:7 0.12
+console-format.html:8 Array[1]
+    0: 0.12
+    length: 1
+    __proto__: Array[0]
+globals[10]
+0.12
+console-format.html:7 http://webkit.org/
+console-format.html:8 Array[1]
+    0: "http://webkit.org/"
+    length: 1
+    __proto__: Array[0]
+globals[11]
+"http://webkit.org/"
+console-format.html:7 null
+console-format.html:8 Array[1]
+    0: null
+    length: 1
+    __proto__: Array[0]
+globals[12]
+null
+console-format.html:7 undefined
+console-format.html:8 Array[1]
+    0: undefined
+    length: 1
+    __proto__: Array[0]
+globals[13]
+undefined
+console-format.html:7 
+    attr=""
+console-format.html:8 Array[1]
+    0: attr
+    length: 1
+    __proto__: Array[0]
+globals[14]
+    attr=""
+console-format.html:7 
+    attr="value"
+console-format.html:8 Array[1]
+    0: attr
+    length: 1
+    __proto__: Array[0]
+globals[15]
+    attr="value"
+console-format.html:7 
+    id="x"
+console-format.html:8 Array[1]
+    0: id
+    length: 1
+    __proto__: Array[0]
+globals[16]
+    id="x"
+console-format.html:7 Object
+    length: (...)
+    get length: function length()
+    __proto__: Object
+console-format.html:8 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[17]
+Object
+    length: (...)
+    get length: function length()
+    __proto__: Object
+console-format.html:7 NaN
+console-format.html:8 Array[1]
+    0: NaN
+    length: 1
+    __proto__: Array[0]
+globals[18]
+NaN
+console-format.html:7 Infinity
+console-format.html:8 Array[1]
+    0: Infinity
+    length: 1
+    __proto__: Array[0]
+globals[19]
+Infinity
+console-format.html:7 -Infinity
+console-format.html:8 Array[1]
+    0: -Infinity
+    length: 1
+    __proto__: Array[0]
+globals[20]
+-Infinity
+console-format.html:7 Array[10]
+    0: "test"
+    1: "test2"
+    4: "test4"
+    foo: Object
+    length: 10
+    __proto__: Array[0]
+console-format.html:8 Array[1]
+    0: Array[10]
+    length: 1
+    __proto__: Array[0]
+globals[21]
+Array[10]
+    0: "test"
+    1: "test2"
+    4: "test4"
+    foo: Object
+    length: 10
+    __proto__: Array[0]
+console-format.html:7 Object
+    __proto__: Object
+console-format.html:8 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[22]
+Object
+    __proto__: Object
+console-format.html:7 Array[1]
+    0: function ()
+    length: 1
+    __proto__: Array[0]
+console-format.html:8 Array[1]
+    0: Array[1]
+    length: 1
+    __proto__: Array[0]
+globals[23]
+Array[1]
+    0: function ()
+    length: 1
+    __proto__: Array[0]
+console-format.html:7 Object
+    bar: "bar"
+    __proto__: Object
+console-format.html:8 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[24]
+Object
+    bar: "bar"
+    __proto__: Object
+console-format.html:7 
+    <svg id="svg-node"></svg>
+console-format.html:8 Array[1]
+    0: svg#svg-node
+    length: 1
+    __proto__: Array[0]
+globals[25]
+    <svg id="svg-node"></svg>
+console-format.html:7 Object
+    enumerableProp: 4
+    __underscoreEnumerableProp__: 5
+    abc: 3
+    bar: (...)
+    getFoo: function ()
+    __underscoreNonEnumerableProp: 2
+    get bar: function ()
+    set bar: function (x)
+    __proto__: Object
+console-format.html:8 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[26]
+Object
+    enumerableProp: 4
+    __underscoreEnumerableProp__: 5
+    abc: 3
+    bar: (...)
+    getFoo: function ()
+    __underscoreNonEnumerableProp: 2
+    get bar: function ()
+    set bar: function (x)
+    __proto__: Object
+console-format.html:7 -0
+console-format.html:8 Array[1]
+    0: -0
+    length: 1
+    __proto__: Array[0]
+globals[27]
+-0
+console-format.html:7 Object
+    No Properties
+console-format.html:8 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[28]
+Object
+    No Properties
+console-format.html:7 function Object() { [native code] }
+console-format.html:8 Array[1]
+    0: function Object()
+    length: 1
+    __proto__: Array[0]
+globals[29]
+function Object() { [native code] }
+console-format.html:7 Object
+    constructor: function Object()
+    hasOwnProperty: function hasOwnProperty()
+    isPrototypeOf: function isPrototypeOf()
+    propertyIsEnumerable: function propertyIsEnumerable()
+    toLocaleString: function toLocaleString()
+    toString: function toString()
+    valueOf: function valueOf()
+    __defineGetter__: function __defineGetter__()
+    __defineSetter__: function __defineSetter__()
+    __lookupGetter__: function __lookupGetter__()
+    __lookupSetter__: function __lookupSetter__()
+    get __proto__: function __proto__()
+    set __proto__: function __proto__()
+console-format.html:8 Array[1]
+    0: Object
+    length: 1
+    __proto__: Array[0]
+globals[30]
+Object
+    constructor: function Object()
+    hasOwnProperty: function hasOwnProperty()
+    isPrototypeOf: function isPrototypeOf()
+    propertyIsEnumerable: function propertyIsEnumerable()
+    toLocaleString: function toLocaleString()
+    toString: function toString()
+    valueOf: function valueOf()
+    __defineGetter__: function __defineGetter__()
+    __defineSetter__: function __defineSetter__()
+    __lookupGetter__: function __lookupGetter__()
+    __lookupSetter__: function __lookupSetter__()
+    get __proto__: function __proto__()
+    set __proto__: function __proto__()
+console-format.html:7 function ( /**/ foo/**/, /*/**/bar,
+    /**/baz) {}
+console-format.html:8 Array[1]
+    0: function ( /**/ foo/**/, /*/**/bar,     /**/baz)
+    length: 1
+    __proto__: Array[0]
+globals[31]
+function ( /**/ foo/**/, /*/**/bar,
+    /**/baz) {}
+console-format.html:7 Number
+    __proto__: Number
+    [[PrimitiveValue]]: 42
+console-format.html:8 Array[1]
+    0: Number
+    length: 1
+    __proto__: Array[0]
+globals[32]
+Number
+    __proto__: Number
+    [[PrimitiveValue]]: 42
+console-format.html:7 String
+    0: "a"
+    1: "b"
+    2: "c"
+    length: 3
+    __proto__: String
+    [[PrimitiveValue]]: "abc"
+console-format.html:8 Array[1]
+    0: String
+    length: 1
+    __proto__: Array[0]
+globals[33]
+String
+    0: "a"
+    1: "b"
+    2: "c"
+    length: 3
+    __proto__: String
+    [[PrimitiveValue]]: "abc"
+console-format.html:7 Uint16Array[3]
+    0: 1
+    1: 2
+    2: 3
+    buffer: (...)
+    byteLength: (...)
+    byteOffset: (...)
+    length: (...)
+    Symbol(Symbol.toStringTag): (...)
+    __proto__: TypedArray
+console-format.html:8 Array[1]
+    0: Uint16Array[3]
+    length: 1
+    __proto__: Array[0]
+globals[34]
+Uint16Array[3]
+    0: 1
+    1: 2
+    2: 3
+    buffer: (...)
+    byteLength: (...)
+    byteOffset: (...)
+    length: (...)
+    Symbol(Symbol.toStringTag): (...)
+    __proto__: TypedArray
+console-format.html:7 #text
+console-format.html:8 Array[1]
+    0: text
+    length: 1
+    __proto__: Array[0]
+globals[35]
+#text
+console-format.html:7 DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
+console-format.html:8 Array[1]
+    0: DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
+    length: 1
+    __proto__: Array[0]
+globals[36]
+DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
+console-format.html:7 Uint8Array[1]
+    0: 3
+    buffer: (...)
+    byteLength: (...)
+    byteOffset: (...)
+    length: (...)
+    Symbol(Symbol.toStringTag): (...)
+    __proto__: TypedArray
+console-format.html:8 Array[1]
+    0: Uint8Array[1]
+    length: 1
+    __proto__: Array[0]
+globals[37]
+Uint8Array[1]
+    0: 3
+    buffer: (...)
+    byteLength: (...)
+    byteOffset: (...)
+    length: (...)
+    Symbol(Symbol.toStringTag): (...)
+    __proto__: TypedArray
+console-format.html:7 Uint8Array[400]
+    [0 … 99]
+    [100 … 199]
+    [200 … 299]
+    [300 … 399]
+    foo: "bar"
+    __proto__: TypedArray
+console-format.html:8 Array[1]
+    0: Uint8Array[400]
+    length: 1
+    __proto__: Array[0]
+globals[38]
+Uint8Array[400]
+    [0 … 99]
+    [100 … 199]
+    [200 … 299]
+    [300 … 399]
+    foo: "bar"
+    __proto__: TypedArray
+console-format.html:7 Uint8Array[400000000]
+    [0 … 99999999]
+    [100000000 … 199999999]
+    [200000000 … 299999999]
+    [300000000 … 399999999]
+    __proto__: TypedArray
+console-format.html:8 Array[1]
+    0: Uint8Array[400000000]
+    length: 1
+    __proto__: Array[0]
+globals[39]
+Uint8Array[400000000]
+    [0 … 99999999]
+    [100000000 … 199999999]
+    [200000000 … 299999999]
+    [300000000 … 399999999]
+    __proto__: TypedArray
+console-format.html:7 namespace.longSubNamespace.x.className
+    __proto__: Object
+console-format.html:8 Array[1]
+    0: namespace.longSubNamespace.x.className
+    length: 1
+    __proto__: Array[0]
+globals[40]
+namespace.longSubNamespace.x.className
+    __proto__: Object
+console-format.html:7 Array[200]
+    [0 … 99]
+    [100 … 199]
+    length: 200
+    __proto__: Array[0]
+console-format.html:8 Array[1]
+    0: Array[200]
+    length: 1
+    __proto__: Array[0]
+globals[41]
+Array[200]
+    [0 … 99]
+    [100 … 199]
+    length: 200
+    __proto__: Array[0]
+console-format.html:7 Array[1]
+    0: "test"
+    length: 1
+    __proto__: Array[0]
+console-format.html:8 Array[1]
+    0: Array[1]
+    length: 1
+    __proto__: Array[0]
+globals[42]
+Array[1]
+    0: "test"
+    length: 1
+    __proto__: Array[0]
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-style-whitelist-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-style-whitelist-expected.txt
new file mode 100644
index 0000000..399d737d
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-format-style-whitelist-expected.txt
@@ -0,0 +1,21 @@
+CONSOLE MESSAGE: line 8: %cColors are awesome.
+CONSOLE MESSAGE: line 9: %cSo are fonts!
+CONSOLE MESSAGE: line 10: %cAnd borders and margins and paddings!
+CONSOLE MESSAGE: line 11: %ctext-* is fine by us!
+CONSOLE MESSAGE: line 13: %cDisplay, on the other hand, is bad news.
+CONSOLE MESSAGE: line 14: %cAnd position too.
+Tests that console logging dumps properly styled messages, and that the whole message gets the same style, regardless of multiple %c settings.
+
+console-format-style-whitelist.html:4 Colors are awesome.
+Styled text #0: color: blue;
+console-format-style-whitelist.html:5 So are fonts!
+Styled text #0: font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; font-size: 1em; line-height: normal; font-family: Helvetica;
+console-format-style-whitelist.html:6 And borders and margins and paddings!
+Styled text #0: border: 1px solid red; margin: 20px; padding: 10px;
+console-format-style-whitelist.html:7 text-* is fine by us!
+Styled text #0: text-decoration-line: none; text-decoration-style: initial; text-decoration-color: initial;
+console-format-style-whitelist.html:9 Display, on the other hand, is bad news.
+Styled text #0: NO STYLES DEFINED
+console-format-style-whitelist.html:10 And position too.
+Styled text #0: NO STYLES DEFINED
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-before-inspector-open-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-before-inspector-open-expected.txt
new file mode 100644
index 0000000..49435e07
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-before-inspector-open-expected.txt
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: line 7: log
+CONSOLE INFO: line 8: info
+CONSOLE WARNING: line 9: warn
+CONSOLE ERROR: line 10: error
+Tests that Web Inspector won't crash if some console have been logged by the time it's opening.
+
+console-log-before-inspector-open.html:7 log
+console-log-before-inspector-open.html:8 info
+console-log-before-inspector-open.html:9 warn
+(anonymous) @ console-log-before-inspector-open.html:9
+console-log-before-inspector-open.html:10 error
+(anonymous) @ console-log-before-inspector-open.html:10
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-object-with-getter-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-object-with-getter-expected.txt
new file mode 100644
index 0000000..e5bc3b6
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-object-with-getter-expected.txt
@@ -0,0 +1,12 @@
+CONSOLE MESSAGE: line 25: [object Object]
+CONSOLE MESSAGE: line 26: 1,
+CONSOLE MESSAGE: line 27: [object Object]
+Tests that console logging dumps object values defined by getters and allows to expand it.
+
+console-log-object-with-getter.html:25 Object {}
+console-log-object-with-getter.html:26 [undefined × 2]
+console-log-object-with-getter.html:27 Object {}
+console-log-object-with-getter.html:25 Objectfoo: Objecta: 1b: 2__proto__: Objectget foo: function ()set bar: function (x)__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent expanded > name > object-properties-section-separator > object-value-object value > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-log-object-with-getter.html:26 Array[2]0: 1length: 2get 0: function ()set 1: function (x)__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-log-object-with-getter.html:27 Objecterror: [Exception: Error: myError]function: [Exception: function ()]number: [Exception: 123]string: [Exception: "myString"]get error: function error()get function: function function()get number: function number()get string: function string()__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > name > object-properties-section-separator > error value > object-value-error > children > name > object-properties-section-separator > error value > object-value-function > object-value-function-prefix > children > name > object-properties-section-separator > error value > object-value-number > children > name > object-properties-section-separator > error value > object-value-string > object-value-string-quote > object-value-string-quote > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-function value > object-value-function-prefix > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-side-effects-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-side-effects-expected.txt
new file mode 100644
index 0000000..2590455
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-side-effects-expected.txt
@@ -0,0 +1,33 @@
+CONSOLE MESSAGE: line 17: string
+CONSOLE MESSAGE: line 18: 42
+CONSOLE MESSAGE: line 19: false
+CONSOLE MESSAGE: line 20: undefined
+CONSOLE MESSAGE: line 21: null
+CONSOLE MESSAGE: line 22: NaN
+CONSOLE MESSAGE: line 23: -Infinity
+CONSOLE MESSAGE: line 24: 0
+CONSOLE MESSAGE: line 25: 42
+CONSOLE MESSAGE: line 26: -4.242e-11
+CONSOLE MESSAGE: line 27: true
+CONSOLE MESSAGE: line 28: foo
+CONSOLE MESSAGE: line 29: [object Object]
+CONSOLE MESSAGE: line 30: [object Window]
+CONSOLE MESSAGE: line 36: [object HTMLParagraphElement]
+CONSOLE MESSAGE: line 40: [object Object]
+CONSOLE MESSAGE: line 41: 1,2,3
+CONSOLE MESSAGE: line 43: [object Uint32Array]
+CONSOLE MESSAGE: line 46: 1,2,3,[object Object]
+CONSOLE MESSAGE: line 49: [object Object]
+CONSOLE MESSAGE: line 52: 1,2,3,[object Object],[object Object]
+CONSOLE MESSAGE: line 61: 1,2,3,4,5,,,,,,NaN,,,,,,,NaN,1,2,3,4,5,,
+CONSOLE MESSAGE: line 65: [object Object]
+CONSOLE MESSAGE: line 68: 1,2,3,[object Object],[object Object],[object Object]
+CONSOLE MESSAGE: line 74: 
+CONSOLE MESSAGE: line 74: 
+CONSOLE MESSAGE: line 74: 
+CONSOLE MESSAGE: line 74: 
+CONSOLE MESSAGE: line 74: 
+CONSOLE MESSAGE: line 77: 
+CONSOLE MESSAGE: line 84: 
+CONSOLE MESSAGE: line 90: 
+Tests various extreme usages of console.log()
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-without-console-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-without-console-expected.txt
new file mode 100644
index 0000000..55d62dc
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-log-without-console-expected.txt
@@ -0,0 +1,13 @@
+CONSOLE MESSAGE: line 7: 1
+CONSOLE INFO: line 9: 2
+CONSOLE ERROR: line 11: 3
+CONSOLE WARNING: line 13: 4
+Test that console.log can be called without console receiver.
+
+console-log-without-console.html:7 1
+console-log-without-console.html:9 2
+console-log-without-console.html:11 3
+(anonymous) @ console-log-without-console.html:11
+console-log-without-console.html:13 4
+(anonymous) @ console-log-without-console.html:13
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-object-preview-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-object-preview-expected.txt
new file mode 100644
index 0000000..9e284be
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-object-preview-expected.txt
@@ -0,0 +1,97 @@
+CONSOLE MESSAGE: line 9: Mutating object in a loop
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 13: [object Object]
+CONSOLE MESSAGE: line 16: Mutating array in a loop
+CONSOLE MESSAGE: line 20: 0,0,0
+CONSOLE MESSAGE: line 20: 0,0,1
+CONSOLE MESSAGE: line 20: 0,0,2
+CONSOLE MESSAGE: line 23: Object with many properties
+CONSOLE MESSAGE: line 28: [object Object]
+CONSOLE MESSAGE: line 30: Array with many properties
+CONSOLE MESSAGE: line 35: 0,1
+CONSOLE MESSAGE: line 37: Array with gaps and overflow
+CONSOLE MESSAGE: line 42: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,14,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,16,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,18,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,19,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,21,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,22,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,23,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,25,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,26,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,27,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,28,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,31,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,32,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,36,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,37,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,38,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,40,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,41,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,42,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,43,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,44,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,45,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,46,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,47,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,48,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,49,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,51,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,52,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,53,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,54,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,56,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,58,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,59,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,60,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,61,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,62,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,63,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,64,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,65,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,66,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,67,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,68,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,69,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,70,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,71,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,73,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,74,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,75,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,76,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,77,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,78,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,79,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,80,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,81,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,82,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,83,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,85,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,86,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,87,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,89,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,90,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,91,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,92,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,93,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,94,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,95,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,96,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,97,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,98,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,99,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,100
+CONSOLE MESSAGE: line 44: Array with gaps without overflow
+CONSOLE MESSAGE: line 49: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,2,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,6,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,7,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,9,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,10,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,12,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,13,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,14,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,15,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,16,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,17,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,18,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,19,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,20,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,21,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,22,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,23,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,24,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,25,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,26,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,27,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,28,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,29,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,30,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,31,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,32,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,34,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,35,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,36,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,37,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,38,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,39,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,40,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,41,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,42,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,43,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,44,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,45,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,46,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,47,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,48,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,49,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,51,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,52,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,53,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,54,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,55,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,56,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,57,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,58,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,59,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,60,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,61,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,62,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,63,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,64,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,65,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,66,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,67,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,68,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,69,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,70,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,71,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,72,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,73,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,74,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,75,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,76,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,77,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,78,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,79,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,80,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,81,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,82,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,83,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,84,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,85,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,86,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,87,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,89,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,90,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,91,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,92,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,93,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,94,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,95,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,96,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,97,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,98
+CONSOLE MESSAGE: line 51: Object with proto
+CONSOLE MESSAGE: line 54: [object Object]
+CONSOLE MESSAGE: line 56: Sparse array
+CONSOLE MESSAGE: line 59: ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,50,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+CONSOLE MESSAGE: line 61: Dense array with indexes and propeties
+CONSOLE MESSAGE: line 67: 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149
+CONSOLE MESSAGE: line 69: Object with properties containing whitespaces
+CONSOLE MESSAGE: line 76: [object Object]
+CONSOLE MESSAGE: line 78: Object with a document.all property
+CONSOLE MESSAGE: line 79: [object Object]
+CONSOLE MESSAGE: line 81: Object with special numbers
+CONSOLE MESSAGE: line 83: [object Object]
+CONSOLE MESSAGE: line 85: Object with exactly 5 properties: expected to be lossless
+CONSOLE MESSAGE: line 86: [object Object]
+CONSOLE MESSAGE: line 88: [object Object]
+Tests that console produces instant previews for arrays and objects.
+
+console-object-preview.html:9 Mutating object in a loop console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:13 Object {a: 0, b: 0, c: 0} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:13 Object {a: 0, b: 0, c: 1} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:13 Object {a: 0, b: 0, c: 2} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:16 Mutating array in a loop console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:20 [0, 0, 0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-number > object-value-number > object-value-number > children
+console-object-preview.html:20 [0, 0, 1] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-number > object-value-number > object-value-number > children
+console-object-preview.html:20 [0, 0, 2] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-number > object-value-number > object-value-number > children
+console-object-preview.html:23 Object with many properties console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:28 Object {property_0: 0, property_1: 1, property_2: 2, property_3: 3, property_4: 4…} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:30 Array with many properties console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:35 [0, 1, property_0: 0, property_1: 1, property_2: 2, property_3: 3, property_4: 4…] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-number > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:37 Array with gaps and overflow console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:42 [32: 0, 89: 1, 146: 2, 203: 3, 260: 4, 317: 5, 374: 6, 431: 7, 488: 8, 545: 9, 602: 10, 659: 11, 716: 12, 773: 13, 830: 14, 887: 15, 944: 16, 1001: 17, 1058: 18, 1115: 19, 1172: 20, 1229: 21, 1286: 22, 1343: 23, 1400: 24, 1457: 25, 1514: 26, 1571: 27, 1628: 28, 1685: 29, 1742: 30, 1799: 31, 1856: 32, 1913: 33, 1970: 34, 2027: 35, 2084: 36, 2141: 37, 2198: 38, 2255: 39, 2312: 40, 2369: 41, 2426: 42, 2483: 43, 2540: 44, 2597: 45, 2654: 46, 2711: 47, 2768: 48, 2825: 49, 2882: 50, 2939: 51, 2996: 52, 3053: 53, 3110: 54, 3167: 55, 3224: 56, 3281: 57, 3338: 58, 3395: 59, 3452: 60, 3509: 61, 3566: 62, 3623: 63, 3680: 64, 3737: 65, 3794: 66, 3851: 67, 3908: 68, 3965: 69, 4022: 70, 4079: 71, 4136: 72, 4193: 73, 4250: 74, 4307: 75, 4364: 76, 4421: 77, 4478: 78, 4535: 79, 4592: 80, 4649: 81, 4706: 82, 4763: 83, 4820: 84, 4877: 85, 4934: 86, 4991: 87, 5048: 88, 5105: 89, 5162: 90, 5219: 91, 5276: 92, 5333: 93, 5390: 94, 5447: 95, 5504: 96, 5561: 97, 5618: 98, 5675: 99…] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:44 Array with gaps without overflow console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:49 [undefined × 32, 0, undefined × 56, 1, undefined × 56, 2, undefined × 56, 3, undefined × 56, 4, undefined × 56, 5, undefined × 56, 6, undefined × 56, 7, undefined × 56, 8, undefined × 56, 9, undefined × 56, 10, undefined × 56, 11, undefined × 56, 12, undefined × 56, 13, undefined × 56, 14, undefined × 56, 15, undefined × 56, 16, undefined × 56, 17, undefined × 56, 18, undefined × 56, 19, undefined × 56, 20, undefined × 56, 21, undefined × 56, 22, undefined × 56, 23, undefined × 56, 24, undefined × 56, 25, undefined × 56, 26, undefined × 56, 27, undefined × 56, 28, undefined × 56, 29, undefined × 56, 30, undefined × 56, 31, undefined × 56, 32, undefined × 56, 33, undefined × 56, 34, undefined × 56, 35, undefined × 56, 36, undefined × 56, 37, undefined × 56, 38, undefined × 56, 39, undefined × 56, 40, undefined × 56, 41, undefined × 56, 42, undefined × 56, 43, undefined × 56, 44, undefined × 56, 45, undefined × 56, 46, undefined × 56, 47, undefined × 56, 48, undefined × 56, 49, un console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > object-value-undefined > object-value-number > children
+console-object-preview.html:51 Object with proto console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:54 Object {d: 1} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > children
+console-object-preview.html:56 Sparse array console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:59 [undefined × 50, 50, undefined × 99] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-undefined > object-value-number > object-value-undefined > children
+console-object-preview.html:61 Dense array with indexes and propeties console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:67 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99…] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > object-value-number > children
+console-object-preview.html:69 Object with properties containing whitespaces console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:76 Object {" a b ": " a b ", c d: "c d", "": "", "  ": "  ", "a↵↵b↵c": "a↵↵b↵c"} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-string > name > object-value-string > name > object-value-string > name > object-value-string > name > object-value-string > children
+console-object-preview.html:78 Object with a document.all property console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:79 Object {all: HTMLAllCollection[7]} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-array > children
+console-object-preview.html:81 Object with special numbers console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:83 Object {nan: NaN, posInf: Infinity, negInf: -Infinity, negZero: -0} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:85 Object with exactly 5 properties: expected to be lossless console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:86 Object {a: 1, b: 2, c: 3, d: 4, e: 5} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > name > object-value-number > children
+console-object-preview.html:88 Object {null: null, undef: undefined, regexp: /^[regexp]$/g, bool: false} console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element > selection fill > console-object-preview > name > object-value-null > name > object-value-undefined > name > object-value-regexp > name > object-value-boolean > children
+Expanded all messages
+console-object-preview.html:9 Mutating object in a loop console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:13 Objecta: 0b: 0c: 2__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:13 Objecta: 0b: 0c: 2__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:13 Objecta: 0b: 0c: 2__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:16 Mutating array in a loop console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:20 Array[3]0: 01: 02: 2length: 3__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:20 Array[3]0: 01: 02: 2length: 3__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:20 Array[3]0: 01: 02: 2length: 3__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:23 Object with many properties console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:28 Objectproperty_0: 0property_1: 1property_2: 2property_3: 3property_4: 4property_5: 5property_6: 6property_7: 7property_8: 8property_9: 9__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:30 Array with many properties console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:35 Array[2]0: 01: 1property_0: 0property_1: 1property_2: 2property_3: 3property_4: 4property_5: 5property_6: 6property_7: 7property_8: 8property_9: 9length: 2__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:37 Array with gaps and overflow console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:42 Array[5733][32 … 5675]5732: 100length: 5733__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent object-properties-section-name > selection fill > tree-element-title > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:44 Array with gaps without overflow console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:49 Array[5619]32: 089: 1146: 2203: 3260: 4317: 5374: 6431: 7488: 8545: 9602: 10659: 11716: 12773: 13830: 14887: 15944: 161001: 171058: 181115: 191172: 201229: 211286: 221343: 231400: 241457: 251514: 261571: 271628: 281685: 291742: 301799: 311856: 321913: 331970: 342027: 352084: 362141: 372198: 382255: 392312: 402369: 412426: 422483: 432540: 442597: 452654: 462711: 472768: 482825: 492882: 502939: 512996: 523053: 533110: 543167: 553224: 563281: 573338: 583395: 593452: 603509: 613566: 623623: 633680: 643737: 653794: 663851: 673908: 683965: 694022: 704079: 714136: 724193: 734250: 744307: 754364: 764421: 774478: 784535: 794592: 804649: 814706: 824763: 834820: 844877: 854934: 864991: 875048: 885105: 895162: 905219: 915276: 925333: 935390: 945447: 955504: 965561: 975618: 98length: 5619__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:51 Object with proto console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:54 Objectd: 1__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:56 Sparse array console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:59 Array[150]50: 50length: 150__proto__: Array[0] console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:61 Dense array with indexes and propeties console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:67 Array[150][0 … 99][100 … 149]property_0: 0property_1: 1property_2: 2property_3: 3property_4: 4property_5: 5property_6: 6property_7: 7property_8: 8property_9: 9property_10: 10property_11: 11property_12: 12property_13: 13property_14: 14property_15: 15property_16: 16property_17: 17property_18: 18property_19: 19property_20: 20property_21: 21property_22: 22property_23: 23property_24: 24property_25: 25property_26: 26property_27: 27property_28: 28property_29: 29property_30: 30property_31: 31property_32: 32property_33: 33property_34: 34property_35: 35property_36: 36property_37: 37property_38: 38property_39: 39property_40: 40property_41: 41property_42: 42property_43: 43property_44: 44property_45: 45property_46: 46property_47: 47property_48: 48property_49: 49property_50: 50property_51: 51property_52: 52property_53: 53property_54: 54property_55: 55property_56: 56property_57: 57property_58: 58property_59: 59property_60: 60property_61: 61property_62: 62property_63: 63property_64: 64property_ console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-array source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent object-properties-section-name > selection fill > tree-element-title > children > parent object-properties-section-name > selection fill > tree-element-title > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-array value > children
+console-object-preview.html:69 Object with properties containing whitespaces console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:76 Object"": """  ": "  "" a b ": " a b ""a↵↵b↵c": "a↵↵b↵c"c d: "c d"__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-string value > object-value-string-quote > object-value-string-quote > children > selection fill > name > object-properties-section-separator > object-value-string value > object-value-string-quote > object-value-string-quote > children > selection fill > name > object-properties-section-separator > object-value-string value > object-value-string-quote > object-value-string-quote > children > selection fill > name > object-properties-section-separator > object-value-string value > object-value-string-quote > object-value-string-quote > children > selection fill > name > object-properties-section-separator > object-value-string value > object-value-string-quote > object-value-string-quote > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:78 Object with a document.all property console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:79 Objectall: HTMLAllCollection[7]__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > parent > selection fill > name > object-properties-section-separator > object-value-array value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:81 Object with special numbers console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:83 Objectnan: NaNnegInf: -InfinitynegZero: -0posInf: Infinity__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:85 Object with exactly 5 properties: expected to be lossless console-message > source-code > console-message-anchor > devtools-link > console-message-text
+console-object-preview.html:86 Objecta: 1b: 2c: 3d: 4e: 5__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > selection fill > name > object-properties-section-separator > object-value-number value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+console-object-preview.html:88 Objectbool: falsenull: nullregexp: /^[regexp]$/gundef: undefined__proto__: Object console-message > source-code > console-message-anchor > devtools-link > console-message-text > console-view-object-properties-section object-value-object source-code expanded > tree-outline-disclosure tree-outline-disclosure-hide-overflow > tree-outline source-code object-properties-section > parent object-properties-section-root-element expanded > selection fill > object-state-note info-note > children expanded > selection fill > name > object-properties-section-separator > object-value-boolean value > children > selection fill > name > object-properties-section-separator > object-value-null value > children > parent > selection fill > name > object-properties-section-separator > object-value-regexp value > children > selection fill > name > object-properties-section-separator > object-value-undefined value > children > parent > selection fill > name object-properties-section-dimmed > object-properties-section-separator > object-value-object value > children
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-on-paint-worklet-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-on-paint-worklet-expected.txt
new file mode 100644
index 0000000..803d117
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-on-paint-worklet-expected.txt
@@ -0,0 +1,11 @@
+CONSOLE INFO: line 1: Information
+CONSOLE MESSAGE: line 2: Log
+CONSOLE WARNING: line 3: Warning
+Tests console output from PaintWorklet.
+
+Message count: 3
+console-worklet-script.js:1 Information
+console-worklet-script.js:2 Log
+console-worklet-script.js:3 Warning
+(anonymous) @ console-worklet-script.js:3
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-save-to-temp-var-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-save-to-temp-var-expected.txt
new file mode 100644
index 0000000..db6a0d2e
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-save-to-temp-var-expected.txt
@@ -0,0 +1,28 @@
+Tests saving objects to temporary variables.
+
+Number of expressions: 11
+Names [temp3..temp7] are reserved
+
+temp1
+42
+temp2
+"foo string"
+temp8
+NaN
+temp9
+Infinity
+temp10
+-Infinity
+temp11
+-0
+temp12
+[1, 2, NaN, -0, null, undefined]
+temp13
+Object {foo: "bar"}
+temp14
+[1, 2, 3, 4]
+temp15
+function func() {}
+temp16
+Error: errr
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-tainted-globals-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-tainted-globals-expected.txt
new file mode 100644
index 0000000..d7429ca
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-tainted-globals-expected.txt
@@ -0,0 +1,45 @@
+Tests that overriding global methods (like Array.prototype.push, Math.max) will not break the inspector.
+
+
+Running: evaluateInConsole
+
+Running: testRuntimeAgentCallFunctionOn
+
+Running: dumpConsoleMessages
+testOverriddenArrayPushAndMathMax()
+[1, 2, 3]
+testOverriddenConstructorName()
+Object {constructor: Object}
+testThrowConstructorName()
+Object {}
+testOverriddenIsFinite()
+["arg1", "arg2"]
+testOverriddenError()
+Object {result: "PASS"}
+restoreError()
+Object {result: "PASS"}
+testOverriddenToString(function func() {}, true)
+function #<Function>
+testOverriddenToString(function func() {}, false)
+function #<Function>
+testOverriddenToString(new Function, true)
+function #<Function>
+testOverriddenToString(new Function, false)
+function #<Function>
+testOverriddenToString(/^regex$/, true)
+#<RegExp>
+testOverriddenToString(/^regex$/, false)
+#<RegExp>
+testOverriddenToString(new Date, true)
+#<Date>
+testOverriddenToString(new Date, false)
+#<Date>
+testOverriddenToString({}, true)
+Object {}
+testOverriddenToString({}, false)
+Object {}
+testOverriddenToString(new Number(1), true)
+Number {[[PrimitiveValue]]: 1}
+testOverriddenToString(new Number(1), false)
+Number {[[PrimitiveValue]]: 1}
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-tests-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-tests-expected.txt
new file mode 100644
index 0000000..259399c
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-tests-expected.txt
@@ -0,0 +1,55 @@
+CONSOLE MESSAGE: line 9: log
+CONSOLE DEBUG: line 10: debug
+CONSOLE INFO: line 11: info
+CONSOLE WARNING: line 12: warn
+CONSOLE ERROR: line 13: error
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE MESSAGE: line 15: repeated
+CONSOLE DEBUG: line 17: count: 1
+CONSOLE DEBUG: line 17: count: 2
+CONSOLE MESSAGE: line 18: group
+CONSOLE MESSAGE: line 19: console.groupEnd
+CONSOLE MESSAGE: line 20: 1
+CONSOLE MESSAGE: line 21: groupCollapsed
+CONSOLE MESSAGE: line 22: [object Object]
+CONSOLE MESSAGE: line 23: 42
+CONSOLE MESSAGE: line 24: true
+CONSOLE MESSAGE: line 25: null
+CONSOLE MESSAGE: line 26: undefined
+CONSOLE MESSAGE: line 27: [object HTMLDocument]
+CONSOLE MESSAGE: line 28: function () { }
+CONSOLE MESSAGE: line 29: function f() { }
+CONSOLE MESSAGE: line 30: 1,2,3
+CONSOLE MESSAGE: line 31: /regexp.*/
+CONSOLE MESSAGE: line 32: console.groupEnd
+CONSOLE DEBUG: line 33: : 1
+CONSOLE DEBUG: line 34: : 1
+CONSOLE DEBUG: line 35: : 1
+CONSOLE DEBUG: line 36: title: 1
+CONSOLE DEBUG: line 37: title: 2
+CONSOLE DEBUG: line 38: title: 3
+Tests that console logging dumps proper messages.
+
+console-tests.html:9 log console-message-wrapper console-info-level > console-message
+console-tests.html:10 debug console-message-wrapper console-verbose-level > console-message
+console-tests.html:11 info console-message-wrapper console-info-level > console-message
+console-tests.html:12 warn
+onload @ console-tests.html:12 console-message-wrapper console-warning-level > console-message
+console-tests.html:13 error
+onload @ console-tests.html:13 console-message-wrapper console-error-level > console-message
+5console-tests.html:15 repeated console-message-wrapper console-info-level > console-message repeated-message
+console-tests.html:17 count: 1 console-message-wrapper console-verbose-level > console-message
+console-tests.html:17 count: 2 console-message-wrapper console-verbose-level > console-message
+console-tests.html:18 group console-message-wrapper console-info-level > console-message console-group-title
+console-tests.html:20 1 2 3 console-message-wrapper console-info-level > console-message
+console-tests.html:21 groupCollapsed console-message-wrapper console-info-level > console-message console-group-title
+console-tests.html:33 : 1 console-message-wrapper console-verbose-level > console-message
+console-tests.html:34 : 1 console-message-wrapper console-verbose-level > console-message
+console-tests.html:35 : 1 console-message-wrapper console-verbose-level > console-message
+console-tests.html:36 title: 1 console-message-wrapper console-verbose-level > console-message
+console-tests.html:37 title: 2 console-message-wrapper console-verbose-level > console-message
+console-tests.html:38 title: 3 console-message-wrapper console-verbose-level > console-message
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-uncaught-promise-in-worker-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-uncaught-promise-in-worker-expected.txt
new file mode 100644
index 0000000..443716b4
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-uncaught-promise-in-worker-expected.txt
@@ -0,0 +1,7 @@
+CONSOLE ERROR: line 3: Uncaught (in promise) Error: err1
+CONSOLE ERROR: line 21: Uncaught (in promise) Error: err2
+Tests that uncaught promise rejections happenned in workers are logged into console.
+
+worker-with-unhandled-promises.js:3 Uncaught (in promise) Error: err1
+worker-with-unhandled-promises.js:21 Uncaught (in promise) Error: err2
+
diff --git a/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-worker-nested-imports-syntax-error-expected.txt b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-worker-nested-imports-syntax-error-expected.txt
new file mode 100644
index 0000000..a25b8a2
--- /dev/null
+++ b/third_party/WebKit/Source/devtools/tests/baseline/protocol-1.2/inspector/console/console-worker-nested-imports-syntax-error-expected.txt
@@ -0,0 +1,6 @@
+CONSOLE ERROR: line 1: Uncaught SyntaxError: Unexpected identifier
+Tests that nested import scripts in worker show correct stack on syntax error.
+
+Message count: 1
+invalidScript.js:1 Uncaught SyntaxError: Unexpected identifier
+
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParam.idl b/third_party/WebKit/Source/modules/webaudio/AudioParam.idl
index f604805..d95a028c3 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParam.idl
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.idl
@@ -51,6 +51,6 @@
     [RaisesException, MeasureAs=AudioParamCancelScheduledValues] AudioParam cancelScheduledValues(double startTime);
 
     // Cancel scheduled parameter changes and hold the last value
-    [RaisesException] AudioParam cancelAndHoldAtTime(double startTime);
+    [RaisesException, MeasureAs=AudioParamCancelAndHoldAtTime] AudioParam cancelAndHoldAtTime(double startTime);
 
 };
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
index 6933ca4..442173fb 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
@@ -48,40 +48,12 @@
 
     executable_name = 'git'
 
-    def __init__(self, cwd=None, executive=None, filesystem=None):
+    def __init__(self, cwd, executive=None, filesystem=None):
+        self.cwd = cwd
         self._executive = executive or Executive()
         self._filesystem = filesystem or FileSystem()
-
-        self.cwd = cwd or self._filesystem.abspath(self._filesystem.getcwd())
-        if not Git.in_working_directory(self.cwd, executive=self._executive):
-            module_directory = self._filesystem.abspath(
-                self._filesystem.dirname(self._filesystem.path_to_module(self.__module__)))
-            _log.info('The current directory (%s) is not in a git repo, trying directory %s.',
-                      cwd, module_directory)
-            if Git.in_working_directory(module_directory, executive=self._executive):
-                self.cwd = module_directory
-            _log.error('Failed to find Git repo for %s or %s', cwd, module_directory)
-
-        self._init_executable_name()
         self.checkout_root = self.find_checkout_root(self.cwd)
 
-    def _init_executable_name(self):
-        # FIXME: This is a hack and should be removed.
-        try:
-            self._executive.run_command(['git', 'help'])
-        except OSError:
-            try:
-                self._executive.run_command(['git.bat', 'help'])
-                # The Win port uses the depot_tools package, which contains a number
-                # of development tools, including Python and git. Instead of using a
-                # real git executable, depot_tools indirects via a batch file, called
-                # "git.bat". This batch file allows depot_tools to auto-update the real
-                # git executable, which is contained in a subdirectory.
-                _log.debug('Engaging git.bat Windows hack.')
-                self.executable_name = 'git.bat'
-            except OSError:
-                _log.debug('Failed to engage git.bat Windows hack.')
-
     def _run_git(self,
                  command_args,
                  cwd=None,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git_mock.py
index 2f887ce..707f3de 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git_mock.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git_mock.py
@@ -13,9 +13,8 @@
 
     executable_name = 'mock-git'
 
-    def __init__(self, cwd=None, filesystem=None, executive=None):
+    def __init__(self, filesystem=None, executive=None):
         self.checkout_root = '/mock-checkout'
-        self.cwd = cwd or self.checkout_root
         self.added_paths = set()
         self._filesystem = filesystem or MockFileSystem()
         self._executive = executive or MockExecutive()
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py
index 8fbb7871..9f31e25 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/host.py
@@ -28,11 +28,12 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 import logging
+import sys
 
 from webkitpy.common.checkout.scm.git import Git
 from webkitpy.common.config.builders import BUILDERS
-from webkitpy.common.net import web
 from webkitpy.common.net.buildbot import BuildBot
+from webkitpy.common.net import web
 from webkitpy.common.system.system_host import SystemHost
 from webkitpy.layout_tests.builder_list import BuilderList
 from webkitpy.layout_tests.port.factory import PortFactory
@@ -76,9 +77,58 @@
         self.environ['LC_MESSAGES'] = 'en_US.UTF-8'
         self.environ['LC_ALL'] = ''
 
-    def scm(self, path=None):
-        if path:
-            return Git(cwd=path, executive=self.executive, filesystem=self.filesystem)
-        if not self._scm:
-            self._scm = Git(filesystem=self.filesystem, executive=self.executive)
+    # FIXME: This is a horrible, horrible hack for WinPort and should be removed.
+    # Maybe this belongs in Git in some more generic "find the git binary" codepath?
+    # Or possibly Executive should have a way to emulate shell path-lookups?
+    # FIXME: Unclear how to test this, since it currently mutates global state on Git.
+    def _engage_awesome_windows_hacks(self):
+        try:
+            self.executive.run_command(['git', 'help'])
+        except OSError:
+            try:
+                self.executive.run_command(['git.bat', 'help'])
+                # The Win port uses the depot_tools package, which contains a number
+                # of development tools, including Python and git. Instead of using a
+                # real git executable, depot_tools indirects via a batch file, called
+                # git.bat. This batch file allows depot_tools to auto-update the real
+                # git executable, which is contained in a subdirectory.
+                #
+                # That's all fine and good, except that subprocess.popen can detect
+                # the difference between a real git executable and batch file when we
+                # don't provide use shell=True. Rather than use shell=True on Windows,
+                # We hack the git.bat name into the SVN class.
+                _log.debug('Engaging git.bat Windows hack.')
+                Git.executable_name = 'git.bat'
+            except OSError:
+                _log.debug('Failed to engage git.bat Windows hack.')
+
+    def initialize_scm(self):
+        # TODO(qyearsley): Refactor this so that scm is initialized
+        # when self.scm() is called the first time; put any initialization
+        # code in the git module.
+        if sys.platform == 'win32':
+            self._engage_awesome_windows_hacks()
+
+        cwd = self.filesystem.abspath(self.filesystem.getcwd())
+        if Git.in_working_directory(cwd, executive=self.executive):
+            self._scm = Git(cwd=cwd, filesystem=self.filesystem, executive=self.executive)
+            return
+
+        script_directory = self.filesystem.abspath(
+            self.filesystem.dirname(self.filesystem.path_to_module(self.__module__)))
+        _log.info('The current directory (%s) is not in a git repo, trying script directory %s.', cwd, script_directory)
+        if Git.in_working_directory(script_directory, executive=self.executive):
+            self._scm = Git(cwd=script_directory, filesystem=self.filesystem, executive=self.executive)
+            return
+
+        raise Exception('FATAL: Failed to find Git repo for %s or %s' % (cwd, script_directory))
+
+    def scm(self,):
         return self._scm
+
+    def scm_for_path(self, path):
+        # FIXME: make scm() be a wrapper around this, and clean up the way
+        # callers call initialize_scm() (to remove patch_directories) and scm().
+        if sys.platform == "win32":
+            self._engage_awesome_windows_hacks()
+        return Git(cwd=path, executive=self.executive, filesystem=self.filesystem)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
index b204e2d2..7bfd8901 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/host_mock.py
@@ -42,6 +42,7 @@
 
     def __init__(self,
                  log_executive=False,
+                 initialize_scm_by_default=True,
                  web=None,
                  scm=None,
                  os_name=None,
@@ -55,8 +56,13 @@
 
         add_unit_tests_to_mock_filesystem(self.filesystem)
         self.web = web or MockWeb()
-        self._scm = scm
 
+        self._scm = scm
+        # TODO(qyearsley): we should never initialize the SCM by default, since
+        # the real object doesn't either. This has caused at least one bug
+        # (see bug 89498).
+        if initialize_scm_by_default:
+            self.initialize_scm()
         self.buildbot = MockBuildBot()
 
         # Note: We're using a real PortFactory here.  Tests which don't wish to depend
@@ -65,12 +71,17 @@
 
         self.builders = BuilderList(BUILDERS)
 
-    def scm(self, path=None):
-        if path:
-            return MockGit(cwd=path, filesystem=self.filesystem, executive=self.executive)
+    def initialize_scm(self, patch_directories=None):
         if not self._scm:
             self._scm = MockGit(filesystem=self.filesystem, executive=self.executive)
         # Various pieces of code (wrongly) call filesystem.chdir(checkout_root).
         # Making the checkout_root exist in the mock filesystem makes that chdir not raise.
         self.filesystem.maybe_make_directory(self._scm.checkout_root)
+
+    def scm(self):
+        return self._scm
+
+    def scm_for_path(self, path):
+        # FIXME: consider supporting more than one SCM so that we can do more comprehensive testing.
+        self.initialize_scm()
         return self._scm
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 d44c592..7c3a438 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
@@ -341,7 +341,7 @@
     results['chromium_revision'] = ''
     if port_obj.get_option('builder_name'):
         path = port_obj.repository_path()
-        scm = port_obj.host.scm(path=path)
+        scm = port_obj.host.scm_for_path(path)
         if scm:
             results['chromium_revision'] = str(scm.commit_position(path))
         else:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py
index 5cf8ca4b..432e43d1 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results_unittest.py
@@ -188,7 +188,7 @@
 class SummarizedResultsTest(unittest.TestCase):
 
     def setUp(self):
-        host = MockHost()
+        host = MockHost(initialize_scm_by_default=False)
         self.port = host.port_factory.get(port_name='test')
 
     def test_no_chromium_revision(self):
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
index 6c6ffd2..4d2ae5b 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
@@ -63,6 +63,7 @@
         else:
             self._host = Host()
             self._port = self._host.port_factory.get(self._options.platform, self._options)
+        self._host.initialize_scm()
         self._webkit_base_dir_len = len(self._port.webkit_base())
         self._base_path = self._port.perf_tests_dir()
         self._timestamp = time.time()
@@ -261,7 +262,7 @@
     def _generate_results_dict(self, timestamp, description, platform, builder_name, build_number):
         revisions = {}
         path = self._port.repository_path()
-        git = self._host.scm(path=path)
+        git = self._host.scm_for_path(path)
         revision = str(git.commit_position(path))
         revisions['chromium'] = {'revision': revision, 'timestamp': git.timestamp_of_revision(path, revision)}
 
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
index c8b8051..2d08062 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py
@@ -47,6 +47,7 @@
 
         # FIXME: host should be a required parameter, not an optional one.
         host = host or Host()
+        host.initialize_scm()
 
         self._port_obj = host.port_factory.get()
 
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py b/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py
index 65efd03..2eed34c 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/style/main.py
@@ -125,6 +125,7 @@
         args = sys.argv[1:]
 
         host = Host()
+        host.initialize_scm()
 
         stderr = self._engage_awesome_stderr_hacks()
 
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py
index c1015eb1..11d3982c 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/bot/commit_announcer.py
@@ -50,7 +50,7 @@
     def __init__(self, tool, announce_path, irc_password):
         SingleServerIRCBot.__init__(self, [(SERVER, PORT, irc_password)], NICKNAME, NICKNAME)
         self.announce_path = announce_path
-        self.git = tool.scm(path=tool.scm().checkout_root)
+        self.git = Git(cwd=tool.scm().checkout_root, filesystem=tool.filesystem, executive=tool.executive)
         self.commands = {
             'help': self.help,
             'ping': self.ping,
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py
index e154f19e..dd29430c 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_server.py
@@ -82,6 +82,7 @@
     def _prepare_config(self, options, args, tool):
         results_directory = args[0]
         host = Host()
+        host.initialize_scm()
 
         print 'Parsing full_results.json...'
         results_json_path = host.filesystem.join(results_directory, 'full_results.json')
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py
index 4c5ebcc..b300451 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/webkit_patch.py
@@ -65,9 +65,6 @@
 
 
 class WebKitPatch(Host):
-    # FIXME: It might make more sense if this class had a Host attribute
-    # instead of being a Host subclass.
-
     global_options = [
         optparse.make_option(
             "-v", "--verbose", action="store_true", dest="verbose", default=False,
@@ -115,6 +112,7 @@
 
         command.set_option_parser(option_parser)
         (options, args) = command.parse_args(args)
+        self.initialize_scm()
 
         (should_execute, failure_reason) = self._should_execute_command(command)
         if not should_execute:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
index 2a875e9a..cd5c166 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_importer.py
@@ -39,6 +39,7 @@
 
     def __init__(self, host):
         self.host = host
+        self.host.initialize_scm()
         self.executive = host.executive
         self.fs = host.filesystem
         self.finder = WebKitFinder(self.fs)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py
index 2d581fc..3444b17 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py
@@ -28,6 +28,7 @@
 
     def __init__(self, host):
         self.host = host
+        self.host.initialize_scm()
         self.finder = WebKitFinder(self.host.filesystem)
 
     def run(self, args=None):
diff --git a/third_party/kasko/BUILD.gn b/third_party/kasko/BUILD.gn
deleted file mode 100644
index e32e7f7..0000000
--- a/third_party/kasko/BUILD.gn
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2015 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("//build/buildflag_header.gni")
-import("//build/config/chrome_build.gni")
-import("//third_party/kasko/kasko.gni")
-
-buildflag_header("kasko_features") {
-  header = "kasko_features.h"
-  flags = [ "ENABLE_KASKO=$enable_kasko" ]
-}
-
-if (enable_kasko) {
-  assert(is_win, "Kasko only support Windows.")
-  assert(target_cpu == "x86", "Kasko only support 32 bits.")
-
-  # TODO(sebmarchand): Fix this once the Kasko dependency in SyzyAsan has been
-  #     removed for the non-official builds.
-  #assert(is_chrome_branded,
-  #       "The Kasko client is only initialized in Chrome-branded builds.")
-
-  config("kasko_config") {
-    visibility = [ ":*" ]
-    include_dirs = [ "//third_party/kasko/binaries/include" ]
-    lib_dirs = [ "//third_party/kasko/binaries" ]
-    libs = [ "kasko.dll.lib" ]
-  }
-
-  copy("copy_kasko_dll") {
-    visibility = [ ":*" ]
-    sources = [
-      "//third_party/kasko/binaries/kasko.dll",
-      "//third_party/kasko/binaries/kasko.dll.pdb",
-    ]
-    outputs = [
-      "$root_out_dir/{{source_file_part}}",
-    ]
-  }
-
-  group("kasko") {
-    public_deps = [
-      ":copy_kasko_dll",
-      ":kasko_features",
-    ]
-    public_configs = [ ":kasko_config" ]
-  }
-} else {
-  group("kasko") {
-    public_deps = [
-      ":kasko_features",
-    ]
-  }
-}
diff --git a/third_party/kasko/OWNERS b/third_party/kasko/OWNERS
deleted file mode 100644
index 71dc7187..0000000
--- a/third_party/kasko/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-chrisha@chromium.org
-pmonette@chromium.org
-siggi@chromium.org
diff --git a/third_party/kasko/kasko.gni b/third_party/kasko/kasko.gni
deleted file mode 100644
index 6e6c831d..0000000
--- a/third_party/kasko/kasko.gni
+++ /dev/null
@@ -1,9 +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.
-
-import("//build/config/sanitizers/sanitizers.gni")
-
-# Enable the Kasko crash reporter. Enabled by default on Syzyasan official
-# build.
-enable_kasko = is_official_build && is_syzyasan
diff --git a/tools/gn/misc/vim/syntax/gn.vim b/tools/gn/misc/vim/syntax/gn.vim
index 55f1852..0fbd6e0 100644
--- a/tools/gn/misc/vim/syntax/gn.vim
+++ b/tools/gn/misc/vim/syntax/gn.vim
@@ -52,8 +52,10 @@
 hi def link     gnVariable          Keyword
 
 " Strings
-syn region	    gnString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
+syn region      gnString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell,gnTargetName
+syn match       gnTargetName '\v:[^"]+' contained
 hi def link     gnString            String
+hi def link     gnTargetName        Special
 
 " Comments
 syn keyword     gnTodo              contained TODO FIXME XXX BUG NOTE
diff --git a/tools/licenses.py b/tools/licenses.py
index b7ea2334..5b68d5d 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -47,7 +47,6 @@
     os.path.join('third_party','gnu_binutils'),
     os.path.join('third_party','gold'),
     os.path.join('third_party','gperf'),
-    os.path.join('third_party','kasko'),
     os.path.join('third_party','lighttpd'),
     os.path.join('third_party','llvm'),
     os.path.join('third_party','llvm-build'),
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 0456101c..730bbde 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -8486,6 +8486,9 @@
 </histogram>
 
 <histogram name="CrashReport.PermanentUploadFailure" enum="BooleanHit">
+  <obsolete>
+    Deprecated 01/2017 in Issue 680162 with the removal of Kasko.
+  </obsolete>
   <owner>siggi@chromium.org</owner>
   <summary>
     Counts crash reports that the Kasko crash reporter fails to upload and hands
@@ -71928,6 +71931,13 @@
   </summary>
 </histogram>
 
+<histogram name="V8.AsmWasmTranslationMicroSeconds" units="microseconds">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <owner>aseemgarg@chromium.org</owner>
+  <summary>Time to convert asm.js code to WebAssembly.</summary>
+</histogram>
+
 <histogram name="V8.ASTOptimization">
   <obsolete>
     This histogram is no longer present in V8.
@@ -72566,6 +72576,84 @@
   <summary>TBD</summary>
 </histogram>
 
+<histogram name="V8.WasmCompileFunctionMicroSeconds" units="microseconds">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Time to compile a WebAssembly function.</summary>
+</histogram>
+
+<histogram name="V8.WasmCompileFunctionPeakMemoryBytes" units="bytes">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Peak memory used to compile a WebAssembly function.</summary>
+</histogram>
+
+<histogram name="V8.WasmCompileModuleMicroSeconds" units="microseconds">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Time to compile a WebAssembly module.</summary>
+</histogram>
+
+<histogram name="V8.WasmDecodeFunctionMicroSeconds" units="microseconds">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Time to decode a WebAssembly function.</summary>
+</histogram>
+
+<histogram name="V8.WasmDecodeModuleMicroSeconds" units="microseconds">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Time to decode a WebAssembly module.</summary>
+</histogram>
+
+<histogram name="V8.WasmDecodeModulePeakMemoryBytes" units="bytes">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Peak memory used to decode a WebAssembly module.</summary>
+</histogram>
+
+<histogram name="V8.WasmFunctionSizeBytes" units="bytes">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Size of a WebAssembly function.</summary>
+</histogram>
+
+<histogram name="V8.WasmFunctionsPerModule" units="functions">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Function count in each WebAssembly module.</summary>
+</histogram>
+
+<histogram name="V8.WasmInstantiateModuleMicroSeconds" units="microseconds">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Time to instantiate a WebAssembly module.</summary>
+</histogram>
+
+<histogram name="V8.WasmMaxMemPagesCount" units="pages">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>
+    Number of 64KiB pages a WebAssembly module declares as its maximum
+    requirement.
+  </summary>
+</histogram>
+
+<histogram name="V8.WasmMinMemPagesCount" units="pages">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>
+    Number of 64KiB pages a WebAssembly module declares as its minimum
+    requirement.
+  </summary>
+</histogram>
+
+<histogram name="V8.WasmModuleSizeBytes" units="bytes">
+  <owner>bradnelson@chromium.org</owner>
+  <owner>titzer@chromium.org</owner>
+  <summary>Size of a WebAssembly module.</summary>
+</histogram>
+
 <histogram name="Variations.CreateTrials.SeedExpiry"
     enum="VariationsSeedExpiry">
   <owner>asvitkine@chromium.org</owner>
@@ -83872,6 +83960,8 @@
   <int value="16" label="DOM properties expanded"/>
   <int value="17" label="Resized view in responsive mode"/>
   <int value="18" label="Timeline started (page reload)"/>
+  <int value="19" label="Connect to node.js from frontend"/>
+  <int value="20" label="Connect to node.js directly (paste link from CLI)"/>
 </enum>
 
 <enum name="DevToolsPanel" type="int">
@@ -90330,6 +90420,7 @@
   <int value="1794" label="WebNFCCancelPush"/>
   <int value="1795" label="WebNFCWatch"/>
   <int value="1796" label="WebNFCCancelWatch"/>
+  <int value="1797" label="AudioParamCancelAndHoldAtTime"/>
 </enum>
 
 <enum name="FetchRequestMode" type="int">
diff --git a/ui/aura/mus/capture_synchronizer.cc b/ui/aura/mus/capture_synchronizer.cc
index 67dacb4..48b74f96 100644
--- a/ui/aura/mus/capture_synchronizer.cc
+++ b/ui/aura/mus/capture_synchronizer.cc
@@ -14,30 +14,38 @@
 namespace aura {
 
 CaptureSynchronizer::CaptureSynchronizer(CaptureSynchronizerDelegate* delegate,
-                                         ui::mojom::WindowTree* window_tree,
-                                         client::CaptureClient* capture_client)
-    : delegate_(delegate),
-      window_tree_(window_tree),
-      capture_client_(capture_client) {
-  capture_client_->AddObserver(this);
-}
+                                         ui::mojom::WindowTree* window_tree)
+    : delegate_(delegate), window_tree_(window_tree) {}
 
-CaptureSynchronizer::~CaptureSynchronizer() {
-  SetCaptureWindow(nullptr);
-  capture_client_->RemoveObserver(this);
-}
+CaptureSynchronizer::~CaptureSynchronizer() {}
 
 void CaptureSynchronizer::SetCaptureFromServer(WindowMus* window) {
   if (window == capture_window_)
     return;
 
   DCHECK(!setting_capture_);
-  // Don't immediately set |capture_client_|. It's possible the change will be
-  // rejected.
+  // Don't immediately set |capture_window_|. It's possible the change
+  // will be rejected. |capture_window_| is set in OnCaptureChanged() if
+  // capture succeeds.
   base::AutoReset<bool> capture_reset(&setting_capture_, true);
   base::AutoReset<WindowMus*> window_setting_capture_to_reset(
       &window_setting_capture_to_, window);
-  capture_client_->SetCapture(window ? window->GetWindow() : nullptr);
+  client::CaptureClient* capture_client =
+      window ? client::GetCaptureClient(window->GetWindow()->GetRootWindow())
+             : client::GetCaptureClient(
+                   capture_window_->GetWindow()->GetRootWindow());
+  capture_client->SetCapture(window ? window->GetWindow() : nullptr);
+}
+
+void CaptureSynchronizer::AttachToCaptureClient(
+    client::CaptureClient* capture_client) {
+  capture_client->AddObserver(this);
+}
+
+void CaptureSynchronizer::DetachFromCaptureClient(
+    client::CaptureClient* capture_client) {
+  SetCaptureWindow(nullptr);
+  capture_client->RemoveObserver(this);
 }
 
 void CaptureSynchronizer::SetCaptureWindow(WindowMus* window) {
@@ -62,6 +70,17 @@
   if (!gained_capture && !capture_window_)
     return;  // Happens if the window is deleted during notification.
 
+  // Happens if the window that just lost capture is not the most updated window
+  // that has capture to avoid setting the current |capture_window_| to null by
+  // accident. This can occur because CaptureSynchronizer can be the observer
+  // for multiple capture clients; after we set capture for one capture client
+  // and then set capture for another capture client, releasing capture on the
+  // first capture client could potentially reset the |capture_window_| to null
+  // while the correct |capture_window_| should be the capture window for the
+  // second capture client at that time.
+  if (!gained_capture && lost_capture != capture_window_->GetWindow())
+    return;
+
   WindowMus* gained_capture_mus = WindowMus::Get(gained_capture);
   if (setting_capture_ && gained_capture_mus == window_setting_capture_to_) {
     SetCaptureWindow(gained_capture_mus);
diff --git a/ui/aura/mus/capture_synchronizer.h b/ui/aura/mus/capture_synchronizer.h
index 87bce87..4b300160 100644
--- a/ui/aura/mus/capture_synchronizer.h
+++ b/ui/aura/mus/capture_synchronizer.h
@@ -28,12 +28,11 @@
 
 // CaptureSynchronizer is resonsible for keeping capture in sync between aura
 // and the mus server.
-class CaptureSynchronizer : public WindowObserver,
-                            public client::CaptureClientObserver {
+class AURA_EXPORT CaptureSynchronizer : public WindowObserver,
+                                        public client::CaptureClientObserver {
  public:
   CaptureSynchronizer(CaptureSynchronizerDelegate* delegate,
-                      ui::mojom::WindowTree* window_tree,
-                      client::CaptureClient* capture_client);
+                      ui::mojom::WindowTree* window_tree);
   ~CaptureSynchronizer() override;
 
   WindowMus* capture_window() { return capture_window_; }
@@ -41,6 +40,10 @@
   // Called when the server side wants to change capture to |window|.
   void SetCaptureFromServer(WindowMus* window);
 
+  // Called when the |capture_client| has been set or will be unset.
+  void AttachToCaptureClient(client::CaptureClient* capture_client);
+  void DetachFromCaptureClient(client::CaptureClient* capture_client);
+
  private:
   // Internal implementation for capture changes. Adds/removes observer as
   // necessary and sets |capture_window_| to |window|.
@@ -54,7 +57,6 @@
 
   CaptureSynchronizerDelegate* delegate_;
   ui::mojom::WindowTree* window_tree_;
-  client::CaptureClient* capture_client_;
 
   // Window that currently has capture.
   WindowMus* capture_window_ = nullptr;
diff --git a/ui/aura/mus/window_port_mus.cc b/ui/aura/mus/window_port_mus.cc
index 68a4cda3..ac8a12b 100644
--- a/ui/aura/mus/window_port_mus.cc
+++ b/ui/aura/mus/window_port_mus.cc
@@ -66,8 +66,9 @@
   predefined_cursor_ = cursor_id;
 }
 
-void WindowPortMus::SetCanAcceptEvents(bool value) {
-  window_tree_client_->SetCanAcceptEvents(this, value);
+void WindowPortMus::SetEventTargetingPolicy(
+    ui::mojom::EventTargetingPolicy policy) {
+  window_tree_client_->SetEventTargetingPolicy(this, policy);
 }
 
 void WindowPortMus::Embed(
diff --git a/ui/aura/mus/window_port_mus.h b/ui/aura/mus/window_port_mus.h
index c3018a36..5e3921a 100644
--- a/ui/aura/mus/window_port_mus.h
+++ b/ui/aura/mus/window_port_mus.h
@@ -56,8 +56,8 @@
   ui::mojom::Cursor predefined_cursor() const { return predefined_cursor_; }
   void SetPredefinedCursor(ui::mojom::Cursor cursor_id);
 
-  // Sets whether the window can receive events. Default value is true.
-  void SetCanAcceptEvents(bool value);
+  // Sets the EventTargetingPolicy, default is TARGET_AND_DESCENDANTS.
+  void SetEventTargetingPolicy(ui::mojom::EventTargetingPolicy policy);
 
   // Embeds a new client in this Window. See WindowTreeClient::Embed() for
   // details on arguments.
diff --git a/ui/aura/mus/window_tree_client.cc b/ui/aura/mus/window_tree_client.cc
index 5f73fbb..b71391b 100644
--- a/ui/aura/mus/window_tree_client.cc
+++ b/ui/aura/mus/window_tree_client.cc
@@ -234,10 +234,6 @@
   SetWindowTree(std::move(window_tree));
 }
 
-client::CaptureClient* WindowTreeClient::GetCaptureClient() {
-  return delegate_->GetCaptureClient();
-}
-
 void WindowTreeClient::SetCanFocus(Window* window, bool can_focus) {
   DCHECK(tree_);
   DCHECK(window);
@@ -467,8 +463,7 @@
   tree_ = window_tree;
 
   drag_drop_controller_ = base::MakeUnique<DragDropControllerMus>(this, tree_);
-  capture_synchronizer_ =
-      base::MakeUnique<CaptureSynchronizer>(this, tree_, GetCaptureClient());
+  capture_synchronizer_ = base::MakeUnique<CaptureSynchronizer>(this, tree_);
   focus_synchronizer_ = base::MakeUnique<FocusSynchronizer>(this, tree_);
 }
 
@@ -828,10 +823,11 @@
   tree_->SetCanAcceptDrops(window_id, can_accept_drops);
 }
 
-void WindowTreeClient::SetCanAcceptEvents(WindowMus* window,
-                                          bool can_accept_events) {
+void WindowTreeClient::SetEventTargetingPolicy(
+    WindowMus* window,
+    ui::mojom::EventTargetingPolicy policy) {
   DCHECK(tree_);
-  tree_->SetCanAcceptEvents(window->server_id(), can_accept_events);
+  tree_->SetEventTargetingPolicy(window->server_id(), policy);
 }
 
 void WindowTreeClient::OnEmbed(ClientSpecificId client_id,
diff --git a/ui/aura/mus/window_tree_client.h b/ui/aura/mus/window_tree_client.h
index f218b5e..09dc89ba 100644
--- a/ui/aura/mus/window_tree_client.h
+++ b/ui/aura/mus/window_tree_client.h
@@ -68,10 +68,6 @@
 class WindowTreeClientTestObserver;
 class WindowTreeHostMus;
 
-namespace client {
-class CaptureClient;
-}
-
 using EventResultCallback = base::Callback<void(ui::mojom::EventResult)>;
 
 // Manages the connection with mus.
@@ -108,15 +104,17 @@
 
   service_manager::Connector* connector() { return connector_; }
   ui::Gpu* gpu() { return gpu_.get(); }
+  CaptureSynchronizer* capture_synchronizer() {
+    return capture_synchronizer_.get();
+  }
 
   bool connected() const { return tree_ != nullptr; }
   ClientSpecificId client_id() const { return client_id_; }
 
-  client::CaptureClient* GetCaptureClient();
-
   void SetCanFocus(Window* window, bool can_focus);
   void SetCanAcceptDrops(Id window_id, bool can_accept_drops);
-  void SetCanAcceptEvents(WindowMus* window, bool can_accept_events);
+  void SetEventTargetingPolicy(WindowMus* window,
+                               ui::mojom::EventTargetingPolicy policy);
   void SetPredefinedCursor(WindowMus* window,
                            ui::mojom::Cursor old_cursor,
                            ui::mojom::Cursor new_cursor);
diff --git a/ui/aura/mus/window_tree_client_delegate.h b/ui/aura/mus/window_tree_client_delegate.h
index 609a057..e76d2efb 100644
--- a/ui/aura/mus/window_tree_client_delegate.h
+++ b/ui/aura/mus/window_tree_client_delegate.h
@@ -19,10 +19,6 @@
 class WindowTreeClient;
 class WindowTreeHostMus;
 
-namespace client {
-class CaptureClient;
-}
-
 // Interface implemented by an application using mus.
 class AURA_EXPORT WindowTreeClientDelegate {
  public:
@@ -62,10 +58,6 @@
   virtual void OnPointerEventObserved(const ui::PointerEvent& event,
                                       Window* target) = 0;
 
-  // Mus expects a single CaptureClient is used for all WindowTreeHosts. This
-  // returns it. GetCaptureClient() is called from the constructor.
-  virtual client::CaptureClient* GetCaptureClient() = 0;
-
   virtual PropertyConverter* GetPropertyConverter() = 0;
 
  protected:
diff --git a/ui/aura/mus/window_tree_client_unittest.cc b/ui/aura/mus/window_tree_client_unittest.cc
index f6f877f..22f4f2c 100644
--- a/ui/aura/mus/window_tree_client_unittest.cc
+++ b/ui/aura/mus/window_tree_client_unittest.cc
@@ -18,8 +18,10 @@
 #include "ui/aura/client/aura_constants.h"
 #include "ui/aura/client/capture_client.h"
 #include "ui/aura/client/capture_client_observer.h"
+#include "ui/aura/client/default_capture_client.h"
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/client/transient_window_client.h"
+#include "ui/aura/mus/capture_synchronizer.h"
 #include "ui/aura/mus/property_converter.h"
 #include "ui/aura/mus/window_mus.h"
 #include "ui/aura/mus/window_tree_client_delegate.h"
@@ -1364,6 +1366,69 @@
   capture_recorder.reset_capture_captured_count();
 }
 
+TEST_F(WindowTreeClientClientTest, TwoWindowTreesRequestCapture) {
+  // Creating a WindowTreeHost so we can have two root windows: top_level
+  // and root_window().
+  WindowTreeHostMus window_tree_host(window_tree_client_impl());
+  Window* top_level = window_tree_host.window();
+  window_tree_host.InitHost();
+  client::DefaultCaptureClient* capture_client(
+      new client::DefaultCaptureClient());
+  client::SetCaptureClient(top_level, capture_client);
+  window_tree_client_impl()->capture_synchronizer()->AttachToCaptureClient(
+      capture_client);
+  EXPECT_NE(server_id(top_level), server_id(root_window()));
+
+  // Ack the request to the windowtree to create the new window.
+  uint32_t change_id;
+  ASSERT_TRUE(window_tree()->GetAndRemoveFirstChangeOfType(
+      WindowTreeChangeType::NEW_TOP_LEVEL, &change_id));
+  EXPECT_EQ(window_tree()->window_id(), server_id(top_level));
+
+  ui::mojom::WindowDataPtr data = ui::mojom::WindowData::New();
+  data->window_id = server_id(top_level);
+  data->visible = true;
+  const int64_t display_id = 1;
+  window_tree_client()->OnTopLevelCreated(change_id, std::move(data),
+                                          display_id, true);
+  EXPECT_EQ(
+      0u, window_tree()->GetChangeCountForType(WindowTreeChangeType::VISIBLE));
+  EXPECT_TRUE(top_level->TargetVisibility());
+
+  CaptureRecorder capture_recorder1(root_window());
+  CaptureRecorder capture_recorder2(top_level);
+  EXPECT_NE(client::GetCaptureClient(root_window()),
+            client::GetCaptureClient(top_level));
+
+  EXPECT_EQ(0, capture_recorder1.capture_changed_count());
+  EXPECT_EQ(0, capture_recorder2.capture_changed_count());
+  // Give capture to top_level and ensure everyone is notified correctly.
+  top_level->SetCapture();
+  ASSERT_TRUE(window_tree()->AckSingleChangeOfType(
+      WindowTreeChangeType::CAPTURE, true));
+  EXPECT_EQ(0, capture_recorder1.capture_changed_count());
+  EXPECT_EQ(1, capture_recorder2.capture_changed_count());
+  EXPECT_EQ(top_level->id(), capture_recorder2.last_gained_capture_window_id());
+  EXPECT_EQ(0, capture_recorder2.last_lost_capture_window_id());
+  top_level->ReleaseCapture();
+  capture_recorder1.reset_capture_captured_count();
+  capture_recorder2.reset_capture_captured_count();
+
+  // Release capture of top_level shouldn't affect the capture of root_window().
+  top_level->SetCapture();
+  root_window()->SetCapture();
+  top_level->ReleaseCapture();
+  EXPECT_EQ(1, capture_recorder1.capture_changed_count());
+  EXPECT_EQ(2, capture_recorder2.capture_changed_count());
+  EXPECT_EQ(root_window()->id(),
+            capture_recorder1.last_gained_capture_window_id());
+  EXPECT_EQ(0, capture_recorder1.last_lost_capture_window_id());
+  EXPECT_EQ(0, capture_recorder2.last_gained_capture_window_id());
+  EXPECT_EQ(top_level->id(), capture_recorder2.last_lost_capture_window_id());
+  capture_recorder1.reset_capture_captured_count();
+  capture_recorder2.reset_capture_captured_count();
+}
+
 TEST_F(WindowTreeClientClientTest, ModalFail) {
   Window window(nullptr);
   window.Init(ui::LAYER_NOT_DRAWN);
diff --git a/ui/aura/test/aura_test_base.cc b/ui/aura/test/aura_test_base.cc
index 9732917..6d7c340b 100644
--- a/ui/aura/test/aura_test_base.cc
+++ b/ui/aura/test/aura_test_base.cc
@@ -228,10 +228,6 @@
 
 void AuraTestBase::OnWmDeactivateWindow(Window* window) {}
 
-client::CaptureClient* AuraTestBase::GetCaptureClient() {
-  return helper_->capture_client();
-}
-
 PropertyConverter* AuraTestBase::GetPropertyConverter() {
   return &property_converter_;
 }
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h
index f79283d..b5a765b 100644
--- a/ui/aura/test/aura_test_base.h
+++ b/ui/aura/test/aura_test_base.h
@@ -126,7 +126,6 @@
       const std::vector<gfx::Rect>& additional_client_areas) override;
   bool IsWindowActive(aura::Window* window) override;
   void OnWmDeactivateWindow(Window* window) override;
-  client::CaptureClient* GetCaptureClient() override;
   PropertyConverter* GetPropertyConverter() override;
 
  private:
diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc
index b215374a..1d0dc9b 100644
--- a/ui/aura/test/aura_test_helper.cc
+++ b/ui/aura/test/aura_test_helper.cc
@@ -11,6 +11,7 @@
 #include "ui/aura/client/focus_client.h"
 #include "ui/aura/env.h"
 #include "ui/aura/input_state_lookup.h"
+#include "ui/aura/mus/capture_synchronizer.h"
 #include "ui/aura/mus/window_port_mus.h"
 #include "ui/aura/mus/window_tree_client.h"
 #include "ui/aura/test/env_test_helper.h"
@@ -195,6 +196,8 @@
   window_tree_client_setup_->InitForWindowManager(window_tree_delegate_,
                                                   window_manager_delegate_);
   window_tree_client_ = window_tree_client_setup_->window_tree_client();
+  window_tree_client_->capture_synchronizer()->AttachToCaptureClient(
+      capture_client_.get());
 }
 
 }  // namespace test
diff --git a/ui/aura/test/mus/test_window_tree.cc b/ui/aura/test/mus/test_window_tree.cc
index 6245a04..e9be6351 100644
--- a/ui/aura/test/mus/test_window_tree.cc
+++ b/ui/aura/test/mus/test_window_tree.cc
@@ -244,8 +244,9 @@
 
 void TestWindowTree::SetCanFocus(uint32_t window_id, bool can_focus) {}
 
-void TestWindowTree::SetCanAcceptEvents(uint32_t window_id,
-                                        bool can_accept_events) {}
+void TestWindowTree::SetEventTargetingPolicy(
+    uint32_t window_id,
+    ui::mojom::EventTargetingPolicy policy) {}
 
 void TestWindowTree::SetPredefinedCursor(uint32_t change_id,
                                          uint32_t window_id,
diff --git a/ui/aura/test/mus/test_window_tree.h b/ui/aura/test/mus/test_window_tree.h
index aba306a..92d05bac 100644
--- a/ui/aura/test/mus/test_window_tree.h
+++ b/ui/aura/test/mus/test_window_tree.h
@@ -165,7 +165,8 @@
              const EmbedCallback& callback) override;
   void SetFocus(uint32_t change_id, uint32_t window_id) override;
   void SetCanFocus(uint32_t window_id, bool can_focus) override;
-  void SetCanAcceptEvents(uint32_t window_id, bool can_accept_events) override;
+  void SetEventTargetingPolicy(uint32_t window_id,
+                               ui::mojom::EventTargetingPolicy policy) override;
   void SetPredefinedCursor(uint32_t change_id,
                            uint32_t window_id,
                            ui::mojom::Cursor cursor_id) override;
diff --git a/ui/display/display_layout.cc b/ui/display/display_layout.cc
index 9b5ee17..443ac83 100644
--- a/ui/display/display_layout.cc
+++ b/ui/display/display_layout.cc
@@ -65,7 +65,11 @@
   const int kMaxDepth = 100;  // Avoid layouts with cycles.
   while (current_id != primary_id && depth < kMaxDepth) {
     ++depth;
-    current_id = display_to_parent_ids_map.at(current_id);
+    auto iter = display_to_parent_ids_map.find(current_id);
+    if (iter == display_to_parent_ids_map.end())
+      return kMaxDepth;  // Let detached diplays go to the end.
+
+    current_id = iter->second;
   }
 
   return depth;
@@ -93,9 +97,15 @@
 
 // After the layout has been applied to the |display_list| and any possible
 // overlaps have been fixed, this function is called to update the offsets in
-// the |placement_list|.
-void UpdateOffsets(Displays* display_list,
-                   std::vector<DisplayPlacement>* placement_list) {
+// the |placement_list|, and make sure the placement list is sorted by display
+// IDs.
+void UpdatePlacementList(Displays* display_list,
+                         std::vector<DisplayPlacement>* placement_list) {
+  std::sort(placement_list->begin(), placement_list->end(),
+            [](const DisplayPlacement& p1, const DisplayPlacement& p2) {
+              return p1.display_id < p2.display_id;
+            });
+
   for (DisplayPlacement& placement : *placement_list) {
     const Display* child_display =
         FindDisplayById(display_list, placement.display_id);
@@ -118,7 +128,9 @@
 }
 
 // Reparents |target_display| to |last_intersecting_source_display| if it's not
-// touching with its current parent.
+// touching with its current parent. It also handles the case if
+// |target_display| is detached, it then reparents it to the last intersecting
+// display.
 void MaybeReparentTargetDisplay(
     int last_offset_x,
     int last_offset_y,
@@ -130,44 +142,55 @@
   // A de-intersection was performed.
   // The offset target display may have moved such that it no longer touches
   // its parent. Reparent if necessary.
-  const int64_t parent_display_id =
-      display_to_parent_ids_map->at(target_display->id());
-  if (parent_display_id == last_intersecting_source_display->id()) {
-    // It was just de-intersected with the source display in such a way that
-    // they're touching, and the source display is its parent. So no need to
-    // do any reparenting.
-    return;
+  DisplayPlacement* target_display_placement = nullptr;
+  auto iter = display_to_parent_ids_map->find(target_display->id());
+  if (iter != display_to_parent_ids_map->end()) {
+    const int64_t parent_display_id = iter->second;
+    if (parent_display_id == last_intersecting_source_display->id()) {
+      // It was just de-intersected with the source display in such a way that
+      // they're touching, and the source display is its parent. So no need to
+      // do any reparenting.
+      return;
+    }
+
+    Display* parent_display = FindDisplayById(display_list, parent_display_id);
+    DCHECK(parent_display);
+
+    auto target_display_placement_itr =
+        std::find_if(placement_list->begin(), placement_list->end(),
+                     [&target_display](const DisplayPlacement& p) {
+                       return p.display_id == target_display->id();
+                     });
+    DCHECK(target_display_placement_itr != placement_list->end());
+    target_display_placement = &(*target_display_placement_itr);
+    if (AreDisplaysTouching(*target_display, *parent_display,
+                            target_display_placement->position)) {
+      return;
+    }
+  } else {
+    // It's a detached display with no parent. Add a new placement for it.
+    DisplayPlacement new_placement;
+    new_placement.display_id = target_display->id();
+    placement_list->emplace_back(new_placement);
+    target_display_placement = &placement_list->back();
   }
 
-  Display* parent_display = FindDisplayById(display_list, parent_display_id);
-  DCHECK(parent_display);
-
-  auto target_display_placement_itr =
-      std::find_if(placement_list->begin(), placement_list->end(),
-                   [&target_display](const DisplayPlacement& p) {
-                     return p.display_id == target_display->id();
-                   });
-  DCHECK(target_display_placement_itr != placement_list->end());
-  DisplayPlacement& target_display_placement = *target_display_placement_itr;
-  if (AreDisplaysTouching(*target_display, *parent_display,
-                          target_display_placement.position)) {
-    return;
-  }
+  DCHECK(target_display_placement);
 
   // Reparent the target to source and update the position. No need to
   // update the offset here as it will be done later when UpdateOffsets()
   // is called.
-  target_display_placement.parent_display_id =
+  target_display_placement->parent_display_id =
       last_intersecting_source_display->id();
   // Update the map.
   (*display_to_parent_ids_map)[target_display->id()] =
       last_intersecting_source_display->id();
 
   if (last_offset_x) {
-    target_display_placement.position =
+    target_display_placement->position =
         last_offset_x > 0 ? DisplayPlacement::RIGHT : DisplayPlacement::LEFT;
   } else {
-    target_display_placement.position =
+    target_display_placement->position =
         last_offset_y > 0 ? DisplayPlacement::BOTTOM : DisplayPlacement::TOP;
   }
 }
@@ -235,18 +258,23 @@
     if (d1_depth != d2_depth)
       return d1_depth < d2_depth;
 
-    return d1->bounds().OffsetFromOrigin().LengthSquared() <
-           d2->bounds().OffsetFromOrigin().LengthSquared();
+    const int64_t d1_distance = d1->bounds().OffsetFromOrigin().LengthSquared();
+    const int64_t d2_distance = d2->bounds().OffsetFromOrigin().LengthSquared();
+
+    if (d1_distance != d2_distance)
+      return d1_distance < d2_distance;
+
+    return d1->id() < d2->id();
   });
   // This must result in the primary display being at the front of the list.
   DCHECK_EQ(sorted_displays.front()->id(), primary_id);
 
-  for (int i = 1; i < static_cast<int>(sorted_displays.size()); ++i) {
+  for (size_t i = 1; i < sorted_displays.size(); ++i) {
     Display* target_display = sorted_displays[i];
     const Display* last_intersecting_source_display = nullptr;
     int last_offset_x = 0;
     int last_offset_y = 0;
-    for (int j = i - 1; j >= 0; --j) {
+    for (size_t j = 0; j < i; ++j) {
       const Display* source_display = sorted_displays[j];
       const gfx::Rect source_bounds = source_display->bounds();
       const gfx::Rect target_bounds = target_display->bounds();
@@ -294,8 +322,9 @@
                                placement_list);
   }
 
-  // The offsets might have changed and we must update them.
-  UpdateOffsets(display_list, placement_list);
+  // New placements might have been added and offsets might have changed and we
+  // must update them.
+  UpdatePlacementList(display_list, placement_list);
 }
 
 }  // namespace
diff --git a/ui/gfx/color_transform.cc b/ui/gfx/color_transform.cc
index 2453f469..14ebf1a 100644
--- a/ui/gfx/color_transform.cc
+++ b/ui/gfx/color_transform.cc
@@ -4,6 +4,7 @@
 
 #include "ui/gfx/color_transform.h"
 
+#include <algorithm>
 #include <vector>
 
 #include "base/logging.h"
@@ -454,6 +455,19 @@
     return c.x() * 0.2627f + c.y() * 0.6780f + c.z() * 0.0593f;
   }
 
+  ColorTransform::TriStim ClipToWhite(ColorTransform::TriStim& c) {
+    float maximum = std::max(std::max(c.x(), c.y()), c.z());
+    if (maximum > 1.0f) {
+      float l = Luma(c);
+      c.Scale(1.0f / maximum);
+      ColorTransform::TriStim white(1.0f, 1.0f, 1.0f);
+      white.Scale((1.0f - 1.0f / maximum) * l / Luma(white));
+      ColorTransform::TriStim black(0.0f, 0.0f, 0.0f);
+      c += white - black;
+    }
+    return c;
+  }
+
   void transform(ColorTransform::TriStim* colors, size_t num) override {
     if (fn_valid_) {
       for (size_t i = 0; i < num; i++) {
@@ -472,7 +486,7 @@
               ToLinear(ColorSpace::TransferID::SMPTEST2084, colors[i].y()),
               ToLinear(ColorSpace::TransferID::SMPTEST2084, colors[i].z()));
           smpte2084.Scale(Luma(ret) / Luma(smpte2084));
-          ret = smpte2084;
+          ret = ClipToWhite(smpte2084);
         }
         colors[i] = ret;
       }
diff --git a/ui/message_center/views/message_center_button_bar.cc b/ui/message_center/views/message_center_button_bar.cc
index 7fbdcfe..14f2283 100644
--- a/ui/message_center/views/message_center_button_bar.cc
+++ b/ui/message_center/views/message_center_button_bar.cc
@@ -242,7 +242,7 @@
                     0);
 #endif
 
-  layout->StartRow(0, 0);
+  layout->StartRow(0, 0, kButtonSize);
   if (title_arrow_->visible())
     layout->AddView(title_arrow_);
   layout->AddView(notification_label_);
@@ -269,6 +269,14 @@
   return close_all_button_;
 }
 
+views::Button* MessageCenterButtonBar::GetQuietModeButtonForTest() const {
+  return quiet_mode_button_;
+}
+
+views::Button* MessageCenterButtonBar::GetSettingsButtonForTest() const {
+  return settings_button_;
+}
+
 void MessageCenterButtonBar::SetBackArrowVisible(bool visible) {
   if (title_arrow_)
     title_arrow_->SetVisible(visible);
@@ -280,6 +288,17 @@
   notification_label_->SetText(title);
 }
 
+void MessageCenterButtonBar::SetButtonsVisible(bool visible) {
+  settings_button_->SetVisible(visible);
+  quiet_mode_button_->SetVisible(visible);
+
+  if (close_all_button_)
+    close_all_button_->SetVisible(visible);
+
+  ViewVisibilityChanged();
+  Layout();
+}
+
 void MessageCenterButtonBar::ChildVisibilityChanged(views::View* child) {
   InvalidateLayout();
 }
diff --git a/ui/message_center/views/message_center_button_bar.h b/ui/message_center/views/message_center_button_bar.h
index 752ac23..41b40187 100644
--- a/ui/message_center/views/message_center_button_bar.h
+++ b/ui/message_center/views/message_center_button_bar.h
@@ -43,6 +43,8 @@
   void SetCloseAllButtonEnabled(bool enabled);
 
   MESSAGE_CENTER_EXPORT views::Button* GetCloseAllButtonForTest() const;
+  MESSAGE_CENTER_EXPORT views::Button* GetSettingsButtonForTest() const;
+  MESSAGE_CENTER_EXPORT views::Button* GetQuietModeButtonForTest() const;
 
   // Sometimes we shouldn't see the back arrow (not in settings).
   void SetBackArrowVisible(bool visible);
@@ -50,6 +52,8 @@
   // Update the label of the title.
   void SetTitle(const base::string16& title);
 
+  void SetButtonsVisible(bool visible);
+
  private:
   // Updates the layout manager which can have differing configuration
   // depending on the visibility of different parts of the button bar.
diff --git a/ui/message_center/views/message_center_view.cc b/ui/message_center/views/message_center_view.cc
index 90adbdc..321c9052 100644
--- a/ui/message_center/views/message_center_view.cc
+++ b/ui/message_center/views/message_center_view.cc
@@ -621,9 +621,14 @@
   }
 
   button_bar_->SetBackArrowVisible(mode_ == Mode::SETTINGS);
-  button_bar_->SetSettingsAndQuietModeButtonsEnabled(!is_locked_);
+  button_bar_->SetButtonsVisible(!is_locked_);
   button_bar_->SetTitle(GetButtonBarTitle());
 
+  if (!is_locked_)
+    EnableCloseAllIfAppropriate();
+}
+
+void MessageCenterView::EnableCloseAllIfAppropriate() {
   if (mode_ == Mode::NOTIFICATIONS) {
     bool no_closable_views = true;
     for (const auto& view : notification_views_) {
diff --git a/ui/message_center/views/message_center_view.h b/ui/message_center/views/message_center_view.h
index 212500e7..f5c3046 100644
--- a/ui/message_center/views/message_center_view.h
+++ b/ui/message_center/views/message_center_view.h
@@ -107,6 +107,7 @@
   void Update(bool animate);
   void SetVisibilityMode(Mode mode, bool animate);
   void UpdateButtonBarStatus();
+  void EnableCloseAllIfAppropriate();
   void SetNotificationViewForTest(MessageView* view);
 
   MessageCenter* message_center_;  // Weak reference.
diff --git a/ui/message_center/views/message_center_view_unittest.cc b/ui/message_center/views/message_center_view_unittest.cc
index 5a16ecd1..e038a8d 100644
--- a/ui/message_center/views/message_center_view_unittest.cc
+++ b/ui/message_center/views/message_center_view_unittest.cc
@@ -755,6 +755,18 @@
   EXPECT_TRUE(GetNotificationView(kNotificationId1)->IsDrawn());
   EXPECT_TRUE(GetNotificationView(kNotificationId2)->IsDrawn());
 
+  views::Button* close_button = GetButtonBar()->GetCloseAllButtonForTest();
+  ASSERT_NE(nullptr, close_button);
+  views::Button* quiet_mode_button =
+      GetButtonBar()->GetQuietModeButtonForTest();
+  ASSERT_NE(nullptr, quiet_mode_button);
+  views::Button* settings_button = GetButtonBar()->GetSettingsButtonForTest();
+  ASSERT_NE(nullptr, settings_button);
+
+  EXPECT_TRUE(close_button->visible());
+  EXPECT_TRUE(quiet_mode_button->visible());
+  EXPECT_TRUE(settings_button->visible());
+
   // Lock!
   SetLockedState(true);
 
@@ -785,6 +797,10 @@
   GetMessageCenterView()->SizeToPreferredSize();
   EXPECT_EQ(kLockedMessageCenterViewHeight, GetMessageCenterView()->height());
 
+  EXPECT_FALSE(close_button->visible());
+  EXPECT_FALSE(quiet_mode_button->visible());
+  EXPECT_FALSE(settings_button->visible());
+
   // Unlock!
   SetLockedState(false);
 
@@ -793,6 +809,10 @@
   GetMessageCenterView()->SizeToPreferredSize();
   EXPECT_NE(kLockedMessageCenterViewHeight, GetMessageCenterView()->height());
 
+  EXPECT_TRUE(close_button->visible());
+  EXPECT_TRUE(quiet_mode_button->visible());
+  EXPECT_TRUE(settings_button->visible());
+
   // Lock!
   SetLockedState(true);
 
@@ -800,6 +820,10 @@
 
   GetMessageCenterView()->SizeToPreferredSize();
   EXPECT_EQ(kLockedMessageCenterViewHeight, GetMessageCenterView()->height());
+
+  EXPECT_FALSE(close_button->visible());
+  EXPECT_FALSE(quiet_mode_button->visible());
+  EXPECT_FALSE(settings_button->visible());
 }
 
 TEST_F(MessageCenterViewTest, NoNotification) {
diff --git a/ui/views/layout/grid_layout.cc b/ui/views/layout/grid_layout.cc
index b45f1ca..eb4dd9d1 100644
--- a/ui/views/layout/grid_layout.cc
+++ b/ui/views/layout/grid_layout.cc
@@ -684,10 +684,13 @@
   StartRow(vertical_resize, column_set_id);
 }
 
-void GridLayout::StartRow(float vertical_resize, int column_set_id) {
+void GridLayout::StartRow(float vertical_resize,
+                          int column_set_id,
+                          int height) {
+  DCHECK_GE(height, 0);
   ColumnSet* column_set = GetColumnSet(column_set_id);
   DCHECK(column_set);
-  AddRow(base::MakeUnique<Row>(0, vertical_resize, column_set));
+  AddRow(base::MakeUnique<Row>(height, vertical_resize, column_set));
 }
 
 void GridLayout::AddPaddingRow(float vertical_resize, int pixel_count) {
diff --git a/ui/views/layout/grid_layout.h b/ui/views/layout/grid_layout.h
index 144fac98..e6a1ee3 100644
--- a/ui/views/layout/grid_layout.h
+++ b/ui/views/layout/grid_layout.h
@@ -129,8 +129,9 @@
   void StartRowWithPadding(float vertical_resize, int column_set_id,
                            float padding_resize, int padding);
 
-  // Starts a new row with the specified column set.
-  void StartRow(float vertical_resize, int column_set_id);
+  // Starts a new row with the specified column set and height (0 for
+  // unspecified height).
+  void StartRow(float vertical_resize, int column_set_id, int height = 0);
 
   // Advances past columns. Use this when the current column should not
   // contain any views.
diff --git a/ui/views/mus/desktop_window_tree_host_mus.cc b/ui/views/mus/desktop_window_tree_host_mus.cc
index 64d61c4..1b834c7 100644
--- a/ui/views/mus/desktop_window_tree_host_mus.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus.cc
@@ -9,6 +9,7 @@
 #include "base/run_loop.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "ui/aura/client/aura_constants.h"
+#include "ui/aura/client/capture_client.h"
 #include "ui/aura/client/cursor_client.h"
 #include "ui/aura/client/drag_drop_client.h"
 #include "ui/aura/client/focus_client.h"
@@ -294,8 +295,10 @@
         params.parent->GetHost()->window(), window());
   }
 
-  if (!params.accept_events)
-    aura::WindowPortMus::Get(window())->SetCanAcceptEvents(false);
+  if (!params.accept_events) {
+    aura::WindowPortMus::Get(window())->SetEventTargetingPolicy(
+        ui::mojom::EventTargetingPolicy::NONE);
+  }
 }
 
 void DesktopWindowTreeHostMus::OnNativeWidgetCreated(
@@ -320,6 +323,9 @@
   // client-area and hit-test-mask.
   SendClientAreaToServer();
   SendHitTestMaskToServer();
+
+  MusClient::Get()->OnCaptureClientSet(
+      aura::client::GetCaptureClient(window()));
 }
 
 std::unique_ptr<corewm::Tooltip> DesktopWindowTreeHostMus::CreateTooltip() {
@@ -349,6 +355,9 @@
 }
 
 void DesktopWindowTreeHostMus::CloseNow() {
+  MusClient::Get()->OnCaptureClientUnset(
+      aura::client::GetCaptureClient(window()));
+
   native_widget_delegate_->OnNativeWidgetDestroying();
 
   // If we have children, close them. Use a copy for iteration because they'll
diff --git a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
index 1620c58..394abfa 100644
--- a/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
+++ b/ui/views/mus/desktop_window_tree_host_mus_unittest.cc
@@ -9,7 +9,10 @@
 #include "base/memory/ptr_util.h"
 #include "ui/aura/client/cursor_client.h"
 #include "ui/aura/client/transient_window_client.h"
+#include "ui/aura/mus/capture_synchronizer.h"
 #include "ui/aura/mus/in_flight_change.h"
+#include "ui/aura/mus/window_mus.h"
+#include "ui/aura/mus/window_tree_client.h"
 #include "ui/aura/test/mus/change_completion_waiter.h"
 #include "ui/aura/window.h"
 #include "ui/views/mus/mus_client.h"
@@ -124,6 +127,50 @@
   EXPECT_FALSE(widget->GetNativeView()->parent()->IsVisible());
 }
 
+TEST_F(DesktopWindowTreeHostMusTest, Capture) {
+  std::unique_ptr<Widget> widget1(CreateWidget());
+  widget1->Show();
+  EXPECT_FALSE(widget1->HasCapture());
+
+  std::unique_ptr<Widget> widget2(CreateWidget());
+  widget2->Show();
+  EXPECT_FALSE(widget2->HasCapture());
+
+  widget1->SetCapture(widget1->GetRootView());
+  EXPECT_TRUE(widget1->HasCapture());
+  EXPECT_FALSE(widget2->HasCapture());
+  EXPECT_EQ(widget1->GetNativeWindow(), MusClient::Get()
+                                            ->window_tree_client()
+                                            ->capture_synchronizer()
+                                            ->capture_window()
+                                            ->GetWindow());
+
+  widget2->SetCapture(widget2->GetRootView());
+  EXPECT_TRUE(widget2->HasCapture());
+  EXPECT_EQ(widget2->GetNativeWindow(), MusClient::Get()
+                                            ->window_tree_client()
+                                            ->capture_synchronizer()
+                                            ->capture_window()
+                                            ->GetWindow());
+
+  widget1->ReleaseCapture();
+  EXPECT_TRUE(widget2->HasCapture());
+  EXPECT_FALSE(widget1->HasCapture());
+  EXPECT_EQ(widget2->GetNativeWindow(), MusClient::Get()
+                                            ->window_tree_client()
+                                            ->capture_synchronizer()
+                                            ->capture_window()
+                                            ->GetWindow());
+
+  widget2->ReleaseCapture();
+  EXPECT_FALSE(widget2->HasCapture());
+  EXPECT_FALSE(widget1->HasCapture());
+  EXPECT_EQ(nullptr, MusClient::Get()
+                         ->window_tree_client()
+                         ->capture_synchronizer()
+                         ->capture_window());
+}
+
 TEST_F(DesktopWindowTreeHostMusTest, Deactivate) {
   std::unique_ptr<Widget> widget1(CreateWidget());
   widget1->Show();
diff --git a/ui/views/mus/mus_client.cc b/ui/views/mus/mus_client.cc
index 743ea284..3d40563e 100644
--- a/ui/views/mus/mus_client.cc
+++ b/ui/views/mus/mus_client.cc
@@ -16,6 +16,7 @@
 #include "services/ui/public/interfaces/event_matcher.mojom.h"
 #include "services/ui/public/interfaces/window_manager.mojom.h"
 #include "ui/aura/env.h"
+#include "ui/aura/mus/capture_synchronizer.h"
 #include "ui/aura/mus/mus_context_factory.h"
 #include "ui/aura/mus/os_exchange_data_provider_mus.h"
 #include "ui/aura/mus/property_converter.h"
@@ -32,7 +33,6 @@
 #include "ui/views/views_delegate.h"
 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
 #include "ui/views/widget/widget_delegate.h"
-#include "ui/wm/core/capture_controller.h"
 #include "ui/wm/core/wm_state.h"
 
 // Widget::InitParams::Type must match that of ui::mojom::WindowType.
@@ -222,6 +222,20 @@
   return native_widget;
 }
 
+void MusClient::OnCaptureClientSet(
+    aura::client::CaptureClient* capture_client) {
+  pointer_watcher_event_router_->AttachToCaptureClient(capture_client);
+  window_tree_client_->capture_synchronizer()->AttachToCaptureClient(
+      capture_client);
+}
+
+void MusClient::OnCaptureClientUnset(
+    aura::client::CaptureClient* capture_client) {
+  pointer_watcher_event_router_->DetachFromCaptureClient(capture_client);
+  window_tree_client_->capture_synchronizer()->DetachFromCaptureClient(
+      capture_client);
+}
+
 void MusClient::AddObserver(MusClientObserver* observer) {
   observer_list_.AddObserver(observer);
 }
@@ -257,10 +271,6 @@
     observer.OnWindowManagerFrameValuesChanged();
 }
 
-aura::client::CaptureClient* MusClient::GetCaptureClient() {
-  return wm::CaptureController::Get();
-}
-
 aura::PropertyConverter* MusClient::GetPropertyConverter() {
   return property_converter_.get();
 }
diff --git a/ui/views/mus/mus_client.h b/ui/views/mus/mus_client.h
index cccc44b0..d43579b 100644
--- a/ui/views/mus/mus_client.h
+++ b/ui/views/mus/mus_client.h
@@ -12,6 +12,7 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "ui/aura/client/capture_client.h"
 #include "ui/aura/mus/window_tree_client_delegate.h"
 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
 #include "ui/views/mus/mus_export.h"
@@ -101,6 +102,14 @@
   NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params,
                                    internal::NativeWidgetDelegate* delegate);
 
+  // Called when the capture client has been set for a window to notify
+  // PointerWatcherEventRouter and CaptureSynchronizer.
+  void OnCaptureClientSet(aura::client::CaptureClient* capture_client);
+
+  // Called when the capture client will be unset for a window to notify
+  // PointerWatcherEventRouter and CaptureSynchronizer.
+  void OnCaptureClientUnset(aura::client::CaptureClient* capture_client);
+
   void AddObserver(MusClientObserver* observer);
   void RemoveObserver(MusClientObserver* observer);
 
@@ -120,7 +129,6 @@
   void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override;
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target) override;
-  aura::client::CaptureClient* GetCaptureClient() override;
   aura::PropertyConverter* GetPropertyConverter() override;
 
   // ScreenMusDelegate:
diff --git a/ui/views/mus/pointer_watcher_event_router.cc b/ui/views/mus/pointer_watcher_event_router.cc
index 26b4c066..3daf94c0c 100644
--- a/ui/views/mus/pointer_watcher_event_router.cc
+++ b/ui/views/mus/pointer_watcher_event_router.cc
@@ -27,14 +27,11 @@
     aura::WindowTreeClient* window_tree_client)
     : window_tree_client_(window_tree_client) {
   window_tree_client->AddObserver(this);
-  window_tree_client_->GetCaptureClient()->AddObserver(this);
 }
 
 PointerWatcherEventRouter::~PointerWatcherEventRouter() {
-  if (window_tree_client_) {
+  if (window_tree_client_)
     window_tree_client_->RemoveObserver(this);
-    window_tree_client_->GetCaptureClient()->RemoveObserver(this);
-  }
 }
 
 void PointerWatcherEventRouter::AddPointerWatcher(PointerWatcher* watcher,
@@ -132,6 +129,16 @@
   }
 }
 
+void PointerWatcherEventRouter::AttachToCaptureClient(
+    aura::client::CaptureClient* capture_client) {
+  capture_client->AddObserver(this);
+}
+
+void PointerWatcherEventRouter::DetachFromCaptureClient(
+    aura::client::CaptureClient* capture_client) {
+  capture_client->RemoveObserver(this);
+}
+
 PointerWatcherEventRouter::EventTypes
 PointerWatcherEventRouter::DetermineEventTypes() {
   if (HasPointerWatcher(&move_watchers_))
@@ -161,7 +168,6 @@
   // We expect that all observers have been removed by this time.
   DCHECK_EQ(event_types_, EventTypes::NONE);
   DCHECK_EQ(client, window_tree_client_);
-  window_tree_client_->GetCaptureClient()->RemoveObserver(this);
   window_tree_client_->RemoveObserver(this);
   window_tree_client_ = nullptr;
 }
diff --git a/ui/views/mus/pointer_watcher_event_router.h b/ui/views/mus/pointer_watcher_event_router.h
index 7414097..4298b78 100644
--- a/ui/views/mus/pointer_watcher_event_router.h
+++ b/ui/views/mus/pointer_watcher_event_router.h
@@ -14,6 +14,10 @@
 
 namespace aura {
 class WindowTreeClient;
+
+namespace client {
+class CaptureClient;
+}
 }
 
 namespace ui {
@@ -56,6 +60,10 @@
   void OnPointerEventObserved(const ui::PointerEvent& event,
                               aura::Window* target);
 
+  // Called when the |capture_client| has been set or will be unset.
+  void AttachToCaptureClient(aura::client::CaptureClient* capture_client);
+  void DetachFromCaptureClient(aura::client::CaptureClient* capture_client);
+
  private:
   friend class PointerWatcherEventRouterTest;
 
diff --git a/ui/views/widget/desktop_aura/desktop_capture_client.cc b/ui/views/widget/desktop_aura/desktop_capture_client.cc
index 6c1d0b8..c434a9f 100644
--- a/ui/views/widget/desktop_aura/desktop_capture_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_capture_client.cc
@@ -4,6 +4,7 @@
 
 #include "ui/views/widget/desktop_aura/desktop_capture_client.h"
 
+#include "ui/aura/client/capture_client_observer.h"
 #include "ui/aura/window.h"
 #include "ui/aura/window_event_dispatcher.h"
 #include "ui/aura/window_tracker.h"
@@ -85,6 +86,9 @@
       }
     }
   }  // else case is capture is remaining in our root, nothing to do.
+
+  for (auto& observer : observers_)
+    observer.OnCaptureChanged(old_capture_window, capture_window_);
 }
 
 void DesktopCaptureClient::ReleaseCapture(aura::Window* window) {
@@ -103,12 +107,12 @@
 
 void DesktopCaptureClient::AddObserver(
     aura::client::CaptureClientObserver* observer) {
-  NOTREACHED();
+  observers_.AddObserver(observer);
 }
 
 void DesktopCaptureClient::RemoveObserver(
     aura::client::CaptureClientObserver* observer) {
-  NOTREACHED();
+  observers_.RemoveObserver(observer);
 }
 
 }  // namespace views
diff --git a/ui/views/widget/desktop_aura/desktop_capture_client.h b/ui/views/widget/desktop_aura/desktop_capture_client.h
index 497e896f..1f19ec6 100644
--- a/ui/views/widget/desktop_aura/desktop_capture_client.h
+++ b/ui/views/widget/desktop_aura/desktop_capture_client.h
@@ -9,6 +9,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/macros.h"
+#include "base/observer_list.h"
 #include "ui/aura/client/capture_client.h"
 #include "ui/views/views_export.h"
 
@@ -57,6 +58,8 @@
   // Set of DesktopCaptureClients.
   static CaptureClients* capture_clients_;
 
+  base::ObserverList<aura::client::CaptureClientObserver> observers_;
+
   DISALLOW_COPY_AND_ASSIGN(DesktopCaptureClient);
 };