diff --git a/DEPS b/DEPS
index eac4abf..7b0e73b 100644
--- a/DEPS
+++ b/DEPS
@@ -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': '4ca5ba4dec653aff28d14c9f48715e93e8dfd490',
+  'pdfium_revision': '80e370c7d8b6541f59d98b6cbfbaae51f7e139da',
   # 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.
diff --git a/chrome/browser/chrome_content_renderer_manifest_overlay.json b/chrome/browser/chrome_content_renderer_manifest_overlay.json
index af721e5..80854b8 100644
--- a/chrome/browser/chrome_content_renderer_manifest_overlay.json
+++ b/chrome/browser/chrome_content_renderer_manifest_overlay.json
@@ -16,6 +16,7 @@
           "autofill::mojom::PasswordGenerationAgent",
           "chrome::mojom::ImageContextMenuRenderer",
           "chrome::mojom::InsecureContentRenderer",
+          "chrome::mojom::ThumbnailCapturer",
           "contextual_search::mojom::OverlayPageNotifierService",
           "dom_distiller::mojom::DistillerPageNotifierService"
         ]
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
index e8e378db..5bf14b1 100644
--- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
+++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -72,7 +72,7 @@
 #define MAYBE_FileDisplay FileDisplay
 #endif
 WRAPPED_INSTANTIATE_TEST_CASE_P(
-    MAYBE_FileDisplay,
+    DISABLED_FileDisplay,
     FileManagerBrowserTest,
     ::testing::Values(TestParameter(NOT_IN_GUEST_MODE, "fileDisplayDownloads"),
                       TestParameter(IN_GUEST_MODE, "fileDisplayDownloads"),
@@ -154,24 +154,21 @@
 #define MAYBE_KeyboardOperations KeyboardOperations
 #endif
 WRAPPED_INSTANTIATE_TEST_CASE_P(
-    MAYBE_KeyboardOperations,
+    DISABLED_KeyboardOperations,
     FileManagerBrowserTest,
-    ::testing::Values(TestParameter(IN_GUEST_MODE, "keyboardDeleteDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE,
-                                    "keyboardDeleteDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE, "keyboardDeleteDrive"),
-                      TestParameter(IN_GUEST_MODE, "keyboardCopyDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDrive"),
-                      TestParameter(IN_GUEST_MODE, "renameFileDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE, "renameFileDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE, "renameFileDrive"),
-                      TestParameter(IN_GUEST_MODE,
-                                    "renameNewDirectoryDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE,
-                                    "renameNewDirectoryDownloads"),
-                      TestParameter(NOT_IN_GUEST_MODE,
-                                    "renameNewDirectoryDrive")));
+    ::testing::Values(
+        TestParameter(IN_GUEST_MODE, "keyboardDeleteDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "keyboardDeleteDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "keyboardDeleteDrive"),
+        TestParameter(IN_GUEST_MODE, "keyboardCopyDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "keyboardCopyDrive"),
+        TestParameter(IN_GUEST_MODE, "renameFileDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "renameFileDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "renameFileDrive"),
+        TestParameter(IN_GUEST_MODE, "renameNewDirectoryDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "renameNewDirectoryDownloads"),
+        TestParameter(NOT_IN_GUEST_MODE, "renameNewDirectoryDrive")));
 
 #if defined(DISABLE_SLOW_FILESAPP_TESTS)
 #define MAYBE_Delete DISABLED_Delete
@@ -197,7 +194,7 @@
 #define MAYBE_DirectoryTreeContextMenu DirectoryTreeContextMenu
 #endif
 WRAPPED_INSTANTIATE_TEST_CASE_P(
-    MAYBE_DirectoryTreeContextMenu,
+    DISABLED_DirectoryTreeContextMenu,
     FileManagerBrowserTest,
     ::testing::Values(
         TestParameter(NOT_IN_GUEST_MODE,
@@ -276,7 +273,7 @@
 #define MAYBE_Transfer Transfer
 #endif
 WRAPPED_INSTANTIATE_TEST_CASE_P(
-    MAYBE_Transfer,
+    DISABLED_Transfer,
     FileManagerBrowserTest,
     ::testing::Values(
         TestParameter(NOT_IN_GUEST_MODE, "transferFromDriveToDownloads"),
@@ -392,7 +389,7 @@
 #define MAYBE_GenericTask GenericTask
 #endif
 WRAPPED_INSTANTIATE_TEST_CASE_P(
-    MAYBE_GenericTask,
+    DISABLED_GenericTask,
     FileManagerBrowserTest,
     ::testing::Values(
         TestParameter(NOT_IN_GUEST_MODE, "genericTaskIsNotExecuted"),
@@ -566,7 +563,7 @@
 #define MAYBE_GearMenu GearMenu
 #endif
 WRAPPED_INSTANTIATE_TEST_CASE_P(
-    MAYBE_GearMenu,
+    DISABLED_GearMenu,
     FileManagerBrowserTest,
     ::testing::Values(
         TestParameter(NOT_IN_GUEST_MODE, "showHiddenFilesOnDownloads"),
diff --git a/chrome/browser/previews/previews_service.cc b/chrome/browser/previews/previews_service.cc
index a0375e5..bfc31ea 100644
--- a/chrome/browser/previews/previews_service.cc
+++ b/chrome/browser/previews/previews_service.cc
@@ -4,65 +4,17 @@
 
 #include "chrome/browser/previews/previews_service.h"
 
-#include "base/bind.h"
 #include "base/files/file_path.h"
 #include "base/memory/ptr_util.h"
 #include "base/sequenced_task_runner.h"
 #include "base/threading/sequenced_worker_pool.h"
 #include "chrome/common/chrome_constants.h"
-#include "components/previews/core/previews_experiments.h"
 #include "components/previews/core/previews_io_data.h"
 #include "components/previews/core/previews_opt_out_store.h"
 #include "components/previews/core/previews_opt_out_store_sql.h"
 #include "components/previews/core/previews_ui_service.h"
 #include "content/public/browser/browser_thread.h"
 
-namespace {
-
-// Returns true if previews can be shown for |type|.
-bool IsPreviewsTypeEnabled(previews::PreviewsType type) {
-  switch (type) {
-    case previews::PreviewsType::OFFLINE:
-      return previews::params::IsOfflinePreviewsEnabled();
-    case previews::PreviewsType::NONE:
-    case previews::PreviewsType::LAST:
-      break;
-  }
-  NOTREACHED();
-  return false;
-}
-
-// Returns the version of preview treatment |type|. Defaults to 0 if not
-// specified in field trial config.
-int GetPreviewsTypeVersion(previews::PreviewsType type) {
-  switch (type) {
-    case previews::PreviewsType::OFFLINE:
-      return previews::params::OfflinePreviewsVersion();
-    case previews::PreviewsType::NONE:
-    case previews::PreviewsType::LAST:
-      break;
-  }
-  NOTREACHED();
-  return -1;
-}
-
-// Returns the enabled PreviewsTypes with their version.
-std::unique_ptr<previews::PreviewsTypeList> GetEnabledPreviews() {
-  std::unique_ptr<previews::PreviewsTypeList> enabled_previews(
-      new previews::PreviewsTypeList());
-
-  // Loop across all previews types (relies on sequential enum values).
-  for (int i = static_cast<int>(previews::PreviewsType::NONE) + 1;
-       i < static_cast<int>(previews::PreviewsType::LAST); ++i) {
-    previews::PreviewsType type = static_cast<previews::PreviewsType>(i);
-    if (IsPreviewsTypeEnabled(type))
-      enabled_previews->push_back({type, GetPreviewsTypeVersion(type)});
-  }
-  return enabled_previews;
-}
-
-}  // namespace
-
 PreviewsService::PreviewsService() {
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 }
@@ -87,7 +39,5 @@
       previews_io_data, io_task_runner,
       base::MakeUnique<previews::PreviewsOptOutStoreSQL>(
           io_task_runner, background_task_runner,
-          profile_path.Append(chrome::kPreviewsOptOutDBFilename),
-          GetEnabledPreviews()),
-      base::Bind(&IsPreviewsTypeEnabled));
+          profile_path.Append(chrome::kPreviewsOptOutDBFilename)));
 }
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
index fe3361f..3fd63bd1 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest.cc
@@ -15,6 +15,7 @@
 #include "base/macros.h"
 #include "base/memory/ptr_util.h"
 #include "base/memory/ref_counted.h"
+#include "base/run_loop.h"
 #include "base/strings/string16.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
@@ -31,6 +32,7 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/common/render_messages.h"
+#include "chrome/common/thumbnail_capturer.mojom.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/search_test_utils.h"
 #include "chrome/test/base/ui_test_utils.h"
@@ -42,6 +44,7 @@
 #include "content/public/browser/navigation_controller.h"
 #include "content/public/browser/navigation_entry.h"
 #include "content/public/browser/notification_service.h"
+#include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/render_widget_host.h"
@@ -53,6 +56,7 @@
 #include "net/url_request/url_request.h"
 #include "net/url_request/url_request_filter.h"
 #include "net/url_request/url_request_interceptor.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/platform/WebInputEvent.h"
 #include "third_party/WebKit/public/web/WebContextMenuData.h"
 #include "ui/base/models/menu_model.h"
@@ -548,90 +552,6 @@
 }
 #endif  // !defined(OS_CHROMEOS)
 
-class ThumbnailResponseWatcher : public content::NotificationObserver {
- public:
-  enum QuitReason {
-    STILL_RUNNING = 0,
-    THUMBNAIL_RECEIVED,
-    RENDER_PROCESS_GONE,
-  };
-
-  class MessageFilter : public content::BrowserMessageFilter {
-   public:
-    explicit MessageFilter(ThumbnailResponseWatcher* owner)
-        : content::BrowserMessageFilter(ChromeMsgStart), owner_(owner) {}
-
-    bool OnMessageReceived(const IPC::Message& message) override {
-      if (message.type() ==
-          ChromeViewHostMsg_RequestThumbnailForContextNode_ACK::ID) {
-        content::BrowserThread::PostTask(
-            content::BrowserThread::UI, FROM_HERE,
-            base::Bind(&MessageFilter::OnRequestThumbnailForContextNodeACK,
-                       this));
-      }
-      return false;
-    }
-
-    void OnRequestThumbnailForContextNodeACK() {
-      if (owner_)
-        owner_->OnRequestThumbnailForContextNodeACK();
-    }
-
-    void Disown() { owner_ = nullptr; }
-
-   private:
-    ~MessageFilter() override {}
-
-    ThumbnailResponseWatcher* owner_;
-
-    DISALLOW_COPY_AND_ASSIGN(MessageFilter);
-  };
-
-  explicit ThumbnailResponseWatcher(
-      content::RenderProcessHost* render_process_host)
-      : message_loop_runner_(new content::MessageLoopRunner),
-        filter_(new MessageFilter(this)),
-        quit_reason_(STILL_RUNNING) {
-    notification_registrar_.Add(
-        this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
-        content::Source<content::RenderProcessHost>(render_process_host));
-    notification_registrar_.Add(
-        this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED,
-        content::Source<content::RenderProcessHost>(render_process_host));
-    render_process_host->AddFilter(filter_.get());
-  }
-
-  ~ThumbnailResponseWatcher() override { filter_->Disown(); }
-
-  QuitReason Wait() WARN_UNUSED_RESULT {
-    message_loop_runner_->Run();
-    DCHECK_NE(STILL_RUNNING, quit_reason_);
-    return quit_reason_;
-  }
-
-  void Observe(int type,
-               const content::NotificationSource& source,
-               const content::NotificationDetails& details) override {
-    DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_CLOSED ||
-           type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED);
-    quit_reason_ = RENDER_PROCESS_GONE;
-    message_loop_runner_->Quit();
-  }
-
-  void OnRequestThumbnailForContextNodeACK() {
-    quit_reason_ = THUMBNAIL_RECEIVED;
-    message_loop_runner_->Quit();
-  }
-
- private:
-  scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
-  scoped_refptr<MessageFilter> filter_;
-  content::NotificationRegistrar notification_registrar_;
-  QuitReason quit_reason_;
-
-  DISALLOW_COPY_AND_ASSIGN(ThumbnailResponseWatcher);
-};
-
 // Maintains image search test state. In particular, note that |menu_observer_|
 // must live until the right-click completes asynchronously.
 class SearchByImageBrowserTest : public InProcessBrowserTest {
@@ -650,10 +570,14 @@
   }
 
   void AttemptImageSearch() {
-    // Right-click where the image should be.
     // |menu_observer_| will cause the search-by-image menu item to be clicked.
     menu_observer_.reset(new ContextMenuNotificationObserver(
         IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE));
+    RightClickImage();
+  }
+
+  // Right-click where the image should be.
+  void RightClickImage() {
     content::WebContents* tab =
         browser()->tab_strip_model()->GetActiveWebContents();
     content::SimulateMouseClickAt(tab, 0, blink::WebMouseEvent::Button::Right,
@@ -716,14 +640,36 @@
   static const char kCorruptImage[] = "/image_search/corrupt.png";
   SetupAndLoadImagePage(kCorruptImage);
 
-  content::WebContents* tab =
-      browser()->tab_strip_model()->GetActiveWebContents();
-  ThumbnailResponseWatcher watcher(tab->GetRenderProcessHost());
-  AttemptImageSearch();
+  // Open and close a context menu.
+  ContextMenuWaiter waiter(content::NotificationService::AllSources());
+  RightClickImage();
+  waiter.WaitForMenuOpenAndClose();
+
+  chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer;
+  browser()
+      ->tab_strip_model()
+      ->GetActiveWebContents()
+      ->GetMainFrame()
+      ->GetRemoteInterfaces()
+      ->GetInterface(&thumbnail_capturer);
+
+  auto callback = [](bool* response_received, const base::Closure& quit,
+                     const std::vector<uint8_t>& thumbnail_data,
+                     const gfx::Size& original_size) {
+    *response_received = true;
+    quit.Run();
+  };
+
+  base::RunLoop run_loop;
+  bool response_received = false;
+  thumbnail_capturer->RequestThumbnailForContextNode(
+      0, gfx::Size(2048, 2048),
+      base::Bind(callback, &response_received, run_loop.QuitClosure()));
+  run_loop.Run();
 
   // The browser should receive a response from the renderer, because the
   // renderer should not crash.
-  EXPECT_EQ(ThumbnailResponseWatcher::THUMBNAIL_RECEIVED, watcher.Wait());
+  ASSERT_TRUE(response_received);
 }
 
 class LoadImageRequestInterceptor : public net::URLRequestInterceptor {
diff --git a/chrome/browser/resources/settings/basic_page/basic_page.js b/chrome/browser/resources/settings/basic_page/basic_page.js
index 39599606..840b2f4 100644
--- a/chrome/browser/resources/settings/basic_page/basic_page.js
+++ b/chrome/browser/resources/settings/basic_page/basic_page.js
@@ -105,19 +105,31 @@
    * Queues a task to search the basic sections, then another for the advanced
    * sections.
    * @param {string} query The text to search for.
-   * @return {!Promise<!settings.SearchRequest>} A signal indicating that
+   * @return {!Promise<!settings.SearchResult>} A signal indicating that
    *     searching finished.
    */
   searchContents: function(query) {
-    var whenSearchDone = settings.getSearchManager().search(
-        query, assert(this.$$('#basicPage')));
+    var whenSearchDone = [
+      settings.getSearchManager().search(query, assert(this.$$('#basicPage'))),
+    ];
 
     if (this.pageVisibility.advancedSettings !== false) {
-      assert(whenSearchDone === settings.getSearchManager().search(
+      whenSearchDone.push(settings.getSearchManager().search(
           query, assert(this.$$('#advancedPageTemplate').get())));
     }
 
-    return whenSearchDone;
+    return Promise.all(whenSearchDone).then(function(requests) {
+      // Combine the SearchRequests results to a single SearchResult object.
+      return {
+        canceled: requests.some(function(r) { return r.canceled; }),
+        didFindMatches: requests.every(function(r) {
+          return !r.didFindMatches();
+        }),
+        // All requests correspond to the same user query, so only need to check
+        // one of them.
+        wasClearSearch: requests[0].isSame(''),
+      };
+    });
   },
 
 // <if expr="chromeos">
diff --git a/chrome/browser/resources/settings/search_settings.js b/chrome/browser/resources/settings/search_settings.js
index 78960bbf..30e03de 100644
--- a/chrome/browser/resources/settings/search_settings.js
+++ b/chrome/browser/resources/settings/search_settings.js
@@ -2,6 +2,20 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+cr.exportPath('settings');
+
+/**
+ * A data structure used by callers to combine the results of multiple search
+ * requests.
+ *
+ * @typedef {{
+ *   canceled: Boolean,
+ *   didFindMatches: Boolean,
+ *   wasClearSearch: Boolean,
+ * }}
+ */
+settings.SearchResult;
+
 cr.define('settings', function() {
   /** @const {string} */
   var WRAPPER_CSS_CLASS = 'search-highlight-wrapper';
@@ -125,8 +139,7 @@
     function doSearch(node) {
       if (node.nodeName == 'TEMPLATE' && node.hasAttribute('route-path') &&
           !node.if && !node.hasAttribute(SKIP_SEARCH_CSS_ATTRIBUTE)) {
-        getSearchManager().queue_.addRenderTask(
-            new RenderTask(request, node));
+        request.queue_.addRenderTask(new RenderTask(request, node));
         return;
       }
 
@@ -304,7 +317,7 @@
               parent.querySelector('[route-path="' + routePath + '"]');
           // Register a SearchAndHighlightTask for the part of the DOM that was
           // just rendered.
-          getSearchManager().queue_.addSearchAndHighlightTask(
+          this.request.queue_.addSearchAndHighlightTask(
               new SearchAndHighlightTask(this.request, assert(renderedNode)));
           resolve();
         }.bind(this));
@@ -372,8 +385,12 @@
 
   /**
    * @constructor
+   * @param {!settings.SearchRequest} request
    */
-  function TaskQueue() {
+  function TaskQueue(request) {
+    /** @private {!settings.SearchRequest} */
+    this.request_ = request;
+
     /**
      * @private {{
      *   high: !Array<!Task>,
@@ -452,18 +469,14 @@
 
         this.running_ = true;
         window.requestIdleCallback(function() {
-          function startNextTask() {
-            this.running_ = false;
-            this.consumePending_();
+          if (!this.request_.canceled) {
+            task.exec().then(function() {
+              this.running_ = false;
+              this.consumePending_();
+            }.bind(this));
           }
-          if (task.request.id ==
-              getSearchManager().activeRequest_.id) {
-            task.exec().then(startNextTask.bind(this));
-          } else {
-            // Dropping this task without ever executing it, since a new search
-            // has been issued since this task was queued.
-            startNextTask.call(this);
-          }
+          // Nothing to do otherwise. Since the request corresponding to this
+          // queue was canceled, the queue is disposed along with the request.
         }.bind(this));
         return;
       }
@@ -472,38 +485,52 @@
 
   /**
    * @constructor
+   *
+   * @param {string} rawQuery
+   * @param {!HTMLElement} root
    */
-  var SearchRequest = function(rawQuery) {
-    /** @type {number} */
-    this.id = SearchRequest.nextId_++;
-
+  var SearchRequest = function(rawQuery, root) {
     /** @private {string} */
     this.rawQuery_ = rawQuery;
 
+    /** @private {!HTMLElement} */
+    this.root_ = root;
+
     /** @type {?RegExp} */
     this.regExp = this.generateRegExp_();
 
     /**
-     * Whether this request was fully processed.
+     * Whether this request was canceled before completing.
      * @type {boolean}
      */
-    this.finished = false;
+    this.canceled = false;
 
     /** @private {boolean} */
     this.foundMatches_ = false;
 
     /** @type {!PromiseResolver} */
     this.resolver = new PromiseResolver();
-  };
 
-  /** @private {number} */
-  SearchRequest.nextId_ = 0;
+    /** @private {!TaskQueue} */
+    this.queue_ = new TaskQueue(this);
+    this.queue_.onEmpty(function() {
+      this.resolver.resolve(this);
+    }.bind(this));
+  };
 
   /** @private {!RegExp} */
   SearchRequest.SANITIZE_REGEX_ = /[-[\]{}()*+?.,\\^$|#\s]/g;
 
   SearchRequest.prototype = {
     /**
+     * Fires this search request.
+     */
+    start: function() {
+      this.queue_.addTopLevelSearchTask(
+          new TopLevelSearchTask(this, this.root_));
+    },
+
+    /**
      * @return {?RegExp}
      * @private
      */
@@ -561,37 +588,36 @@
    * @implements {SearchManager}
    */
   var SearchManagerImpl = function() {
-    /** @private {?settings.SearchRequest} */
-    this.activeRequest_ = null;
+    /** @private {!Set<!settings.SearchRequest>} */
+    this.activeRequests_ = new Set();
 
-    /** @private {!TaskQueue} */
-    this.queue_ = new TaskQueue();
-    this.queue_.onEmpty(function() {
-      this.activeRequest_.finished = true;
-      this.activeRequest_.resolver.resolve(this.activeRequest_);
-      this.activeRequest_ = null;
-    }.bind(this));
+    /** @private {?string} */
+    this.lastSearchedText_ = null;
   };
   cr.addSingletonGetter(SearchManagerImpl);
 
   SearchManagerImpl.prototype = {
     /** @override */
     search: function(text, page) {
-      // Creating a new request only if the |text| changed.
-      if (!this.activeRequest_ || !this.activeRequest_.isSame(text)) {
-        // Resolving previous search request without marking it as
-        // 'finished', if any, and dropping all pending tasks.
-        this.queue_.reset();
-        if (this.activeRequest_)
-          this.activeRequest_.resolver.resolve(this.activeRequest_);
-
-        this.activeRequest_ = new SearchRequest(text);
+      // Cancel any pending requests if a request with different text is
+      // submitted.
+      if (text != this.lastSearchedText_) {
+        this.activeRequests_.forEach(function(request) {
+          request.canceled = true;
+          request.resolver.resolve(request);
+        });
+        this.activeRequests_.clear();
       }
 
-      this.queue_.addTopLevelSearchTask(
-          new TopLevelSearchTask(this.activeRequest_, page));
-
-      return this.activeRequest_.resolver.promise;
+      this.lastSearchedText_ = text;
+      var request = new SearchRequest(text, page);
+      this.activeRequests_.add(request);
+      request.start();
+      return request.resolver.promise.then(function() {
+        // Stop tracking requests that finished.
+        this.activeRequests_.delete(request);
+        return request;
+      }.bind(this));
     },
   };
 
diff --git a/chrome/browser/resources/settings/settings_main/settings_main.js b/chrome/browser/resources/settings/settings_main/settings_main.js
index 22b4bd8..af79c71c 100644
--- a/chrome/browser/resources/settings/settings_main/settings_main.js
+++ b/chrome/browser/resources/settings/settings_main/settings_main.js
@@ -254,19 +254,19 @@
       setTimeout(function() {
         var whenSearchDone =
             assert(this.getPage_(settings.Route.BASIC)).searchContents(query);
-        whenSearchDone.then(function(request) {
+        whenSearchDone.then(function(result) {
           resolve();
-          if (!request.finished) {
+          if (result.canceled) {
             // Nothing to do here. A previous search request was canceled
-            // because a new search request was issued before the first one
-            // completed.
+            // because a new search request was issued with a different query
+            // before the previous completed.
             return;
           }
 
           this.toolbarSpinnerActive = false;
-          this.inSearchMode_ = !request.isSame('');
+          this.inSearchMode_ = !result.wasClearSearch;
           this.showNoResultsFound_ =
-              this.inSearchMode_ && !request.didFindMatches();
+              this.inSearchMode_ && result.didFindMatches;
         }.bind(this));
       }.bind(this), 0);
     }.bind(this));
diff --git a/chrome/browser/ui/android/context_menu_helper.cc b/chrome/browser/ui/android/context_menu_helper.cc
index ade834a6..f4ed7f8 100644
--- a/chrome/browser/ui/android/context_menu_helper.cc
+++ b/chrome/browser/ui/android/context_menu_helper.cc
@@ -6,11 +6,15 @@
 
 #include <stdint.h>
 
+#include <vector>
+
 #include "base/android/jni_android.h"
 #include "base/android/jni_array.h"
 #include "base/android/jni_string.h"
+#include "base/bind_helpers.h"
 #include "chrome/browser/android/download/download_controller_base.h"
 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
+#include "chrome/common/thumbnail_capturer.mojom.h"
 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h"
 #include "content/public/browser/android/content_view_core.h"
 #include "content/public/browser/render_frame_host.h"
@@ -18,6 +22,7 @@
 #include "content/public/common/context_menu_params.h"
 #include "jni/ContextMenuHelper_jni.h"
 #include "jni/ContextMenuParams_jni.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "third_party/WebKit/public/web/WebContextMenuData.h"
 #include "ui/android/window_android.h"
 #include "ui/gfx/geometry/point.h"
@@ -36,7 +41,7 @@
     "Chrome-Proxy: pass-through\r\n";
 
 ContextMenuHelper::ContextMenuHelper(content::WebContents* web_contents)
-    : web_contents_(web_contents) {
+    : web_contents_(web_contents), weak_factory_(this) {
   JNIEnv* env = base::android::AttachCurrentThread();
   java_obj_.Reset(
       env,
@@ -149,17 +154,21 @@
   if (!render_frame_host)
     return;
 
-  CoreTabHelper::FromWebContents(web_contents_)->
-      RequestThumbnailForContextNode(
-          render_frame_host,
-          0,
-          gfx::Size(kShareImageMaxWidth, kShareImageMaxHeight),
-          base::Bind(&ContextMenuHelper::OnShareImage,
-                     base::Unretained(this)));
+  chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer;
+  render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer);
+  // Bind the InterfacePtr into the callback so that it's kept alive until
+  // there's either a connection error or a response.
+  auto* thumbnail_capturer_proxy = thumbnail_capturer.get();
+  thumbnail_capturer_proxy->RequestThumbnailForContextNode(
+      0, gfx::Size(kShareImageMaxWidth, kShareImageMaxHeight),
+      base::Bind(&ContextMenuHelper::OnShareImage, weak_factory_.GetWeakPtr(),
+                 base::Passed(&thumbnail_capturer)));
 }
 
-void ContextMenuHelper::OnShareImage(const std::string& thumbnail_data,
-                                     const gfx::Size& original_size) {
+void ContextMenuHelper::OnShareImage(
+    chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
+    const std::vector<uint8_t>& thumbnail_data,
+    const gfx::Size& original_size) {
   content::ContentViewCore* content_view_core =
       content::ContentViewCore::FromWebContents(web_contents_);
   if (!content_view_core)
@@ -173,9 +182,7 @@
 
   JNIEnv* env = base::android::AttachCurrentThread();
   base::android::ScopedJavaLocalRef<jbyteArray> j_bytes =
-      base::android::ToJavaByteArray(
-          env, reinterpret_cast<const uint8_t*>(thumbnail_data.data()),
-          thumbnail_data.length());
+      base::android::ToJavaByteArray(env, thumbnail_data);
 
   Java_ContextMenuHelper_onShareImageReceived(env, java_obj_, jwindow_android,
                                               j_bytes);
diff --git a/chrome/browser/ui/android/context_menu_helper.h b/chrome/browser/ui/android/context_menu_helper.h
index 8e9e5747..5c9dfdb 100644
--- a/chrome/browser/ui/android/context_menu_helper.h
+++ b/chrome/browser/ui/android/context_menu_helper.h
@@ -7,10 +7,12 @@
 
 #include <memory>
 #include <string>
+#include <vector>
 
 #include "base/android/jni_android.h"
 #include "base/callback.h"
 #include "base/macros.h"
+#include "chrome/common/thumbnail_capturer.mojom.h"
 #include "content/public/browser/web_contents_user_data.h"
 #include "content/public/common/context_menu_params.h"
 #include "ui/gfx/geometry/size.h"
@@ -50,7 +52,8 @@
   static base::android::ScopedJavaLocalRef<jobject> CreateJavaContextMenuParams(
       const content::ContextMenuParams& params);
 
-  void OnShareImage(const std::string& thumbnail_data,
+  void OnShareImage(chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
+                    const std::vector<uint8_t>& thumbnail_data,
                     const gfx::Size& original_size);
 
   base::android::ScopedJavaGlobalRef<jobject> java_obj_;
@@ -60,6 +63,8 @@
   int render_frame_id_;
   int render_process_id_;
 
+  base::WeakPtrFactory<ContextMenuHelper> weak_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(ContextMenuHelper);
 };
 
diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.h b/chrome/browser/ui/cocoa/base_bubble_controller.h
index 1314263..9065d9e1 100644
--- a/chrome/browser/ui/cocoa/base_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/base_bubble_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BASE_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_BASE_BUBBLE_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -109,3 +112,5 @@
 // |-showWindow:| is overriden and does not call super. Noop on OSes <10.7.
 - (void)registerKeyStateEventTap;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_BASE_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h
index 7c8ccee6..9493c85 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_bridge.h
@@ -2,12 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// C++ bridge class between Chromium and Cocoa to connect the
-// Bookmarks (model) with the Bookmark Bar (view).
-//
-// There is exactly one BookmarkBarBridge per BookmarkBarController /
-// BrowserWindowController / Browser.
-
 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_
 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_
 
@@ -19,6 +13,11 @@
 class Profile;
 @class BookmarkBarController;
 
+// C++ bridge class between Chromium and Cocoa to connect the
+// Bookmarks (model) with the Bookmark Bar (view).
+//
+// There is exactly one BookmarkBarBridge per BookmarkBarController /
+// BrowserWindowController / Browser.
 class BookmarkBarBridge : public bookmarks::BookmarkModelObserver {
  public:
   BookmarkBarBridge(Profile* profile,
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h
index cdae99d..7710480 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_constants.h
@@ -2,10 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Constants used for positioning the bookmark bar. These aren't placed in a
-// different file because they're conditionally included in cross platform code
-// and thus no Objective-C++ stuff.
-
 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONSTANTS_H_
 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_CONSTANTS_H_
 
@@ -13,6 +9,9 @@
 
 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h"
 
+// Constants used for positioning the bookmark bar. These aren't placed in a
+// different file because they're conditionally included in cross platform code
+// and thus no Objective-C++ stuff.
 namespace bookmarks {
 
 // Correction used for computing other values based on the height.
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h
index 8d8dea7..bbe3049 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_hover_state.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_HOVER_STATE_H_
+#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_HOVER_STATE_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -76,3 +79,5 @@
 - (BookmarkButton*)hoverButton;
 - (HoverState)hoverState;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_HOVER_STATE_H_
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h
index 48ef5200..95008d5d 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_view.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_VIEW_H_
+#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_VIEW_H_
+
 #import <Cocoa/Cocoa.h>
 
 #import "base/mac/scoped_nsobject.h"
@@ -21,3 +24,5 @@
   base::scoped_nsobject<NSBox> dropIndicator_;
 }
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_FOLDER_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h
index e2d764b..5b4175c 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_toolbar_view.h
@@ -2,11 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// The BookmarkBarToolbarView is responsible for drawing the background of the
-// BookmarkBar's toolbar in either of its two display modes - permanently
-// attached (slimline with a stroke at the bottom edge) or New Tab Page style
-// (padded with a round rect border and the New Tab Page theme behind).
-
 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_TOOLBAR_VIEW_H_
 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_TOOLBAR_VIEW_H_
 
@@ -30,6 +25,10 @@
 
 @end
 
+// The BookmarkBarToolbarView is responsible for drawing the background of the
+// BookmarkBar's toolbar in either of its two display modes - permanently
+// attached (slimline with a stroke at the bottom edge) or New Tab Page style
+// (padded with a round rect border and the New Tab Page theme behind).
 @interface BookmarkBarToolbarView : AnimatableView {
  @private
   // The controller which tells us how we should be drawing (as normal or as a
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h
index 565c2a7..72ba129 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_view_cocoa.h
@@ -1,9 +1,6 @@
 // Copyright (c) 2010 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 simple custom NSView for the bookmark bar used to prevent clicking and
-// dragging from moving the browser window.
 
 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_COCOA_H_
 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_VIEW_COCOA_H_
@@ -36,6 +33,8 @@
 @property(nonatomic, assign) BookmarkBarController* controller;
 @end
 
+// A simple custom NSView for the bookmark bar used to prevent clicking and
+// dragging from moving the browser window.
 @interface BookmarkBarView()  // TestingOrInternalAPI
 @property(nonatomic, readonly) BOOL dropIndicatorShown;
 @property(nonatomic, readonly) CGFloat dropIndicatorPosition;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h
index f5073a7..3b760e7 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUBBLE_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -94,3 +97,5 @@
 + (NSString*)chooseAnotherFolderString;
 - (NSPopUpButton*)folderPopUpButton;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h
index 1e09852e..4f6f4cd 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_button.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_H_
+#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_H_
+
 #import <Cocoa/Cocoa.h>
 #include <vector>
 #import "chrome/browser/ui/cocoa/draggable_button.h"
@@ -261,3 +264,4 @@
 - (void)beginDrag:(NSEvent*)event;
 @end
 
+#endif  // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BUTTON_H_
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
index 4f0c7eb..aadd137 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h
@@ -2,21 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// C++ controller for the bookmark menu; one per AppController (which
-// means there is only one).  When bookmarks are changed, this class
-// takes care of updating Cocoa bookmark menus.  This is not named
-// BookmarkMenuController to help avoid confusion between languages.
-// This class needs to be C++, not ObjC, since it derives from
-// BookmarkModelObserver.
-//
-// Most Chromium Cocoa menu items are static from a nib (e.g. New
-// Tab), but may be enabled/disabled under certain circumstances
-// (e.g. Cut and Paste).  In addition, most Cocoa menu items have
-// firstResponder: as a target.  Unusually, bookmark menu items are
-// created dynamically.  They also have a target of
-// BookmarkMenuCocoaController instead of firstResponder.
-// See BookmarkMenuBridge::AddNodeToMenu()).
-
 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_
 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_BRIDGE_H_
 
@@ -36,6 +21,20 @@
 class BookmarkNode;
 }
 
+// C++ controller for the bookmark menu; one per AppController (which
+// means there is only one).  When bookmarks are changed, this class
+// takes care of updating Cocoa bookmark menus.  This is not named
+// BookmarkMenuController to help avoid confusion between languages.
+// This class needs to be C++, not ObjC, since it derives from
+// BookmarkModelObserver.
+//
+// Most Chromium Cocoa menu items are static from a nib (e.g. New
+// Tab), but may be enabled/disabled under certain circumstances
+// (e.g. Cut and Paste).  In addition, most Cocoa menu items have
+// firstResponder: as a target.  Unusually, bookmark menu items are
+// created dynamically.  They also have a target of
+// BookmarkMenuCocoaController instead of firstResponder.
+// See BookmarkMenuBridge::AddNodeToMenu()).
 class BookmarkMenuBridge : public bookmarks::BookmarkModelObserver,
                            public MainMenuItem {
  public:
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h
index 2e18f7d..2176ec3d 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller.h
@@ -2,10 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Controller (MVC) for the bookmark menu.
-// All bookmark menu item commands get directed here.
-// Unfortunately there is already a C++ class named BookmarkMenuController.
-
 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_
 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MENU_COCOA_CONTROLLER_H_
 
@@ -20,6 +16,9 @@
 class BookmarkNode;
 }
 
+// Controller (MVC) for the bookmark menu.
+// All bookmark menu item commands get directed here.
+// Unfortunately there is already a C++ class named BookmarkMenuController.
 @interface BookmarkMenuCocoaController : NSObject<NSMenuDelegate> {
  @private
   BookmarkMenuBridge* bridge_;  // weak; owns me
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h b/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h
index 66b8163..0bc74f31 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h
@@ -2,6 +2,18 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H_
+#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include <set>
+
+#include "base/mac/scoped_block.h"
+#include "base/macros.h"
+#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/bookmarks/browser/bookmark_model_observer.h"
+
 // C++ bridge class to send a selector to a Cocoa object when the
 // bookmark model changes.  Some Cocoa objects edit the bookmark model
 // and temporarily save a copy of the state (e.g. bookmark button
@@ -15,19 +27,6 @@
 // cancel an edit if the removed node is a folder (editors often have
 // a list of "new parents").  But, just to be sure, notification
 // happens on any removal.
-
-#ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H_
-#define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_MODEL_OBSERVER_FOR_COCOA_H_
-
-#import <Cocoa/Cocoa.h>
-
-#include <set>
-
-#include "base/mac/scoped_block.h"
-#include "base/macros.h"
-#include "components/bookmarks/browser/bookmark_model.h"
-#include "components/bookmarks/browser/bookmark_model_observer.h"
-
 class BookmarkModelObserverForCocoa : public bookmarks::BookmarkModelObserver {
  public:
   // Callback called on a significant model change.
diff --git a/chrome/browser/ui/cocoa/bubble_combobox.h b/chrome/browser/ui/cocoa/bubble_combobox.h
index 96009cb..d7ee71e7 100644
--- a/chrome/browser/ui/cocoa/bubble_combobox.h
+++ b/chrome/browser/ui/cocoa/bubble_combobox.h
@@ -2,7 +2,6 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-
 #ifndef CHROME_BROWSER_UI_COCOA_BUBBLE_COMBOBOX_H_
 #define CHROME_BROWSER_UI_COCOA_BUBBLE_COMBOBOX_H_
 
diff --git a/chrome/browser/ui/cocoa/bubble_view.h b/chrome/browser/ui/cocoa/bubble_view.h
index 12c89f4..c47a756 100644
--- a/chrome/browser/ui/cocoa/bubble_view.h
+++ b/chrome/browser/ui/cocoa/bubble_view.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_BUBBLE_VIEW_H_
+#define CHROME_BROWSER_UI_COCOA_BUBBLE_VIEW_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -66,3 +69,5 @@
 - (NSString*)content;
 - (unsigned long)cornerFlags;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_BUBBLE_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h
index f602b69a..b9e8275 100644
--- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h
+++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COLLECTED_COOKIES_MAC_H_
+#define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COLLECTED_COOKIES_MAC_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -150,3 +153,5 @@
 + (NSArray*)normalizeNodeSelection:(NSArray*)selection;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COLLECTED_COOKIES_MAC_H_
diff --git a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
index d7e2ff3e..a7c7fb25 100644
--- a/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
+++ b/chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_
+#define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <map>
@@ -114,3 +117,5 @@
 - (content_setting_bubble::MediaMenuPartsMap*)mediaMenus;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_CONTENT_SETTING_BUBBLE_COCOA_H_
diff --git a/chrome/browser/ui/cocoa/content_settings/cookie_details.h b/chrome/browser/ui/cocoa/content_settings/cookie_details.h
index ca9d5c9..6ffc6b0 100644
--- a/chrome/browser/ui/cocoa/content_settings/cookie_details.h
+++ b/chrome/browser/ui/cocoa/content_settings/cookie_details.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_DETAILS_H_
+#define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_DETAILS_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -252,3 +255,5 @@
 // in its initializer.
 - (id)initWithDetails:(CocoaCookieDetails*)details;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_DETAILS_H_
diff --git a/chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h b/chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h
index 0c6b34f..4894342 100644
--- a/chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h
+++ b/chrome/browser/ui/cocoa/content_settings/cookie_details_view_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_DETAILS_VIEW_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_DETAILS_VIEW_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "net/cookies/cookie_monster.h"
@@ -53,3 +56,4 @@
 
 @end
 
+#endif  // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_DETAILS_VIEW_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h b/chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h
index 1af0a75..d994e2c 100644
--- a/chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h
+++ b/chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_TREE_NODE_H_
+#define CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_TREE_NODE_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -35,3 +38,5 @@
 - (CocoaCookieDetails*)details;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_CONTENT_SETTINGS_COOKIE_TREE_NODE_H_
diff --git a/chrome/browser/ui/cocoa/custom_frame_view.h b/chrome/browser/ui/cocoa/custom_frame_view.h
index abb2278..0f87124 100644
--- a/chrome/browser/ui/cocoa/custom_frame_view.h
+++ b/chrome/browser/ui/cocoa/custom_frame_view.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_CUSTOM_FRAME_VIEW_H_
+#define CHROME_BROWSER_UI_COCOA_CUSTOM_FRAME_VIEW_H_
+
 #import <Cocoa/Cocoa.h>
 
 // CustomFrameView is a class whose methods we swizzle into NSGrayFrame
@@ -19,3 +22,5 @@
 - (NSPoint)_fullScreenButtonOrigin;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_CUSTOM_FRAME_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/dock_icon.h b/chrome/browser/ui/cocoa/dock_icon.h
index 259171a0..35b52a2 100644
--- a/chrome/browser/ui/cocoa/dock_icon.h
+++ b/chrome/browser/ui/cocoa/dock_icon.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_DOCK_ICON_H_
+#define CHROME_BROWSER_UI_COCOA_DOCK_ICON_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/time/time.h"
@@ -39,3 +42,5 @@
 - (void)setProgress:(float)progress;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_DOCK_ICON_H_
diff --git a/chrome/browser/ui/cocoa/download/download_item_button.h b/chrome/browser/ui/cocoa/download/download_item_button.h
index 33646d7..1b3d590dfb 100644
--- a/chrome/browser/ui/cocoa/download/download_item_button.h
+++ b/chrome/browser/ui/cocoa/download/download_item_button.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_BUTTON_H_
+#define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_BUTTON_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/files/file_path.h"
@@ -30,3 +33,5 @@
 - (void)beginDrag:(NSEvent*)event;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_BUTTON_H_
diff --git a/chrome/browser/ui/cocoa/download/download_item_controller.h b/chrome/browser/ui/cocoa/download/download_item_controller.h
index e85315ba..9b13040 100644
--- a/chrome/browser/ui/cocoa/download/download_item_controller.h
+++ b/chrome/browser/ui/cocoa/download/download_item_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -163,3 +166,5 @@
 - (IBAction)showContextMenu:(id)sender;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_ITEM_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_context_menu_controller.h b/chrome/browser/ui/cocoa/download/download_shelf_context_menu_controller.h
index 6aaaf097..bab15aa 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_context_menu_controller.h
+++ b/chrome/browser/ui/cocoa/download/download_shelf_context_menu_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #import "ui/base/cocoa/menu_controller.h"
@@ -24,3 +27,5 @@
 
 - (void)menuDidClose:(NSMenu*)menu;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHELF_CONTEXT_MENU_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_controller.h b/chrome/browser/ui/cocoa/download/download_shelf_controller.h
index 071f806..57192ac 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_controller.h
+++ b/chrome/browser/ui/cocoa/download/download_shelf_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHELF_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHELF_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -131,3 +134,5 @@
 - (void)layoutItems;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHELF_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/download/download_show_all_button.h b/chrome/browser/ui/cocoa/download/download_show_all_button.h
index 6e1afe1..e2f5734fd 100644
--- a/chrome/browser/ui/cocoa/download/download_show_all_button.h
+++ b/chrome/browser/ui/cocoa/download/download_show_all_button.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHOW_ALL_BUTTON_H_
+#define CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHOW_ALL_BUTTON_H_
+
 #import <Cocoa/Cocoa.h>
 
 #import "chrome/browser/ui/cocoa/themed_window.h"
@@ -10,3 +13,5 @@
 // -sizeToFit logic.
 @interface DownloadShowAllButton : NSButton<ThemedWindowDrawing>
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_DOWNLOAD_DOWNLOAD_SHOW_ALL_BUTTON_H_
diff --git a/chrome/browser/ui/cocoa/external_protocol_dialog.h b/chrome/browser/ui/cocoa/external_protocol_dialog.h
index ba0a4de..a859cb8 100644
--- a/chrome/browser/ui/cocoa/external_protocol_dialog.h
+++ b/chrome/browser/ui/cocoa/external_protocol_dialog.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_EXTERNAL_PROTOCOL_DIALOG_H_
+#define CHROME_BROWSER_UI_COCOA_EXTERNAL_PROTOCOL_DIALOG_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/time/time.h"
@@ -21,3 +24,5 @@
     routingId:(int)routingId;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_EXTERNAL_PROTOCOL_DIALOG_H_
diff --git a/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h b/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h
index 93d6981..c12161d 100644
--- a/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h
+++ b/chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_COCOA_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_COCOA_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -104,3 +107,5 @@
 - (int)findBarWidth;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_COCOA_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h b/chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h
index 765cc64..36677dd 100644
--- a/chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h
+++ b/chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_TEXT_FIELD_H_
+#define CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_TEXT_FIELD_H_
+
 #import <Cocoa/Cocoa.h>
 #import "chrome/browser/ui/cocoa/styled_text_field.h"
 
@@ -19,3 +22,5 @@
 - (FindBarTextFieldCell*)findBarTextFieldCell;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_TEXT_FIELD_H_
diff --git a/chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h b/chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h
index 130009fe..9443fdbf 100644
--- a/chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h
+++ b/chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_TEXT_FIELD_CELL_H_
+#define CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_TEXT_FIELD_CELL_H_
+
 #import <Cocoa/Cocoa.h>
 
 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h"
@@ -24,3 +27,5 @@
 - (NSString*)resultsString;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_FIND_BAR_FIND_BAR_TEXT_FIELD_CELL_H_
diff --git a/chrome/browser/ui/cocoa/first_run_bubble_controller.h b/chrome/browser/ui/cocoa/first_run_bubble_controller.h
index 43c8eab..ab778f34 100644
--- a/chrome/browser/ui/cocoa/first_run_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/first_run_bubble_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_FIRST_RUN_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_FIRST_RUN_BUBBLE_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
@@ -27,3 +30,5 @@
 - (IBAction)onChange:(id)sender;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_FIRST_RUN_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/fullscreen_window.h b/chrome/browser/ui/cocoa/fullscreen_window.h
index 12be00d9..840aee53 100644
--- a/chrome/browser/ui/cocoa/fullscreen_window.h
+++ b/chrome/browser/ui/cocoa/fullscreen_window.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_FULLSCREEN_WINDOW_H_
+#define CHROME_BROWSER_UI_COCOA_FULLSCREEN_WINDOW_H_
+
 #include <Cocoa/Cocoa.h>
 #import "chrome/browser/ui/cocoa/chrome_browser_window.h"
 
@@ -17,3 +20,5 @@
 - (id)initForScreen:(NSScreen*)screen;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_FULLSCREEN_WINDOW_H_
diff --git a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.h b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.h
index d6fd3c1..f29057b 100644
--- a/chrome/browser/ui/cocoa/history_menu_cocoa_controller.h
+++ b/chrome/browser/ui/cocoa/history_menu_cocoa_controller.h
@@ -2,16 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-// Controller (MVC) for the history menu. All history menu item commands get
-// directed here. This class only responds to menu events, but the actual
-// creation and maintenance of the menu happens in the Bridge.
-
 #ifndef CHROME_BROWSER_UI_COCOA_HISTORY_MENU_COCOA_CONTROLLER_H_
 #define CHROME_BROWSER_UI_COCOA_HISTORY_MENU_COCOA_CONTROLLER_H_
 
 #import <Cocoa/Cocoa.h>
 #import "chrome/browser/ui/cocoa/history_menu_bridge.h"
 
+// Controller (MVC) for the history menu. All history menu item commands get
+// directed here. This class only responds to menu events, but the actual
+// creation and maintenance of the menu happens in the Bridge.
 @interface HistoryMenuCocoaController : NSObject {
  @private
   HistoryMenuBridge* bridge_;  // weak; owns us
diff --git a/chrome/browser/ui/cocoa/info_bubble_window.h b/chrome/browser/ui/cocoa/info_bubble_window.h
index 156d100..0b20763 100644
--- a/chrome/browser/ui/cocoa/info_bubble_window.h
+++ b/chrome/browser/ui/cocoa/info_bubble_window.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_WINDOW_H_
+#define CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_WINDOW_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -58,3 +61,5 @@
 - (BOOL)isClosing;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_INFO_BUBBLE_WINDOW_H_
diff --git a/chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h b/chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h
index ab13175..ebbde11 100644
--- a/chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h
+++ b/chrome/browser/ui/cocoa/infobars/after_translate_infobar_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_AFTER_TRANSLATE_INFOBAR_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_INFOBARS_AFTER_TRANSLATE_INFOBAR_CONTROLLER_H_
+
 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h"
 
 @interface AfterTranslateInfobarController : TranslateInfoBarControllerBase {
@@ -10,3 +13,5 @@
 }
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_INFOBARS_AFTER_TRANSLATE_INFOBAR_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h b/chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h
index df751e2..f5380eb7 100644
--- a/chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h
+++ b/chrome/browser/ui/cocoa/infobars/before_translate_infobar_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_BEFORE_TRANSLATE_INFOBAR_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_INFOBARS_BEFORE_TRANSLATE_INFOBAR_CONTROLLER_H_
+
 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h"
 
 @interface BeforeTranslateInfobarController : TranslateInfoBarControllerBase {
@@ -20,3 +23,5 @@
 - (NSButton*)neverTranslateButton;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_INFOBARS_BEFORE_TRANSLATE_INFOBAR_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller.h b/chrome/browser/ui/cocoa/infobars/infobar_controller.h
index e1d50bc..94e48527 100644
--- a/chrome/browser/ui/cocoa/infobars/infobar_controller.h
+++ b/chrome/browser/ui/cocoa/infobars/infobar_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -100,3 +103,5 @@
 // InfoBarController subclasses, one for each InfoBarDelegate
 // subclass.  Each of these subclasses overrides addAdditionalControls to
 // configure its view as necessary.
+
+#endif  // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/infobars/translate_message_infobar_controller.h b/chrome/browser/ui/cocoa/infobars/translate_message_infobar_controller.h
index 6a115fc..3210374a 100644
--- a/chrome/browser/ui/cocoa/infobars/translate_message_infobar_controller.h
+++ b/chrome/browser/ui/cocoa/infobars/translate_message_infobar_controller.h
@@ -2,9 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_CONTROLLER_H_
+
 #import "chrome/browser/ui/cocoa/infobars/translate_infobar_base.h"
 
 @interface TranslateMessageInfobarController : TranslateInfoBarControllerBase {
 }
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_INFOBARS_TRANSLATE_MESSAGE_INFOBAR_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/l10n_util.h b/chrome/browser/ui/cocoa/l10n_util.h
index 8457c7f..7e6175c 100644
--- a/chrome/browser/ui/cocoa/l10n_util.h
+++ b/chrome/browser/ui/cocoa/l10n_util.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_L10N_UTIL_H_
+#define CHROME_BROWSER_UI_COCOA_L10N_UTIL_H_
+
 #import <Cocoa/Cocoa.h>
 #include <stddef.h>
 
@@ -54,3 +57,5 @@
 NSImage* FlippedImage(NSImage* image);
 
 }  // namespace cocoa_l10n_util
+
+#endif  // CHROME_BROWSER_UI_COCOA_L10N_UTIL_H_
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h
index 1e3ca73d..bc1e235 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_AUTOCOMPLETE_TEXT_FIELD_CELL_H_
+#define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_AUTOCOMPLETE_TEXT_FIELD_CELL_H_
+
 #include <vector>
 
 #import <Cocoa/Cocoa.h>
@@ -145,3 +148,5 @@
 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_AUTOCOMPLETE_TEXT_FIELD_CELL_H_
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h
index dc284b4..adaa98fa 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_AUTOCOMPLETE_TEXT_FIELD_EDITOR_H_
+#define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_AUTOCOMPLETE_TEXT_FIELD_EDITOR_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -56,3 +59,5 @@
 - (AutocompleteTextFieldObserver*)observer;
 - (void)pasteAndGo:sender;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_AUTOCOMPLETE_TEXT_FIELD_EDITOR_H_
diff --git a/chrome/browser/ui/cocoa/styled_text_field.h b/chrome/browser/ui/cocoa/styled_text_field.h
index 68a65b77..c55dfb2 100644
--- a/chrome/browser/ui/cocoa/styled_text_field.h
+++ b/chrome/browser/ui/cocoa/styled_text_field.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_STYLED_TEXT_FIELD_H_
+#define CHROME_BROWSER_UI_COCOA_STYLED_TEXT_FIELD_H_
+
 #import <Cocoa/Cocoa.h>
 
 @class StyledTextFieldCell;
@@ -27,3 +30,5 @@
 @interface StyledTextField (ExposedForTesting)
 - (StyledTextFieldCell*)styledTextFieldCell;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_STYLED_TEXT_FIELD_H_
diff --git a/chrome/browser/ui/cocoa/test/styled_text_field_test_helper.h b/chrome/browser/ui/cocoa/test/styled_text_field_test_helper.h
index 8ece572..97ca884 100644
--- a/chrome/browser/ui/cocoa/test/styled_text_field_test_helper.h
+++ b/chrome/browser/ui/cocoa/test/styled_text_field_test_helper.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_TEST_STYLED_TEXT_FIELD_TEST_HELPER_H_
+#define CHROME_BROWSER_UI_COCOA_TEST_STYLED_TEXT_FIELD_TEST_HELPER_H_
+
 #import <Cocoa/Cocoa.h>
 #import "chrome/browser/ui/cocoa/styled_text_field_cell.h"
 
@@ -14,3 +17,5 @@
 @property(nonatomic, assign) CGFloat leftMargin;
 @property(nonatomic, assign) CGFloat rightMargin;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_TEST_STYLED_TEXT_FIELD_TEST_HELPER_H_
diff --git a/chrome/browser/ui/cocoa/translate/translate_bubble_controller.h b/chrome/browser/ui/cocoa/translate/translate_bubble_controller.h
index 00b0436..debaa2a 100644
--- a/chrome/browser/ui/cocoa/translate/translate_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/translate/translate_bubble_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_TRANSLATE_TRANSLATE_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_TRANSLATE_TRANSLATE_BUBBLE_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -89,3 +92,5 @@
 - (IBAction)handleCloseButtonPressed:(id)sender;
 - (IBAction)handleTranslateButtonPressed:(id)sender;
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_TRANSLATE_TRANSLATE_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
index a886446f..25e3da5b 100644
--- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_PERMISSION_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_PERMISSION_BUBBLE_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
@@ -61,3 +64,5 @@
 - (bool)hasVisibleLocationBar;
 
 @end
+
+#endif  // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_PERMISSION_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h
index 721237d..9c9739fd 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.h
@@ -2,6 +2,9 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#ifndef CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROLLER_H_
+
 #import <Cocoa/Cocoa.h>
 
 #include <memory>
@@ -151,3 +154,5 @@
 
   DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsUIBridge);
 };
+
+#endif  // CHROME_BROWSER_UI_COCOA_WEBSITE_SETTINGS_WEBSITE_SETTINGS_BUBBLE_CONTROLLER_H_
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.cc b/chrome/browser/ui/tab_contents/core_tab_helper.cc
index 8c5cddcd..e017f214 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.cc
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.cc
@@ -20,6 +20,7 @@
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/common/render_messages.h"
+#include "chrome/common/thumbnail_capturer.mojom.h"
 #include "chrome/grit/generated_resources.h"
 #include "components/guest_view/browser/guest_view_manager.h"
 #include "components/search_engines/template_url.h"
@@ -36,6 +37,7 @@
 #include "content/public/common/context_menu_params.h"
 #include "net/base/load_states.h"
 #include "net/http/http_request_headers.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
 #include "ui/base/l10n/l10n_util.h"
 
 #if !defined(OS_ANDROID)
@@ -57,11 +59,10 @@
 CoreTabHelper::CoreTabHelper(WebContents* web_contents)
     : content::WebContentsObserver(web_contents),
       delegate_(NULL),
-      content_restrictions_(0) {
-}
+      content_restrictions_(0),
+      weak_factory_(this) {}
 
-CoreTabHelper::~CoreTabHelper() {
-}
+CoreTabHelper::~CoreTabHelper() {}
 
 base::string16 CoreTabHelper::GetDefaultTitle() {
   return l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE);
@@ -105,31 +106,19 @@
 }
 
 void CoreTabHelper::SearchByImageInNewTab(
-    content::RenderFrameHost* render_frame_host, const GURL& src_url) {
-  RequestThumbnailForContextNode(
-      render_frame_host,
-      kImageSearchThumbnailMinSize,
-      gfx::Size(kImageSearchThumbnailMaxWidth,
-                kImageSearchThumbnailMaxHeight),
-      base::Bind(&CoreTabHelper::DoSearchByImageInNewTab,
-                 base::Unretained(this),
-                 src_url));
-}
-
-void CoreTabHelper::RequestThumbnailForContextNode(
     content::RenderFrameHost* render_frame_host,
-    int minimum_size,
-    gfx::Size maximum_size,
-    const ContextNodeThumbnailCallback& callback) {
-  int callback_id = thumbnail_callbacks_.Add(
-      base::MakeUnique<ContextNodeThumbnailCallback>(callback));
-
-  render_frame_host->Send(
-      new ChromeViewMsg_RequestThumbnailForContextNode(
-          render_frame_host->GetRoutingID(),
-          minimum_size,
-          maximum_size,
-          callback_id));
+    const GURL& src_url) {
+  chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer;
+  render_frame_host->GetRemoteInterfaces()->GetInterface(&thumbnail_capturer);
+  // Bind the InterfacePtr into the callback so that it's kept alive until
+  // there's either a connection error or a response.
+  auto* thumbnail_capturer_proxy = thumbnail_capturer.get();
+  thumbnail_capturer_proxy->RequestThumbnailForContextNode(
+      kImageSearchThumbnailMinSize,
+      gfx::Size(kImageSearchThumbnailMaxWidth, kImageSearchThumbnailMaxHeight),
+      base::Bind(&CoreTabHelper::DoSearchByImageInNewTab,
+                 weak_factory_.GetWeakPtr(), base::Passed(&thumbnail_capturer),
+                 src_url));
 }
 
 // static
@@ -301,35 +290,13 @@
   OnCloseCanceled();
 }
 
-bool CoreTabHelper::OnMessageReceived(
-    const IPC::Message& message,
-    content::RenderFrameHost* render_frame_host) {
-  bool handled = true;
-  IPC_BEGIN_MESSAGE_MAP(CoreTabHelper, message)
-    IPC_MESSAGE_HANDLER(ChromeViewHostMsg_RequestThumbnailForContextNode_ACK,
-                        OnRequestThumbnailForContextNodeACK)
-    IPC_MESSAGE_UNHANDLED(handled = false)
-  IPC_END_MESSAGE_MAP()
-  return handled;
-}
-
-void CoreTabHelper::OnRequestThumbnailForContextNodeACK(
-    const std::string& thumbnail_data,
-    const gfx::Size& original_size,
-    int callback_id) {
-  ContextNodeThumbnailCallback* callback =
-      thumbnail_callbacks_.Lookup(callback_id);
-  if (!callback)
-    return;
-  callback->Run(thumbnail_data, original_size);
-  thumbnail_callbacks_.Remove(callback_id);
-}
-
 // Handles the image thumbnail for the context node, composes a image search
 // request based on the received thumbnail and opens the request in a new tab.
-void CoreTabHelper::DoSearchByImageInNewTab(const GURL& src_url,
-                                            const std::string& thumbnail_data,
-                                            const gfx::Size& original_size) {
+void CoreTabHelper::DoSearchByImageInNewTab(
+    chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
+    const GURL& src_url,
+    const std::vector<uint8_t>& thumbnail_data,
+    const gfx::Size& original_size) {
   if (thumbnail_data.empty())
     return;
 
@@ -347,7 +314,8 @@
 
   TemplateURLRef::SearchTermsArgs search_args =
       TemplateURLRef::SearchTermsArgs(base::string16());
-  search_args.image_thumbnail_content = thumbnail_data;
+  search_args.image_thumbnail_content.assign(thumbnail_data.begin(),
+                                             thumbnail_data.end());
   search_args.image_url = src_url;
   search_args.image_original_size = original_size;
   TemplateURLRef::PostContent post_content;
diff --git a/chrome/browser/ui/tab_contents/core_tab_helper.h b/chrome/browser/ui/tab_contents/core_tab_helper.h
index 43041d47..7d9d30b8 100644
--- a/chrome/browser/ui/tab_contents/core_tab_helper.h
+++ b/chrome/browser/ui/tab_contents/core_tab_helper.h
@@ -8,9 +8,10 @@
 #include <string>
 
 #include "base/callback.h"
-#include "base/id_map.h"
 #include "base/macros.h"
+#include "base/memory/weak_ptr.h"
 #include "base/time/time.h"
+#include "chrome/common/thumbnail_capturer.mojom.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
 #include "ui/gfx/geometry/size.h"
@@ -22,9 +23,6 @@
 class CoreTabHelper : public content::WebContentsObserver,
                       public content::WebContentsUserData<CoreTabHelper> {
  public:
-  using ContextNodeThumbnailCallback =
-      base::Callback<void(const std::string&, const gfx::Size&)>;
-
   ~CoreTabHelper() override;
 
   // Initial title assigned to NavigationEntries from Navigate.
@@ -56,11 +54,6 @@
   // the image resources.
   void SearchByImageInNewTab(content::RenderFrameHost* render_frame_host,
                              const GURL& src_url);
-  void RequestThumbnailForContextNode(
-      content::RenderFrameHost* render_frame_host,
-      int minimum_size,
-      gfx::Size maximum_size,
-      const ContextNodeThumbnailCallback& callback);
 
   CoreTabHelperDelegate* delegate() const { return delegate_; }
   void set_delegate(CoreTabHelperDelegate* d) { delegate_ = d; }
@@ -85,15 +78,12 @@
   void WebContentsDestroyed() override;
   void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
   void BeforeUnloadDialogCancelled() override;
-  bool OnMessageReceived(const IPC::Message& message,
-                         content::RenderFrameHost* render_frame_host) override;
 
-  void OnRequestThumbnailForContextNodeACK(const std::string& thumbnail_data,
-                                           const gfx::Size& original_size,
-                                           int callback_id);
-  void DoSearchByImageInNewTab(const GURL& src_url,
-                               const std::string& thumbnail_data,
-                               const gfx::Size& original_size);
+  void DoSearchByImageInNewTab(
+      chrome::mojom::ThumbnailCapturerPtr thumbnail_capturer,
+      const GURL& src_url,
+      const std::vector<uint8_t>& thumbnail_data,
+      const gfx::Size& original_size);
 
   // Delegate for notifying our owner about stuff. Not owned by us.
   CoreTabHelperDelegate* delegate_;
@@ -115,7 +105,7 @@
   // (full-page plugins for now only) permissions.
   int content_restrictions_;
 
-  IDMap<std::unique_ptr<ContextNodeThumbnailCallback>> thumbnail_callbacks_;
+  base::WeakPtrFactory<CoreTabHelper> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(CoreTabHelper);
 };
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_browsertest.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_browsertest.cc
new file mode 100644
index 0000000..f0536d5d
--- /dev/null
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_browsertest.cc
@@ -0,0 +1,30 @@
+// 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 "chrome/browser/ui/views/bookmarks/bookmark_editor_view.h"
+
+#include "chrome/browser/ui/bookmarks/bookmark_utils_desktop.h"
+#include "chrome/browser/ui/test/test_browser_dialog.h"
+
+// Test harness for integration tests using BookmarkEditorView.
+class BookmarkEditorViewBrowserTest : public DialogBrowserTest {
+ public:
+  BookmarkEditorViewBrowserTest() {}
+
+  // DialogBrowserTest:
+  void ShowDialog(const std::string& name) override {
+    DCHECK_EQ("all_tabs", name);
+    chrome::ShowBookmarkAllTabsDialog(browser());
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(BookmarkEditorViewBrowserTest);
+};
+
+// Shows the dialog for bookmarking all tabs. This shows a BookmarkEditorView
+// dialog, with a tree view, where a user can rename and select a parent folder.
+// Can be interactive when run with --gtest_filter=BrowserDialogTest.Invoke.
+IN_PROC_BROWSER_TEST_F(BookmarkEditorViewBrowserTest, InvokeDialog_all_tabs) {
+  RunDialog();
+}
diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn
index 0d27142..b2fcf05 100644
--- a/chrome/common/BUILD.gn
+++ b/chrome/common/BUILD.gn
@@ -700,6 +700,7 @@
     "renderer_configuration.mojom",
     "resource_usage_reporter.mojom",
     "shell_handler_win.mojom",
+    "thumbnail_capturer.mojom",
   ]
 
   if (is_chromeos) {
@@ -713,6 +714,7 @@
   public_deps = [
     "//components/content_settings/core/common:mojo_bindings",
     "//mojo/common:common_custom_types",
+    "//ui/gfx/geometry/mojo",
     "//url/mojo:url_mojom_gurl",
   ]
 }
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index e3fd984d..9614124 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -139,16 +139,6 @@
 // TODO(nigeltao): delete this when tab_android.cc's use is converted to Mojo.
 IPC_MESSAGE_ROUTED0(ChromeViewMsg_RequestReloadImageForContextNode)
 
-// Asks the renderer for a thumbnail of the image selected by the most
-// recently opened context menu, if there is one. If the image's area
-// is greater than thumbnail_min_area it will be downscaled to
-// be within thumbnail_max_size. The possibly downsampled image will be
-// returned in a ChromeViewHostMsg_RequestThumbnailForContextNode_ACK message.
-IPC_MESSAGE_ROUTED3(ChromeViewMsg_RequestThumbnailForContextNode,
-                    int /* thumbnail_min_area_pixels */,
-                    gfx::Size /* thumbnail_max_size_pixels */,
-                    int /* ID of the callback */)
-
 // Notifies the renderer whether hiding/showing the browser controls is enabled,
 // what the current state should be, and whether or not to animate to the
 // proper state.
@@ -161,13 +151,6 @@
 IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetWindowFeatures,
                     blink::mojom::WindowFeatures /* window_features */)
 
-// Responds to the request for a thumbnail.
-// Thumbnail data will be empty is a thumbnail could not be produced.
-IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_RequestThumbnailForContextNode_ACK,
-                    std::string /* JPEG-encoded thumbnail data */,
-                    gfx::Size /* original size of the image */,
-                    int /* ID of the callback */)
-
 // Requests application info for the page. The renderer responds back with
 // ChromeViewHostMsg_DidGetWebApplicationInfo.
 IPC_MESSAGE_ROUTED0(ChromeViewMsg_GetWebApplicationInfo)
diff --git a/chrome/common/thumbnail_capturer.mojom b/chrome/common/thumbnail_capturer.mojom
new file mode 100644
index 0000000..71bf82c2
--- /dev/null
+++ b/chrome/common/thumbnail_capturer.mojom
@@ -0,0 +1,18 @@
+// 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.
+
+module chrome.mojom;
+
+import "ui/gfx/geometry/mojo/geometry.mojom";
+
+interface ThumbnailCapturer {
+  // Requests a JPEG encoded thumbnail of the image selected by the most
+  // recently opened context menu. If no image is selected or there's an error
+  // capturing a thumbnail, |thumbnail_data| will be empty. If the image area is
+  // larger than |thumbnail_min_area_pixels| it will be downscaled to fit within
+  // |thumbnail_max_size_pixels|.
+  RequestThumbnailForContextNode(int32 thumbnail_min_area_pixels,
+                                 gfx.mojom.Size thumbnail_max_size_pixels)
+      => (array<uint8> thumbnail_data, gfx.mojom.Size original_size);
+};
diff --git a/chrome/renderer/chrome_render_frame_observer.cc b/chrome/renderer/chrome_render_frame_observer.cc
index 84e6db4..ed235f5 100644
--- a/chrome/renderer/chrome_render_frame_observer.cc
+++ b/chrome/renderer/chrome_render_frame_observer.cc
@@ -116,6 +116,9 @@
   render_frame->GetInterfaceRegistry()->AddInterface(
       base::Bind(&ChromeRenderFrameObserver::OnImageContextMenuRendererRequest,
                  base::Unretained(this)));
+  render_frame->GetInterfaceRegistry()->AddInterface(
+      base::Bind(&ChromeRenderFrameObserver::OnThumbnailCapturerRequest,
+                 base::Unretained(this)));
 
   // Don't do anything else for subframes.
   if (!render_frame->IsMainFrame())
@@ -149,8 +152,6 @@
     // tab_android.cc's use is converted to Mojo.
     IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestReloadImageForContextNode,
                         RequestReloadImageForContextNode)
-    IPC_MESSAGE_HANDLER(ChromeViewMsg_RequestThumbnailForContextNode,
-                        OnRequestThumbnailForContextNode)
     IPC_MESSAGE_HANDLER(ChromeViewMsg_SetClientSidePhishingDetection,
                         OnSetClientSidePhishingDetection)
 #if BUILDFLAG(ENABLE_PRINTING)
@@ -189,19 +190,18 @@
   }
 }
 
-void ChromeRenderFrameObserver::OnRequestThumbnailForContextNode(
-    int thumbnail_min_area_pixels,
+void ChromeRenderFrameObserver::RequestThumbnailForContextNode(
+    int32_t thumbnail_min_area_pixels,
     const gfx::Size& thumbnail_max_size_pixels,
-    int callback_id) {
+    const RequestThumbnailForContextNodeCallback& callback) {
   WebNode context_node = render_frame()->GetWebFrame()->contextMenuNode();
   SkBitmap thumbnail;
   gfx::Size original_size;
   if (!context_node.isNull() && context_node.isElementNode()) {
     blink::WebImage image = context_node.to<WebElement>().imageContents();
     original_size = image.size();
-    thumbnail = Downscale(image,
-                          thumbnail_min_area_pixels,
-                          thumbnail_max_size_pixels);
+    thumbnail =
+        Downscale(image, thumbnail_min_area_pixels, thumbnail_max_size_pixels);
   }
 
   SkBitmap bitmap;
@@ -210,7 +210,7 @@
   else
     thumbnail.copyTo(&bitmap, kN32_SkColorType);
 
-  std::string thumbnail_data;
+  std::vector<uint8_t> thumbnail_data;
   SkAutoLockPixels lock(bitmap);
   if (bitmap.getPixels()) {
     const int kDefaultQuality = 90;
@@ -218,12 +218,12 @@
     if (gfx::JPEGCodec::Encode(
             reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)),
             gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(),
-            static_cast<int>(bitmap.rowBytes()), kDefaultQuality, &data))
-      thumbnail_data = std::string(data.begin(), data.end());
+            static_cast<int>(bitmap.rowBytes()), kDefaultQuality, &data)) {
+      thumbnail_data.swap(data);
+    }
   }
 
-  Send(new ChromeViewHostMsg_RequestThumbnailForContextNode_ACK(
-      routing_id(), thumbnail_data, original_size, callback_id));
+  callback.Run(thumbnail_data, original_size);
 }
 
 void ChromeRenderFrameObserver::OnPrintNodeUnderContextMenu() {
@@ -360,3 +360,8 @@
     chrome::mojom::ImageContextMenuRendererRequest request) {
   image_context_menu_renderer_bindings_.AddBinding(this, std::move(request));
 }
+
+void ChromeRenderFrameObserver::OnThumbnailCapturerRequest(
+    chrome::mojom::ThumbnailCapturerRequest request) {
+  thumbnail_capturer_bindings_.AddBinding(this, std::move(request));
+}
diff --git a/chrome/renderer/chrome_render_frame_observer.h b/chrome/renderer/chrome_render_frame_observer.h
index a02f5d4..d4c22b8c 100644
--- a/chrome/renderer/chrome_render_frame_observer.h
+++ b/chrome/renderer/chrome_render_frame_observer.h
@@ -9,6 +9,7 @@
 #include "base/timer/timer.h"
 #include "chrome/common/image_context_menu_renderer.mojom.h"
 #include "chrome/common/prerender_types.h"
+#include "chrome/common/thumbnail_capturer.mojom.h"
 #include "content/public/renderer/render_frame_observer.h"
 #include "mojo/public/cpp/bindings/binding_set.h"
 
@@ -28,7 +29,8 @@
 // lifetime.
 class ChromeRenderFrameObserver
     : public content::RenderFrameObserver,
-      public chrome::mojom::ImageContextMenuRenderer {
+      public chrome::mojom::ImageContextMenuRenderer,
+      public chrome::mojom::ThumbnailCapturer {
  public:
   explicit ChromeRenderFrameObserver(content::RenderFrame* render_frame);
   ~ChromeRenderFrameObserver() override;
@@ -48,9 +50,17 @@
   // chrome::mojom::ImageContextMenuRenderer:
   void RequestReloadImageForContextNode() override;
 
+  // chrome::mojom::ThumbnailCapturer:
+  void RequestThumbnailForContextNode(
+      int32_t thumbnail_min_area_pixels,
+      const gfx::Size& thumbnail_max_size_pixels,
+      const RequestThumbnailForContextNodeCallback& callback) override;
+
   // Mojo handlers.
   void OnImageContextMenuRendererRequest(
       chrome::mojom::ImageContextMenuRendererRequest request);
+  void OnThumbnailCapturerRequest(
+      chrome::mojom::ThumbnailCapturerRequest request);
 
   // IPC handlers
   void OnSetIsPrerendering(prerender::PrerenderMode mode);
@@ -78,6 +88,9 @@
   mojo::BindingSet<chrome::mojom::ImageContextMenuRenderer>
       image_context_menu_renderer_bindings_;
 
+  mojo::BindingSet<chrome::mojom::ThumbnailCapturer>
+      thumbnail_capturer_bindings_;
+
   DISALLOW_COPY_AND_ASSIGN(ChromeRenderFrameObserver);
 };
 
diff --git a/chrome/renderer/extensions/cast_streaming_native_handler.cc b/chrome/renderer/extensions/cast_streaming_native_handler.cc
index 38ab2ae..d076d88 100644
--- a/chrome/renderer/extensions/cast_streaming_native_handler.cc
+++ b/chrome/renderer/extensions/cast_streaming_native_handler.cc
@@ -988,14 +988,10 @@
   }
   if (!content::AddAudioTrackToMediaStream(
           audio, params.sample_rate(), params.channel_layout(),
-          params.frames_per_buffer(), true,  // is_remote
-          true,                              // is_readonly
-          &web_stream)) {
+          params.frames_per_buffer(), &web_stream)) {
     LOG(ERROR) << "Failed to add Cast audio track to media stream.";
   }
-  if (!content::AddVideoTrackToMediaStream(std::move(video), true,  // is_remote
-                                           true,  // is_readonly
-                                           &web_stream)) {
+  if (!content::AddVideoTrackToMediaStream(std::move(video), &web_stream)) {
     LOG(ERROR) << "Failed to add Cast video track to media stream.";
   }
 }
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index ac9ed174e..adef4c5 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -2133,6 +2133,7 @@
         "../browser/payments/site_per_process_payments_browsertest.cc",
         "../browser/ui/cocoa/extensions/extension_message_bubble_views_browsertest_mac.mm",
         "../browser/ui/global_error/global_error_service_browsertest.cc",
+        "../browser/ui/views/bookmarks/bookmark_editor_view_browsertest.cc",
         "../browser/ui/views/extensions/extension_message_bubble_view_browsertest.cc",
         "../browser/ui/views/external_protocol_dialog_browsertest.cc",
         "../browser/ui/views/frame/browser_non_client_frame_view_browsertest_win.cc",
diff --git a/chrome/test/data/webui/settings/basic_page_browsertest.js b/chrome/test/data/webui/settings/basic_page_browsertest.js
index 9a290f7..c0a186f 100644
--- a/chrome/test/data/webui/settings/basic_page_browsertest.js
+++ b/chrome/test/data/webui/settings/basic_page_browsertest.js
@@ -56,7 +56,8 @@
     /** @override */
     search: function(text, page) {
       if (this.searchRequest_ == null || !this.searchRequest_.isSame(text)) {
-        this.searchRequest_ = new settings.SearchRequest(text);
+        this.searchRequest_ = new settings.SearchRequest(
+            text, document.createElement('div'));
         this.searchRequest_.finished = true;
         this.searchRequest_.updateMatches(false);
 
diff --git a/chrome/test/data/webui/settings/search_settings_test.js b/chrome/test/data/webui/settings/search_settings_test.js
index 9653441..38f2f15 100644
--- a/chrome/test/data/webui/settings/search_settings_test.js
+++ b/chrome/test/data/webui/settings/search_settings_test.js
@@ -98,5 +98,36 @@
         assertEquals('Baz', options[2].textContent);
       });
     });
+
+    // Test that multiple requests for the same text correctly highlight their
+    // corresponding part of the tree without affecting other parts of the tree.
+    test('multiple simultaneous requests for the same text', function() {
+      document.body.innerHTML =
+          `<settings-section hidden-by-search>
+             <div><span>Hello there</span></div>
+           </settings-section>
+           <settings-section hidden-by-search>
+             <div><span>Hello over there</span></div>
+           </settings-section>
+           <settings-section hidden-by-search>
+             <div><span>Nothing</span></div>
+           </settings-section>`;
+
+      var sections = Array.prototype.slice.call(
+          document.querySelectorAll('settings-section'));
+
+      return Promise.all(
+        sections.map(function(section) {
+          return searchManager.search('there', section);
+        }),
+      ).then(function(requests) {
+        assertTrue(requests[0].didFindMatches());
+        assertFalse(sections[0].hiddenBySearch);
+        assertTrue(requests[1].didFindMatches());
+        assertFalse(sections[1].hiddenBySearch);
+        assertFalse(requests[2].didFindMatches());
+        assertTrue(sections[2].hiddenBySearch);
+      });
+    });
   });
 });
diff --git a/chromeos/dbus/fake_auth_policy_client_unittest.cc b/chromeos/dbus/fake_auth_policy_client_unittest.cc
index 4cd56086..e220238 100644
--- a/chromeos/dbus/fake_auth_policy_client_unittest.cc
+++ b/chromeos/dbus/fake_auth_policy_client_unittest.cc
@@ -90,10 +90,10 @@
         EXPECT_EQ(authpolicy::ERROR_DBUS_FAILURE, error);
       }));
   client.RefreshDevicePolicy(
-      base::Bind([](bool success) { EXPECT_EQ(false, success); }));
+      base::Bind([](bool success) { EXPECT_FALSE(success); }));
   client.RefreshUserPolicy(
       AccountId::FromUserEmail(kCorrectUserName),
-      base::Bind([](bool success) { EXPECT_EQ(false, success); }));
+      base::Bind([](bool success) { EXPECT_FALSE(success); }));
 }
 
 }  // namespace chromeos
diff --git a/components/previews/core/previews_experiments.cc b/components/previews/core/previews_experiments.cc
index 7b6d539..77b973a 100644
--- a/components/previews/core/previews_experiments.cc
+++ b/components/previews/core/previews_experiments.cc
@@ -189,19 +189,6 @@
   return effective_connection_type;
 }
 
-bool IsOfflinePreviewsEnabled() {
-  //  Check if "show_offline_pages" is set to "true".
-  return ClientSidePreviewsParamValue(kOfflinePagesSlowNetwork) ==
-         kExperimentEnabled;
-}
-
-int OfflinePreviewsVersion() {
-  int version;
-  if (!base::StringToInt(ClientSidePreviewsParamValue(kVersion), &version))
-    version = 0;
-  return version;
-}
-
 }  // namespace params
 
 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() {
@@ -213,6 +200,47 @@
       kEnabled, base::CompareCase::SENSITIVE);
 }
 
+bool IsPreviewsTypeEnabled(PreviewsType type) {
+  switch (type) {
+    case PreviewsType::OFFLINE:
+      return ClientSidePreviewsParamValue(kOfflinePagesSlowNetwork) ==
+             kExperimentEnabled;
+    default:
+      NOTREACHED();
+      return false;
+  }
+}
+
+int GetPreviewsTypeVersion(PreviewsType type) {
+  int version = 0;  // default
+  switch (type) {
+    case PreviewsType::OFFLINE:
+      base::StringToInt(ClientSidePreviewsParamValue(kVersion), &version);
+      return version;
+    // List remaining enum cases vs. default to catch when new one is added.
+    case PreviewsType::NONE:
+      break;
+    case PreviewsType::LAST:
+      break;
+  }
+  NOTREACHED();
+  return -1;
+}
+
+std::unique_ptr<PreviewsTypeList> GetEnabledPreviews() {
+  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList());
+
+  // Loop across all previews types (relies on sequential enum values).
+  for (int i = static_cast<int>(PreviewsType::NONE) + 1;
+       i < static_cast<int>(PreviewsType::LAST); ++i) {
+    PreviewsType type = static_cast<PreviewsType>(i);
+    if (IsPreviewsTypeEnabled(type)) {
+      enabled_previews->push_back({type, GetPreviewsTypeVersion(type)});
+    }
+  }
+  return enabled_previews;
+}
+
 bool EnableOfflinePreviewsForTesting() {
   std::map<std::string, std::string> params;
   params[kOfflinePagesSlowNetwork] = kExperimentEnabled;
diff --git a/components/previews/core/previews_experiments.h b/components/previews/core/previews_experiments.h
index a41f02fe..0a6f3a6 100644
--- a/components/previews/core/previews_experiments.h
+++ b/components/previews/core/previews_experiments.h
@@ -52,17 +52,10 @@
 // served.
 net::EffectiveConnectionType EffectiveConnectionTypeThreshold();
 
-// Whether offline previews are enabled.
-bool IsOfflinePreviewsEnabled();
-
-// The blacklist version for offline previews.
-int OfflinePreviewsVersion();
-
 }  // namespace params
 
 enum class PreviewsType {
   NONE = 0,
-  // The user is shown an offline page as a preview.
   OFFLINE = 1,
   // Insert new enum values here. Keep values sequential to allow looping
   // from NONE+1 to LAST-1.
@@ -74,6 +67,17 @@
 // Returns true if any client-side previews experiment is active.
 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial();
 
+// Returns true if the field trial that should enable previews for |type| for
+// prohibitvely slow networks is active.
+bool IsPreviewsTypeEnabled(PreviewsType type);
+
+// Returns the version of preview treatment |type|. Defaults to 0 if not
+// specified in field trial config.
+int GetPreviewsTypeVersion(PreviewsType type);
+
+// Returns the enabled PreviewsTypes with their version.
+std::unique_ptr<PreviewsTypeList> GetEnabledPreviews();
+
 // Sets the appropriate state for field trial and variations to imitate the
 // offline pages field trial.
 bool EnableOfflinePreviewsForTesting();
diff --git a/components/previews/core/previews_experiments_unittest.cc b/components/previews/core/previews_experiments_unittest.cc
index f96fb55..faf92cc 100644
--- a/components/previews/core/previews_experiments_unittest.cc
+++ b/components/previews/core/previews_experiments_unittest.cc
@@ -145,13 +145,13 @@
 // Verifies that we can enable offline previews via field trial.
 TEST_F(PreviewsExperimentsTest, TestFieldTrialOfflinePage) {
   EXPECT_FALSE(IsIncludedInClientSidePreviewsExperimentsFieldTrial());
-  EXPECT_FALSE(params::IsOfflinePreviewsEnabled());
+  EXPECT_FALSE(IsPreviewsTypeEnabled(PreviewsType::OFFLINE));
 
   base::FieldTrialList field_trial_list(nullptr);
   ASSERT_TRUE(EnableOfflinePreviewsForTesting());
 
   EXPECT_TRUE(IsIncludedInClientSidePreviewsExperimentsFieldTrial());
-  EXPECT_TRUE(params::IsOfflinePreviewsEnabled());
+  EXPECT_TRUE(IsPreviewsTypeEnabled(PreviewsType::OFFLINE));
   variations::testing::ClearAllVariationParams();
 }
 
diff --git a/components/previews/core/previews_io_data.cc b/components/previews/core/previews_io_data.cc
index 9645fa24..0a7af37 100644
--- a/components/previews/core/previews_io_data.cc
+++ b/components/previews/core/previews_io_data.cc
@@ -51,10 +51,8 @@
 
 void PreviewsIOData::Initialize(
     base::WeakPtr<PreviewsUIService> previews_ui_service,
-    std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store,
-    const PreviewsIsEnabledCallback& is_enabled_callback) {
+    std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store) {
   DCHECK(ui_task_runner_->BelongsToCurrentThread());
-  is_enabled_callback_ = is_enabled_callback;
   previews_ui_service_ = previews_ui_service;
 
   // Set up the IO thread portion of |this|.
@@ -90,16 +88,15 @@
 
 bool PreviewsIOData::ShouldAllowPreview(const net::URLRequest& request,
                                         PreviewsType type) const {
-  if (is_enabled_callback_.is_null() || !previews_black_list_) {
+  if (!IsPreviewsTypeEnabled(type))
+    return false;
+  // The blacklist will disallow certain hosts for periods of time based on
+  // user's opting out of the preview
+  if (!previews_black_list_) {
     LogPreviewsEligibilityReason(
         PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE, type);
     return false;
   }
-  if (!is_enabled_callback_.Run(type))
-    return false;
-
-  // The blacklist will disallow certain hosts for periods of time based on
-  // user's opting out of the preview
   PreviewsEligibilityReason status =
       previews_black_list_->IsLoadedAndAllowed(request.url(), type);
   if (status != PreviewsEligibilityReason::ALLOWED) {
diff --git a/components/previews/core/previews_io_data.h b/components/previews/core/previews_io_data.h
index f6e8533..a30ab6f 100644
--- a/components/previews/core/previews_io_data.h
+++ b/components/previews/core/previews_io_data.h
@@ -8,7 +8,6 @@
 #include <memory>
 #include <string>
 
-#include "base/callback.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
@@ -28,8 +27,6 @@
 class PreviewsOptOutStore;
 class PreviewsUIService;
 
-typedef base::Callback<bool(PreviewsType)> PreviewsIsEnabledCallback;
-
 // A class to manage the IO portion of inter-thread communication between
 // previews/ objects. Created on the UI thread, but used only on the IO thread
 // after initialization.
@@ -43,8 +40,7 @@
   // Stores |previews_ui_service| as |previews_ui_service_| and posts a task to
   // InitializeOnIOThread on the IO thread.
   void Initialize(base::WeakPtr<PreviewsUIService> previews_ui_service,
-                  std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store,
-                  const PreviewsIsEnabledCallback& is_enabled_callback);
+                  std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store);
 
   // Adds a navigation to |url| to the black list with result |opt_out|.
   void AddPreviewNavigation(const GURL& url, bool opt_out, PreviewsType type);
@@ -79,9 +75,6 @@
   scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
   scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
 
-  // Whether the preview is enabled. Valid after Initialize() is called.
-  PreviewsIsEnabledCallback is_enabled_callback_;
-
   base::WeakPtrFactory<PreviewsIOData> weak_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(PreviewsIOData);
diff --git a/components/previews/core/previews_io_data_unittest.cc b/components/previews/core/previews_io_data_unittest.cc
index 23b1bac..39a8925e 100644
--- a/components/previews/core/previews_io_data_unittest.cc
+++ b/components/previews/core/previews_io_data_unittest.cc
@@ -37,10 +37,6 @@
 
 namespace {
 
-bool CheckOfflineFieldTrial(PreviewsType type) {
-  return previews::params::IsOfflinePreviewsEnabled();
-}
-
 class TestPreviewsIOData : public PreviewsIOData {
  public:
   TestPreviewsIOData(
@@ -129,7 +125,7 @@
   set_io_data(base::MakeUnique<TestPreviewsIOData>(loop_.task_runner(),
                                                    loop_.task_runner()));
   set_ui_service(base::MakeUnique<PreviewsUIService>(
-      io_data(), loop_.task_runner(), nullptr, PreviewsIsEnabledCallback()));
+      io_data(), loop_.task_runner(), nullptr));
   base::RunLoop().RunUntilIdle();
   // After the outstanding posted tasks have run, |io_data_| should be fully
   // initialized.
@@ -148,38 +144,29 @@
                                                    loop_.task_runner()));
   base::HistogramTester histogram_tester;
 
+  // If not in the field trial, don't log anything, and return false.
+  EXPECT_FALSE(io_data()->ShouldAllowPreview(*request, PreviewsType::OFFLINE));
+  histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 0);
+
+  // Enable Offline previews field trial.
+  base::FieldTrialList field_trial_list(nullptr);
+  std::map<std::string, std::string> params;
+  params["show_offline_pages"] = "true";
+  variations::AssociateVariationParams("ClientSidePreviews", "Enabled", params);
+  base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled");
+
   // The blacklist is not created yet.
   EXPECT_FALSE(io_data()->ShouldAllowPreview(*request, PreviewsType::OFFLINE));
   histogram_tester.ExpectUniqueSample(
       "Previews.EligibilityReason.Offline",
       static_cast<int>(PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE), 1);
 
-  set_ui_service(base::MakeUnique<PreviewsUIService>(
-      io_data(), loop_.task_runner(),
-      base::MakeUnique<TestPreviewsOptOutStore>(),
-      base::Bind(&CheckOfflineFieldTrial)));
-
-  // The blacklist is not created yet.
-  EXPECT_FALSE(io_data()->ShouldAllowPreview(*request, PreviewsType::OFFLINE));
-  histogram_tester.ExpectBucketCount(
-      "Previews.EligibilityReason.Offline",
-      static_cast<int>(PreviewsEligibilityReason::BLACKLIST_UNAVAILABLE), 2);
+  set_ui_service(base::WrapUnique(
+      new PreviewsUIService(io_data(), loop_.task_runner(),
+                            base::MakeUnique<TestPreviewsOptOutStore>())));
 
   base::RunLoop().RunUntilIdle();
 
-  histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 2);
-  // If not in the field trial, don't log anything, and return false.
-  EXPECT_FALSE(io_data()->ShouldAllowPreview(*request, PreviewsType::OFFLINE));
-  histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 2);
-
-  // Enable Offline previews field trial.
-  base::FieldTrialList field_trial_list(nullptr);
-  std::map<std::string, std::string> params;
-  params["show_offline_pages"] = "true";
-
-  variations::AssociateVariationParams("ClientSidePreviews", "Enabled", params);
-  base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled");
-
   // Return one of the failing statuses from the blacklist; cause the blacklist
   // to not be loaded by clearing the blacklist.
   base::Time now = base::Time::Now();
@@ -240,7 +227,7 @@
       "Previews.EligibilityReason.Offline",
       static_cast<int>(PreviewsEligibilityReason::ALLOWED), 1);
 
-  histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 8);
+  histogram_tester.ExpectTotalCount("Previews.EligibilityReason.Offline", 7);
 
   variations::testing::ClearAllVariationParams();
 }
diff --git a/components/previews/core/previews_opt_out_store_sql.cc b/components/previews/core/previews_opt_out_store_sql.cc
index 835f645..b1e4f58 100644
--- a/components/previews/core/previews_opt_out_store_sql.cc
+++ b/components/previews/core/previews_opt_out_store_sql.cc
@@ -262,12 +262,12 @@
 // Checks the current set of enabled previews (with their current version)
 // and where a preview is now disabled or has a different version, cleans up
 // any associated blacklist entries.
-void CheckAndReconcileEnabledPreviewsWithDataBase(
-    sql::Connection* db,
-    PreviewsTypeList* enabled_previews) {
+void CheckAndReconcileEnabledPreviewsWithDataBase(sql::Connection* db) {
   std::unique_ptr<std::map<PreviewsType, int>> stored_previews(
       GetStoredPreviews(db));
 
+  std::unique_ptr<PreviewsTypeList> enabled_previews(GetEnabledPreviews());
+
   for (auto enabled_it = enabled_previews->begin();
        enabled_it != enabled_previews->end(); ++enabled_it) {
     PreviewsType type = enabled_it->first;
@@ -297,11 +297,10 @@
 
 void LoadBlackListFromDataBase(
     sql::Connection* db,
-    PreviewsTypeList* enabled_previews,
     scoped_refptr<base::SingleThreadTaskRunner> runner,
     LoadBlackListCallback callback) {
   // First handle any update needed wrt enabled previews and their versions.
-  CheckAndReconcileEnabledPreviewsWithDataBase(db, enabled_previews);
+  CheckAndReconcileEnabledPreviewsWithDataBase(db);
 
   // Gets the table sorted by host and time. Limits the number of hosts using
   // most recent opt_out time as the limiting function. Sorting is free due to
@@ -366,13 +365,12 @@
 // and actually do the work to access the SQL data base.
 void LoadBlackListSync(sql::Connection* db,
                        const base::FilePath& path,
-                       PreviewsTypeList* enabled_previews,
                        scoped_refptr<base::SingleThreadTaskRunner> runner,
                        LoadBlackListCallback callback) {
   if (!db->is_open())
     InitDatabase(db, path);
 
-  LoadBlackListFromDataBase(db, enabled_previews, runner, callback);
+  LoadBlackListFromDataBase(db, runner, callback);
 }
 
 // Deletes every row in the table that has entry time between |begin_time| and
@@ -407,14 +405,10 @@
 PreviewsOptOutStoreSQL::PreviewsOptOutStoreSQL(
     scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
     scoped_refptr<base::SequencedTaskRunner> background_task_runner,
-    const base::FilePath& path,
-    std::unique_ptr<PreviewsTypeList> enabled_previews)
+    const base::FilePath& path)
     : io_task_runner_(io_task_runner),
       background_task_runner_(background_task_runner),
-      db_file_path_(path),
-      enabled_previews_(std::move(enabled_previews)) {
-  DCHECK(enabled_previews_);
-}
+      db_file_path_(path) {}
 
 PreviewsOptOutStoreSQL::~PreviewsOptOutStoreSQL() {
   DCHECK(io_task_runner_->BelongsToCurrentThread());
@@ -449,7 +443,6 @@
     db_ = base::MakeUnique<sql::Connection>();
   background_task_runner_->PostTask(
       FROM_HERE, base::Bind(&LoadBlackListSync, db_.get(), db_file_path_,
-                            enabled_previews_.get(),
                             base::ThreadTaskRunnerHandle::Get(), callback));
 }
 
diff --git a/components/previews/core/previews_opt_out_store_sql.h b/components/previews/core/previews_opt_out_store_sql.h
index 0d3b6389..801b850 100644
--- a/components/previews/core/previews_opt_out_store_sql.h
+++ b/components/previews/core/previews_opt_out_store_sql.h
@@ -36,8 +36,7 @@
   PreviewsOptOutStoreSQL(
       scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
       scoped_refptr<base::SequencedTaskRunner> background_task_runner,
-      const base::FilePath& database_dir,
-      std::unique_ptr<PreviewsTypeList> enabled_previews);
+      const base::FilePath& database_dir);
   ~PreviewsOptOutStoreSQL() override;
 
   // PreviewsOptOutStore implementation:
@@ -61,9 +60,6 @@
   // SQL connection to the SQLite database.
   std::unique_ptr<sql::Connection> db_;
 
-  // All enabled previews and versions.
-  const std::unique_ptr<PreviewsTypeList> enabled_previews_;
-
   DISALLOW_COPY_AND_ASSIGN(PreviewsOptOutStoreSQL);
 };
 
diff --git a/components/previews/core/previews_opt_out_store_sql_unittest.cc b/components/previews/core/previews_opt_out_store_sql_unittest.cc
index 2057eed..9974885 100644
--- a/components/previews/core/previews_opt_out_store_sql_unittest.cc
+++ b/components/previews/core/previews_opt_out_store_sql_unittest.cc
@@ -64,17 +64,16 @@
   }
 
   // Creates a store that operates on one thread.
-  void Create(std::unique_ptr<PreviewsTypeList> enabled_previews) {
+  void Create() {
     store_ = base::MakeUnique<PreviewsOptOutStoreSQL>(
         base::ThreadTaskRunnerHandle::Get(),
         base::ThreadTaskRunnerHandle::Get(),
-        temp_dir_.GetPath().Append(kOptOutFilename),
-        std::move(enabled_previews));
+        temp_dir_.GetPath().Append(kOptOutFilename));
   }
 
   // Sets up initialization of |store_|.
-  void CreateAndLoad(std::unique_ptr<PreviewsTypeList> enabled_previews) {
-    Create(std::move(enabled_previews));
+  void CreateAndLoad() {
+    Create();
     Load();
   }
 
@@ -115,9 +114,7 @@
 TEST_F(PreviewsOptOutStoreSQLTest, TestErrorRecovery) {
   // Creates the database and corrupt to test the recovery method.
   std::string test_host = "host.com";
-  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   store_->AddPreviewNavigation(true, test_host, PreviewsType::OFFLINE,
                                base::Time::Now());
   base::RunLoop().RunUntilIdle();
@@ -128,9 +125,7 @@
       temp_dir_.GetPath().Append(kOptOutFilename)));
   base::RunLoop().RunUntilIdle();
 
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   // The data should be recovered.
   EXPECT_EQ(1U, black_list_map_->size());
   auto iter = black_list_map_->find(test_host);
@@ -142,9 +137,7 @@
 TEST_F(PreviewsOptOutStoreSQLTest, TestPersistance) {
   // Tests if data is stored as expected in the SQLite database.
   std::string test_host = "host.com";
-  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectUniqueSample("Previews.OptOut.DBRowCount", 0, 1);
   base::Time now = base::Time::Now();
   store_->AddPreviewNavigation(true, test_host, PreviewsType::OFFLINE, now);
@@ -155,9 +148,7 @@
   DestroyStore();
 
   // Reload and test for persistence
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   EXPECT_EQ(1U, black_list_map_->size());
   auto iter = black_list_map_->find(test_host);
 
@@ -181,9 +172,7 @@
   std::string row_limit_string = base::SizeTToString(row_limit);
   command_line->AppendSwitchASCII("previews-max-opt-out-rows",
                                   row_limit_string);
-  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectUniqueSample("Previews.OptOut.DBRowCount", 0, 1);
   base::SimpleTestClock clock;
 
@@ -205,9 +194,7 @@
   DestroyStore();
 
   // Reload and test for persistence
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectBucketCount("Previews.OptOut.DBRowCount",
                                       static_cast<int>(row_limit) + 1, 1);
   // The delete happens after the load, so it is possible to load more than
@@ -217,9 +204,7 @@
             host_indifferent_item_->OptOutRecordsSizeForTesting());
 
   DestroyStore();
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectBucketCount("Previews.OptOut.DBRowCount",
                                       static_cast<int>(row_limit), 1);
 
@@ -247,9 +232,7 @@
   std::string row_limit_string = base::SizeTToString(row_limit);
   command_line->AppendSwitchASCII("previews-max-opt-out-rows-per-host",
                                   row_limit_string);
-  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectUniqueSample("Previews.OptOut.DBRowCount", 0, 1);
   base::SimpleTestClock clock;
 
@@ -271,9 +254,7 @@
   DestroyStore();
 
   // Reload and test for persistence.
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectBucketCount("Previews.OptOut.DBRowCount",
                                       static_cast<int>(row_limit), 1);
 
@@ -296,10 +277,13 @@
   // Tests if data is cleared for previews type when it is disabled.
   // Enable offline previews and add black list entry for it.
   std::map<std::string, std::string> params;
+  params["show_offline_pages"] = "true";
+  EXPECT_TRUE(
+      base::AssociateFieldTrialParams("ClientSidePreviews", "Enabled", params));
+  EXPECT_TRUE(
+      base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled"));
   std::string test_host = "host.com";
-  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectUniqueSample("Previews.OptOut.DBRowCount", 0, 1);
   base::Time now = base::Time::Now();
   store_->AddPreviewNavigation(true, test_host, PreviewsType::OFFLINE, now);
@@ -308,29 +292,41 @@
   // Force data write to database then reload it and verify black list entry
   // is present.
   DestroyStore();
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 0});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   auto iter = black_list_map_->find(test_host);
   EXPECT_NE(black_list_map_->end(), iter);
   EXPECT_EQ(1U, iter->second->OptOutRecordsSizeForTesting());
 
+  // Now reload with offline pages previews disabled and verify black list
+  // entry dropped.
+  ResetFieldTrials();
+  params["show_offline_pages"] = "false";
+  EXPECT_TRUE(
+      base::AssociateFieldTrialParams("ClientSidePreviews", "Enabled", params));
+  EXPECT_TRUE(
+      base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled"));
   DestroyStore();
-  enabled_previews.reset(new PreviewsTypeList);
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   iter = black_list_map_->find(test_host);
   EXPECT_EQ(black_list_map_->end(), iter);
 
+  // Clean up field trials set in this test.
+  ResetFieldTrials();
 }
 
 TEST_F(PreviewsOptOutStoreSQLTest,
        TestPreviewsVersionUpdateClearsBlacklistEntry) {
   // Tests if data is cleared for new version of previews type.
   // Enable offline previews and add black list entry for it.
+  std::map<std::string, std::string> params;
+  params["show_offline_pages"] = "true";
+  params["version"] = "1";
+  EXPECT_TRUE(
+      base::AssociateFieldTrialParams("ClientSidePreviews", "Enabled", params));
+  EXPECT_TRUE(
+      base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled"));
   std::string test_host = "host.com";
-  std::unique_ptr<PreviewsTypeList> enabled_previews(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 1});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   histogram_tester_.ExpectUniqueSample("Previews.OptOut.DBRowCount", 0, 1);
   base::Time now = base::Time::Now();
   store_->AddPreviewNavigation(true, test_host, PreviewsType::OFFLINE, now);
@@ -339,19 +335,26 @@
   // Force data write to database then reload it and verify black list entry
   // is present.
   DestroyStore();
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 1});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   auto iter = black_list_map_->find(test_host);
   EXPECT_NE(black_list_map_->end(), iter);
   EXPECT_EQ(1U, iter->second->OptOutRecordsSizeForTesting());
 
+  // Now reload with incremented previews version and verify black list
+  // entry dropped.
+  ResetFieldTrials();
+  params["version"] = "2";
+  EXPECT_TRUE(
+      base::AssociateFieldTrialParams("ClientSidePreviews", "Enabled", params));
+  EXPECT_TRUE(
+      base::FieldTrialList::CreateFieldTrial("ClientSidePreviews", "Enabled"));
   DestroyStore();
-  enabled_previews.reset(new PreviewsTypeList);
-  enabled_previews->push_back({PreviewsType::OFFLINE, 2});
-  CreateAndLoad(std::move(enabled_previews));
+  CreateAndLoad();
   iter = black_list_map_->find(test_host);
   EXPECT_EQ(black_list_map_->end(), iter);
+
+  // Clean up field trials set in this test.
+  ResetFieldTrials();
 }
 
 }  // namespace net
diff --git a/components/previews/core/previews_ui_service.cc b/components/previews/core/previews_ui_service.cc
index 44cbb21..af146cc8 100644
--- a/components/previews/core/previews_ui_service.cc
+++ b/components/previews/core/previews_ui_service.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/single_thread_task_runner.h"
+#include "components/previews/core/previews_io_data.h"
 #include "url/gurl.h"
 
 namespace previews {
@@ -13,12 +14,10 @@
 PreviewsUIService::PreviewsUIService(
     PreviewsIOData* previews_io_data,
     const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
-    std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store,
-    const PreviewsIsEnabledCallback& is_enabled_callback)
+    std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store)
     : io_task_runner_(io_task_runner), weak_factory_(this) {
   previews_io_data->Initialize(weak_factory_.GetWeakPtr(),
-                               std::move(previews_opt_out_store),
-                               is_enabled_callback);
+                               std::move(previews_opt_out_store));
 }
 
 PreviewsUIService::~PreviewsUIService() {
diff --git a/components/previews/core/previews_ui_service.h b/components/previews/core/previews_ui_service.h
index 85dc8d1..12452bc 100644
--- a/components/previews/core/previews_ui_service.h
+++ b/components/previews/core/previews_ui_service.h
@@ -13,7 +13,6 @@
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
 #include "components/previews/core/previews_experiments.h"
-#include "components/previews/core/previews_io_data.h"
 #include "components/previews/core/previews_opt_out_store.h"
 
 class GURL;
@@ -32,8 +31,7 @@
   PreviewsUIService(
       PreviewsIOData* previews_io_data,
       const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
-      std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store,
-      const PreviewsIsEnabledCallback& is_enabled_callback);
+      std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store);
   virtual ~PreviewsUIService();
 
   // Sets |io_data_| to |io_data| to allow calls from the UI thread to the IO
diff --git a/components/previews/core/previews_ui_service_unittest.cc b/components/previews/core/previews_ui_service_unittest.cc
index 0398ffd..57a1bbd 100644
--- a/components/previews/core/previews_ui_service_unittest.cc
+++ b/components/previews/core/previews_ui_service_unittest.cc
@@ -26,8 +26,7 @@
       std::unique_ptr<PreviewsOptOutStore> previews_opt_out_store)
       : PreviewsUIService(previews_io_data,
                           io_task_runner,
-                          std::move(previews_opt_out_store),
-                          PreviewsIsEnabledCallback()),
+                          std::move(previews_opt_out_store)),
         io_data_set_(false) {}
   ~TestPreviewsUIService() override {}
 
diff --git a/content/browser/resources/accessibility/accessibility.js b/content/browser/resources/accessibility/accessibility.js
index 02c658d..9c2e389 100644
--- a/content/browser/resources/accessibility/accessibility.js
+++ b/content/browser/resources/accessibility/accessibility.js
@@ -7,11 +7,26 @@
 
   // Note: keep these values in sync with the values in
   // content/common/accessibility_mode_enums.h
-  const MODE_FLAG_NATIVE_APIS = 1 << 0;
-  const MODE_FLAG_WEB_CONTENTS = 1 << 1;
-  const MODE_FLAG_INLINE_TEXT_BOXES = 1 << 2;
-  const MODE_FLAG_SCREEN_READER = 1 << 3;
-  const MODE_FLAG_HTML = 1 << 4;
+  const AccessibilityMode = {
+    kOff: 0,
+    kNativeAPIs: 1 << 0,
+    kWebContents: 1 << 1,
+    kInlineTextBoxes: 1 << 2,
+    kScreenReader: 1 << 3,
+    kHTML: 1 << 4,
+
+    get kComplete() {
+      return AccessibilityMode.kNativeAPIs | AccessibilityMode.kWebContents |
+        AccessibilityMode.kInlineTextBoxes | AccessibilityMode.kScreenReader |
+        AccessibilityMode.kHTML;
+    },
+
+    get kWebContentsOnly() {
+      return AccessibilityMode.kWebContents |
+        AccessibilityMode.kInlineTextBoxes | AccessibilityMode.kScreenReader |
+        AccessibilityMode.kHTML;
+    }
+  };
 
   function requestData() {
     var xhr = new XMLHttpRequest();
@@ -96,11 +111,12 @@
       siteInfo.appendChild(formatValue(data, properties[j]));
     row.appendChild(siteInfo);
 
-    row.appendChild(createModeElement(MODE_FLAG_NATIVE_APIS, data))
-    row.appendChild(createModeElement(MODE_FLAG_WEB_CONTENTS, data))
-    row.appendChild(createModeElement(MODE_FLAG_INLINE_TEXT_BOXES, data))
-    row.appendChild(createModeElement(MODE_FLAG_SCREEN_READER, data))
-    row.appendChild(createModeElement(MODE_FLAG_HTML, data))
+    row.appendChild(createModeElement(AccessibilityMode.kNativeAPIs, data))
+    row.appendChild(createModeElement(AccessibilityMode.kWebContents, data))
+    row.appendChild(createModeElement(AccessibilityMode.kInlineTextBoxes,
+      data))
+    row.appendChild(createModeElement(AccessibilityMode.kScreenReader, data))
+    row.appendChild(createModeElement(AccessibilityMode.kHTML, data))
 
     row.appendChild(document.createTextNode(' | '));
 
@@ -139,15 +155,15 @@
 
   function getNameForAccessibilityMode(mode) {
     switch (mode) {
-      case MODE_FLAG_NATIVE_APIS:
+      case AccessibilityMode.kNativeAPIs:
         return "native"
-      case MODE_FLAG_WEB_CONTENTS:
+      case AccessibilityMode.kWebContents:
         return "web"
-      case MODE_FLAG_INLINE_TEXT_BOXES:
+      case AccessibilityMode.kInlineTextBoxes:
         return "inline text"
-      case MODE_FLAG_SCREEN_READER:
+      case AccessibilityMode.kScreenReader:
         return "screen reader"
-      case MODE_FLAG_HTML:
+      case AccessibilityMode.kHTML:
         return "html"
     }
     return "unknown"
diff --git a/content/browser/shared_worker/OWNERS b/content/browser/shared_worker/OWNERS
index 63d62763..595a385 100644
--- a/content/browser/shared_worker/OWNERS
+++ b/content/browser/shared_worker/OWNERS
@@ -1,2 +1,5 @@
-atwilson@chromium.org
 horo@chromium.org
+nhiroki@chromium.org
+
+# TEAM: worker-dev@chromium.org
+# COMPONENT: Blink>Workers
diff --git a/content/child/memory/child_memory_coordinator_impl.cc b/content/child/memory/child_memory_coordinator_impl.cc
index de9f8b8..6616a22 100644
--- a/content/child/memory/child_memory_coordinator_impl.cc
+++ b/content/child/memory/child_memory_coordinator_impl.cc
@@ -50,6 +50,7 @@
   DCHECK(!g_child_memory_coordinator);
   g_child_memory_coordinator = this;
   parent_->AddChild(binding_.CreateInterfacePtrAndBind());
+  base::MemoryCoordinatorProxy::SetMemoryCoordinator(this);
 }
 
 ChildMemoryCoordinatorImpl::~ChildMemoryCoordinatorImpl() {
@@ -58,6 +59,10 @@
   g_child_memory_coordinator = nullptr;
 }
 
+base::MemoryState ChildMemoryCoordinatorImpl::GetCurrentMemoryState() const {
+  return current_state_;
+}
+
 void ChildMemoryCoordinatorImpl::PurgeMemory() {
   TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory-infra"),
                "ChildMemoryCoordinatorImpl::PurgeMemory");
@@ -65,12 +70,11 @@
 }
 
 void ChildMemoryCoordinatorImpl::OnStateChange(mojom::MemoryState state) {
-  base::MemoryState base_state = ToBaseMemoryState(state);
+  current_state_ = ToBaseMemoryState(state);
   TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("memory-infra"),
                "ChildMemoryCoordinatorImpl::OnStateChange", "state",
-               MemoryStateToString(base_state));
-  base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(
-      base_state);
+               MemoryStateToString(current_state_));
+  base::MemoryCoordinatorClientRegistry::GetInstance()->Notify(current_state_);
 }
 
 #if !defined(OS_ANDROID)
diff --git a/content/child/memory/child_memory_coordinator_impl.h b/content/child/memory/child_memory_coordinator_impl.h
index 04b7576d..96da729 100644
--- a/content/child/memory/child_memory_coordinator_impl.h
+++ b/content/child/memory/child_memory_coordinator_impl.h
@@ -7,6 +7,7 @@
 
 #include "base/compiler_specific.h"
 #include "base/memory/memory_coordinator_client.h"
+#include "base/memory/memory_coordinator_proxy.h"
 #include "content/common/child_memory_coordinator.mojom.h"
 #include "content/common/content_export.h"
 #include "content/common/memory_coordinator.mojom.h"
@@ -26,7 +27,8 @@
 // It lives in child processes and is responsible for dispatching memory events
 // to its clients.
 class CONTENT_EXPORT ChildMemoryCoordinatorImpl
-    : NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) {
+    : base::MemoryCoordinator,
+      NON_EXPORTED_BASE(public mojom::ChildMemoryCoordinator) {
  public:
   // Returns the instance of ChildMemoryCoordinatorImpl. Could be nullptr.
   static ChildMemoryCoordinatorImpl* GetInstance();
@@ -35,6 +37,9 @@
                              ChildMemoryCoordinatorDelegate* delegate);
   ~ChildMemoryCoordinatorImpl() override;
 
+  // base::MemoryCoordinator implementations:
+  base::MemoryState GetCurrentMemoryState() const override;
+
   // mojom::ChildMemoryCoordinator implementations:
   void OnStateChange(mojom::MemoryState state) override;
   void PurgeMemory() override;
@@ -46,6 +51,7 @@
   friend class ChildMemoryCoordinatorImplTest;
 
   mojo::Binding<mojom::ChildMemoryCoordinator> binding_;
+  base::MemoryState current_state_ = base::MemoryState::NORMAL;
   mojom::MemoryCoordinatorHandlePtr parent_;
   ChildMemoryCoordinatorDelegate* delegate_;
 
diff --git a/content/child/memory/child_memory_coordinator_impl_unittest.cc b/content/child/memory/child_memory_coordinator_impl_unittest.cc
index fe20c0c..4a58965 100644
--- a/content/child/memory/child_memory_coordinator_impl_unittest.cc
+++ b/content/child/memory/child_memory_coordinator_impl_unittest.cc
@@ -138,18 +138,25 @@
 };
 
 TEST_F(ChildMemoryCoordinatorImplTest, SingleClient) {
+  auto* memory_coordinator_proxy = base::MemoryCoordinatorProxy::GetInstance();
   MockMemoryCoordinatorClient client;
   RegisterClient(&client);
 
   ChangeState(mojom::MemoryState::THROTTLED);
   EXPECT_EQ(base::MemoryState::THROTTLED, client.last_state());
+  EXPECT_EQ(base::MemoryState::THROTTLED,
+            memory_coordinator_proxy->GetCurrentMemoryState());
 
   ChangeState(mojom::MemoryState::NORMAL);
   EXPECT_EQ(base::MemoryState::NORMAL, client.last_state());
+  EXPECT_EQ(base::MemoryState::NORMAL,
+            memory_coordinator_proxy->GetCurrentMemoryState());
 
   UnregisterClient(&client);
   ChangeState(mojom::MemoryState::THROTTLED);
   EXPECT_TRUE(base::MemoryState::THROTTLED != client.last_state());
+  EXPECT_EQ(base::MemoryState::THROTTLED,
+            memory_coordinator_proxy->GetCurrentMemoryState());
 }
 
 TEST_F(ChildMemoryCoordinatorImplTest, MultipleClients) {
diff --git a/content/public/renderer/media_stream_utils.cc b/content/public/renderer/media_stream_utils.cc
index 65491e3..2076259 100644
--- a/content/public/renderer/media_stream_utils.cc
+++ b/content/public/renderer/media_stream_utils.cc
@@ -25,8 +25,6 @@
 
 bool AddVideoTrackToMediaStream(
     std::unique_ptr<media::VideoCapturerSource> video_source,
-    bool is_remote,
-    bool is_readonly,
     blink::WebMediaStream* web_media_stream) {
   DCHECK(video_source.get());
   if (!web_media_stream || web_media_stream->isNull()) {
@@ -40,9 +38,8 @@
           MediaStreamSource::SourceStoppedCallback(), std::move(video_source));
   const blink::WebString track_id =
       blink::WebString::fromUTF8(base::GenerateGUID());
-  web_media_stream_source.initialize(track_id,
-                                     blink::WebMediaStreamSource::TypeVideo,
-                                     track_id, is_remote);
+  web_media_stream_source.initialize(
+      track_id, blink::WebMediaStreamSource::TypeVideo, track_id);
   // Takes ownership of |media_stream_source|.
   web_media_stream_source.setExtraData(media_stream_source);
 
@@ -59,8 +56,6 @@
     int sample_rate,
     media::ChannelLayout channel_layout,
     int frames_per_buffer,
-    bool is_remote,
-    bool is_readonly,
     blink::WebMediaStream* web_media_stream) {
   DCHECK(audio_source.get());
   if (!web_media_stream || web_media_stream->isNull()) {
@@ -79,13 +74,11 @@
   blink::WebMediaStreamSource web_media_stream_source;
   const blink::WebString track_id =
       blink::WebString::fromUTF8(base::GenerateGUID());
-  web_media_stream_source.initialize(track_id,
-                                     blink::WebMediaStreamSource::TypeAudio,
-                                     track_id, is_remote);
+  web_media_stream_source.initialize(
+      track_id, blink::WebMediaStreamSource::TypeAudio, track_id);
   MediaStreamAudioSource* const media_stream_source =
       new ExternalMediaStreamAudioSource(std::move(audio_source), sample_rate,
-                                         channel_layout, frames_per_buffer,
-                                         is_remote);
+                                         channel_layout, frames_per_buffer);
   // Takes ownership of |media_stream_source|.
   web_media_stream_source.setExtraData(media_stream_source);
 
diff --git a/content/public/renderer/media_stream_utils.h b/content/public/renderer/media_stream_utils.h
index c1e0937..57ab395 100644
--- a/content/public/renderer/media_stream_utils.h
+++ b/content/public/renderer/media_stream_utils.h
@@ -27,13 +27,8 @@
 // provided audio or video capturer source. A new WebMediaStreamTrack +
 // MediaStreamTrack pair is created, connected to the source and is plugged into
 // the WebMediaStream (|web_media_stream|).
-// |is_remote| should be true if the source of the data is not a local device.
-// |is_readonly| should be true if the format of the data cannot be changed by
-//     MediaTrackConstraints.
 CONTENT_EXPORT bool AddVideoTrackToMediaStream(
     std::unique_ptr<media::VideoCapturerSource> video_source,
-    bool is_remote,
-    bool is_readonly,
     blink::WebMediaStream* web_media_stream);
 
 // |sample_rate|, |channel_layout|, and |frames_per_buffer| specify the audio
@@ -45,8 +40,6 @@
     int sample_rate,
     media::ChannelLayout channel_layout,
     int frames_per_buffer,
-    bool is_remote,
-    bool is_readonly,
     blink::WebMediaStream* web_media_stream);
 
 // On success returns pointer to the current format of the given video track;
diff --git a/content/renderer/media/external_media_stream_audio_source.cc b/content/renderer/media/external_media_stream_audio_source.cc
index 7c2977c..1d4d49f 100644
--- a/content/renderer/media/external_media_stream_audio_source.cc
+++ b/content/renderer/media/external_media_stream_audio_source.cc
@@ -10,9 +10,9 @@
     scoped_refptr<media::AudioCapturerSource> source,
     int sample_rate,
     media::ChannelLayout channel_layout,
-    int frames_per_buffer,
-    bool is_remote)
-    : MediaStreamAudioSource(!is_remote), source_(std::move(source)),
+    int frames_per_buffer)
+    : MediaStreamAudioSource(false),
+      source_(std::move(source)),
       was_started_(false) {
   DVLOG(1)
       << "ExternalMediaStreamAudioSource::ExternalMediaStreamAudioSource()";
diff --git a/content/renderer/media/external_media_stream_audio_source.h b/content/renderer/media/external_media_stream_audio_source.h
index f520ae09..adefe6f 100644
--- a/content/renderer/media/external_media_stream_audio_source.h
+++ b/content/renderer/media/external_media_stream_audio_source.h
@@ -24,8 +24,7 @@
       scoped_refptr<media::AudioCapturerSource> source,
       int sample_rate,
       media::ChannelLayout channel_layout,
-      int frames_per_buffer,
-      bool is_remote);
+      int frames_per_buffer);
 
   ~ExternalMediaStreamAudioSource() final;
 
diff --git a/content/renderer/media/media_stream_audio_source.h b/content/renderer/media/media_stream_audio_source.h
index 392dac04..2d029c9 100644
--- a/content/renderer/media/media_stream_audio_source.h
+++ b/content/renderer/media/media_stream_audio_source.h
@@ -143,6 +143,8 @@
 
   // True if the source of audio is a local device. False if the source is
   // remote (e.g., streamed-in from a server).
+  // TODO(crbug.com/598704): This variable is not likely to be used anymore.
+  // The remote option was erased by crbug.com/598704.
   const bool is_local_source_;
 
   // Set to true once this source has been permanently stopped.
diff --git a/content/renderer/media/media_stream_audio_unittest.cc b/content/renderer/media/media_stream_audio_unittest.cc
index 7026025e..c138e11e 100644
--- a/content/renderer/media/media_stream_audio_unittest.cc
+++ b/content/renderer/media/media_stream_audio_unittest.cc
@@ -243,8 +243,7 @@
   void SetUp() override {
     blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_id"),
                                    blink::WebMediaStreamSource::TypeAudio,
-                                   blink::WebString::fromUTF8("audio_track"),
-                                   false /* remote */);
+                                   blink::WebString::fromUTF8("audio_track"));
     blink_audio_track_.initialize(blink_audio_source_.id(),
                                   blink_audio_source_);
   }
diff --git a/content/renderer/media/media_stream_video_capturer_source_unittest.cc b/content/renderer/media/media_stream_video_capturer_source_unittest.cc
index 8912961..2d57bd7 100644
--- a/content/renderer/media/media_stream_video_capturer_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_capturer_source_unittest.cc
@@ -85,8 +85,7 @@
 
     webkit_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                               blink::WebMediaStreamSource::TypeVideo,
-                              blink::WebString::fromASCII("dummy_source_name"),
-                              false /* remote */);
+                              blink::WebString::fromASCII("dummy_source_name"));
     webkit_source_.setExtraData(source_);
     webkit_source_id_ = webkit_source_.id();
   }
@@ -300,8 +299,7 @@
       std::move(delegate));
   webkit_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                             blink::WebMediaStreamSource::TypeVideo,
-                            blink::WebString::fromASCII("dummy_source_name"),
-                            false /* remote */);
+                            blink::WebString::fromASCII("dummy_source_name"));
   webkit_source_.setExtraData(source_);
   webkit_source_id_ = webkit_source_.id();
 
diff --git a/content/renderer/media/media_stream_video_renderer_sink_unittest.cc b/content/renderer/media/media_stream_video_renderer_sink_unittest.cc
index b4343c1c..52fa677b 100644
--- a/content/renderer/media/media_stream_video_renderer_sink_unittest.cc
+++ b/content/renderer/media/media_stream_video_renderer_sink_unittest.cc
@@ -38,8 +38,7 @@
         mock_source_(new MockMediaStreamVideoSource(false)) {
     blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                              blink::WebMediaStreamSource::TypeVideo,
-                             blink::WebString::fromASCII("dummy_source_name"),
-                             false /* remote */);
+                             blink::WebString::fromASCII("dummy_source_name"));
     blink_source_.setExtraData(mock_source_);
     blink::WebMediaConstraints constraints;
     constraints.initialize();
diff --git a/content/renderer/media/media_stream_video_source_unittest.cc b/content/renderer/media/media_stream_video_source_unittest.cc
index 9f21b460..49bbc08b 100644
--- a/content/renderer/media/media_stream_video_source_unittest.cc
+++ b/content/renderer/media/media_stream_video_source_unittest.cc
@@ -52,8 +52,7 @@
     mock_source_->SetSupportedFormats(formats);
     webkit_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                               blink::WebMediaStreamSource::TypeVideo,
-                              blink::WebString::fromASCII("dummy_source_name"),
-                              false /* remote */);
+                              blink::WebString::fromASCII("dummy_source_name"));
     webkit_source_.setExtraData(mock_source_);
   }
 
diff --git a/content/renderer/media/media_stream_video_track_unittest.cc b/content/renderer/media/media_stream_video_track_unittest.cc
index f071e08..a36b256 100644
--- a/content/renderer/media/media_stream_video_track_unittest.cc
+++ b/content/renderer/media/media_stream_video_track_unittest.cc
@@ -36,8 +36,7 @@
         source_started_(false) {
     blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                              blink::WebMediaStreamSource::TypeVideo,
-                             blink::WebString::fromASCII("dummy_source_name"),
-                             false /* remote */);
+                             blink::WebString::fromASCII("dummy_source_name"));
     blink_source_.setExtraData(mock_source_);
   }
 
@@ -87,8 +86,7 @@
     mock_source_ = new MockMediaStreamVideoSource(false, true);
     blink_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                              blink::WebMediaStreamSource::TypeVideo,
-                             blink::WebString::fromASCII("dummy_source_name"),
-                             false /* remote */);
+                             blink::WebString::fromASCII("dummy_source_name"));
     blink_source_.setExtraData(mock_source_);
   }
 
diff --git a/content/renderer/media/mock_media_stream_registry.cc b/content/renderer/media/mock_media_stream_registry.cc
index 96e6671..4ad5342 100644
--- a/content/renderer/media/mock_media_stream_registry.cc
+++ b/content/renderer/media/mock_media_stream_registry.cc
@@ -61,8 +61,7 @@
   blink::WebMediaStreamSource blink_source;
   blink_source.initialize("mock video source id",
                           blink::WebMediaStreamSource::TypeVideo,
-                          "mock video source name",
-                          false /* remote */);
+                          "mock video source name");
   MockMediaStreamVideoSource* native_source =
       new MockMediaStreamVideoSource(false /* manual get supported formats */);
   blink_source.setExtraData(native_source);
@@ -84,9 +83,9 @@
 
 void MockMediaStreamRegistry::AddAudioTrack(const std::string& track_id) {
   blink::WebMediaStreamSource blink_source;
-  blink_source.initialize(
-      "mock audio source id", blink::WebMediaStreamSource::TypeAudio,
-      "mock audio source name", false /* remote */);
+  blink_source.initialize("mock audio source id",
+                          blink::WebMediaStreamSource::TypeAudio,
+                          "mock audio source name");
   MediaStreamAudioSource* const source = new MockCDQualityAudioSource();
   blink_source.setExtraData(source);  // Takes ownership.
 
diff --git a/content/renderer/media/pepper_to_video_track_adapter.cc b/content/renderer/media/pepper_to_video_track_adapter.cc
index 5282026a..3e003c0 100644
--- a/content/renderer/media/pepper_to_video_track_adapter.cc
+++ b/content/renderer/media/pepper_to_video_track_adapter.cc
@@ -258,8 +258,7 @@
   blink::WebMediaStreamSource::Type type =
       blink::WebMediaStreamSource::TypeVideo;
   blink::WebString webkit_track_id = blink::WebString::fromUTF8(track_id);
-  webkit_source.initialize(webkit_track_id, type, webkit_track_id,
-                           false /* remote */);
+  webkit_source.initialize(webkit_track_id, type, webkit_track_id);
   webkit_source.setExtraData(writer);
 
   blink::WebMediaConstraints constraints;
diff --git a/content/renderer/media/remote_media_stream_impl.cc b/content/renderer/media/remote_media_stream_impl.cc
index b56c2ab..70ff0b2 100644
--- a/content/renderer/media/remote_media_stream_impl.cc
+++ b/content/renderer/media/remote_media_stream_impl.cc
@@ -102,8 +102,7 @@
 
     blink::WebString webkit_track_id(blink::WebString::fromUTF8(id_));
     blink::WebMediaStreamSource webkit_source;
-    webkit_source.initialize(webkit_track_id, type, webkit_track_id,
-                             true /* remote */);
+    webkit_source.initialize(webkit_track_id, type, webkit_track_id);
     webkit_track_.initialize(webkit_track_id, webkit_source);
     DCHECK(!webkit_track_.isNull());
   }
diff --git a/content/renderer/media/rtc_peer_connection_handler_unittest.cc b/content/renderer/media/rtc_peer_connection_handler_unittest.cc
index 7d44b983..f4c9c55 100644
--- a/content/renderer/media/rtc_peer_connection_handler_unittest.cc
+++ b/content/renderer/media/rtc_peer_connection_handler_unittest.cc
@@ -292,8 +292,7 @@
     blink::WebMediaStreamSource blink_audio_source;
     blink_audio_source.initialize(blink::WebString::fromUTF8(audio_track_label),
                                   blink::WebMediaStreamSource::TypeAudio,
-                                  blink::WebString::fromUTF8("audio_track"),
-                                  false /* remote */);
+                                  blink::WebString::fromUTF8("audio_track"));
     ProcessedLocalAudioSource* const audio_source =
         new ProcessedLocalAudioSource(
             -1 /* consumer_render_frame_id is N/A for non-browser tests */,
@@ -311,8 +310,7 @@
     blink::WebMediaStreamSource video_source;
     video_source.initialize(blink::WebString::fromUTF8(video_track_label),
                             blink::WebMediaStreamSource::TypeVideo,
-                            blink::WebString::fromUTF8("video_track"),
-                            false /* remote */);
+                            blink::WebString::fromUTF8("video_track"));
     MockMediaStreamVideoSource* native_video_source =
         new MockMediaStreamVideoSource(false);
     video_source.setExtraData(native_video_source);
diff --git a/content/renderer/media/speech_recognition_audio_sink_unittest.cc b/content/renderer/media/speech_recognition_audio_sink_unittest.cc
index e121e8ef..59fb114 100644
--- a/content/renderer/media/speech_recognition_audio_sink_unittest.cc
+++ b/content/renderer/media/speech_recognition_audio_sink_unittest.cc
@@ -291,8 +291,7 @@
     blink::WebMediaStreamSource blink_source;
     blink_source.initialize(blink::WebString::fromUTF8("dummy_source_id"),
                             blink::WebMediaStreamSource::TypeAudio,
-                            blink::WebString::fromUTF8("dummy_source_name"),
-                            false /* remote */);
+                            blink::WebString::fromUTF8("dummy_source_name"));
     TestDrivenAudioSource* const audio_source = new TestDrivenAudioSource();
     audio_source->SetDeviceInfo(
         StreamDeviceInfo(device_type, "Mock device", "mock_device_id"));
diff --git a/content/renderer/media/user_media_client_impl.cc b/content/renderer/media/user_media_client_impl.cc
index 439e0af..1ae142d1 100644
--- a/content/renderer/media/user_media_client_impl.cc
+++ b/content/renderer/media/user_media_client_impl.cc
@@ -995,8 +995,7 @@
 
   blink::WebMediaStreamSource source;
   source.initialize(blink::WebString::fromUTF8(device.device.id), type,
-                    blink::WebString::fromUTF8(device.device.name),
-                    false /* remote */);
+                    blink::WebString::fromUTF8(device.device.name));
 
   DVLOG(1) << "Initialize source object :"
            << "id = " << source.id().utf8()
diff --git a/content/renderer/media/webmediaplayer_ms_compositor.cc b/content/renderer/media/webmediaplayer_ms_compositor.cc
index 5387a2b2..35d39d1 100644
--- a/content/renderer/media/webmediaplayer_ms_compositor.cc
+++ b/content/renderer/media/webmediaplayer_ms_compositor.cc
@@ -143,10 +143,7 @@
   if (!web_stream.isNull())
     web_stream.videoTracks(video_tracks);
 
-  const bool remote_video =
-      video_tracks.size() && video_tracks[0].source().remote();
-
-  if (remote_video &&
+  if (video_tracks.size() > 0 &&
       !base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kDisableRTCSmoothnessAlgorithm)) {
     base::AutoLock auto_lock(current_frame_lock_);
@@ -158,8 +155,7 @@
   // Just for logging purpose.
   std::string stream_id =
       web_stream.isNull() ? std::string() : web_stream.id().utf8();
-  const uint32_t hash_value = base::Hash(stream_id);
-  serial_ = (hash_value << 1) | (remote_video ? 1 : 0);
+  serial_ = base::Hash(stream_id);;
 }
 
 WebMediaPlayerMSCompositor::~WebMediaPlayerMSCompositor() {
diff --git a/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc b/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc
index 6752973..c30e7a0 100644
--- a/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc
+++ b/content/renderer/media/webrtc/media_stream_remote_video_source_unittest.cc
@@ -49,8 +49,7 @@
         number_of_failed_constraints_applied_(0) {
     webkit_source_.initialize(blink::WebString::fromASCII("dummy_source_id"),
                               blink::WebMediaStreamSource::TypeVideo,
-                              blink::WebString::fromASCII("dummy_source_name"),
-                              true /* remote */);
+                              blink::WebString::fromASCII("dummy_source_name"));
     webkit_source_.setExtraData(remote_source_);
   }
 
diff --git a/content/renderer/media/webrtc/processed_local_audio_source_unittest.cc b/content/renderer/media/webrtc/processed_local_audio_source_unittest.cc
index 390aeafa..be5f470c 100644
--- a/content/renderer/media/webrtc/processed_local_audio_source_unittest.cc
+++ b/content/renderer/media/webrtc/processed_local_audio_source_unittest.cc
@@ -83,8 +83,7 @@
   void SetUp() override {
     blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_label"),
                                    blink::WebMediaStreamSource::TypeAudio,
-                                   blink::WebString::fromUTF8("audio_track"),
-                                   false /* remote */);
+                                   blink::WebString::fromUTF8("audio_track"));
     blink_audio_track_.initialize(blink_audio_source_.id(),
                                   blink_audio_source_);
   }
diff --git a/content/renderer/media/webrtc/webrtc_media_stream_adapter_unittest.cc b/content/renderer/media/webrtc/webrtc_media_stream_adapter_unittest.cc
index d1d4b356..04cf203f 100644
--- a/content/renderer/media/webrtc/webrtc_media_stream_adapter_unittest.cc
+++ b/content/renderer/media/webrtc/webrtc_media_stream_adapter_unittest.cc
@@ -47,10 +47,8 @@
         audio ? static_cast<size_t>(1) : 0);
     if (audio) {
       blink::WebMediaStreamSource audio_source;
-      audio_source.initialize("audio",
-                              blink::WebMediaStreamSource::TypeAudio,
-                              "audio",
-                              false /* remote */);
+      audio_source.initialize("audio", blink::WebMediaStreamSource::TypeAudio,
+                              "audio");
       ProcessedLocalAudioSource* const source = new ProcessedLocalAudioSource(
           -1 /* consumer_render_frame_id is N/A for non-browser tests */,
           StreamDeviceInfo(MEDIA_DEVICE_AUDIO_CAPTURE, "Mock audio device",
@@ -78,10 +76,8 @@
     MediaStreamSource::SourceStoppedCallback dummy_callback;
     if (video) {
       blink::WebMediaStreamSource video_source;
-      video_source.initialize("video",
-                              blink::WebMediaStreamSource::TypeVideo,
-                              "video",
-                              false /* remote */);
+      video_source.initialize("video", blink::WebMediaStreamSource::TypeVideo,
+                              "video");
       MediaStreamVideoSource* native_source =
           new MockMediaStreamVideoSource(false);
       video_source.setExtraData(native_source);
@@ -143,9 +139,7 @@
   // Create a blink MediaStream description.
   blink::WebMediaStreamSource audio_source;
   audio_source.initialize("audio source",
-                          blink::WebMediaStreamSource::TypeAudio,
-                          "something",
-                          false /* remote */);
+                          blink::WebMediaStreamSource::TypeAudio, "something");
 
   blink::WebVector<blink::WebMediaStreamTrack> audio_tracks(
       static_cast<size_t>(1));
diff --git a/content/renderer/media/webrtc_local_audio_source_provider_unittest.cc b/content/renderer/media/webrtc_local_audio_source_provider_unittest.cc
index b4013097..78f09046 100644
--- a/content/renderer/media/webrtc_local_audio_source_provider_unittest.cc
+++ b/content/renderer/media/webrtc_local_audio_source_provider_unittest.cc
@@ -29,8 +29,7 @@
     blink::WebMediaStreamSource audio_source;
     audio_source.initialize(blink::WebString::fromUTF8("dummy_source_id"),
                             blink::WebMediaStreamSource::TypeAudio,
-                            blink::WebString::fromUTF8("dummy_source_name"),
-                            false /* remote */);
+                            blink::WebString::fromUTF8("dummy_source_name"));
     blink_track_.initialize(blink::WebString::fromUTF8("audio_track"),
                             audio_source);
     blink_track_.setTrackData(new MediaStreamAudioTrack(true));
diff --git a/content/renderer/media_capture_from_element/canvas_capture_handler.cc b/content/renderer/media_capture_from_element/canvas_capture_handler.cc
index 92737980..d9318f6 100644
--- a/content/renderer/media_capture_from_element/canvas_capture_handler.cc
+++ b/content/renderer/media_capture_from_element/canvas_capture_handler.cc
@@ -267,7 +267,7 @@
       new MediaStreamVideoCapturerSource(
           MediaStreamSource::SourceStoppedCallback(), std::move(source)));
   webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo,
-                           track_id, false);
+                           track_id);
   webkit_source.setExtraData(media_stream_source.get());
 
   web_track->initialize(webkit_source);
diff --git a/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc b/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc
index ce3a94d8a5..8133a09 100644
--- a/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc
+++ b/content/renderer/media_capture_from_element/html_audio_element_capturer_source_unittest.cc
@@ -80,8 +80,7 @@
 
     blink_audio_source_.initialize(blink::WebString::fromUTF8("audio_id"),
                                    blink::WebMediaStreamSource::TypeAudio,
-                                   blink::WebString::fromUTF8("audio_track"),
-                                   false /* remote */);
+                                   blink::WebString::fromUTF8("audio_track"));
     blink_audio_track_.initialize(blink_audio_source_.id(),
                                   blink_audio_source_);
 
diff --git a/content/renderer/media_recorder/audio_track_recorder_unittest.cc b/content/renderer/media_recorder/audio_track_recorder_unittest.cc
index 6929364c..5502c66 100644
--- a/content/renderer/media_recorder/audio_track_recorder_unittest.cc
+++ b/content/renderer/media_recorder/audio_track_recorder_unittest.cc
@@ -217,8 +217,7 @@
     blink::WebMediaStreamSource audio_source;
     audio_source.initialize(blink::WebString::fromUTF8("dummy_source_id"),
                             blink::WebMediaStreamSource::TypeAudio,
-                            blink::WebString::fromUTF8("dummy_source_name"),
-                            false /* remote */);
+                            blink::WebString::fromUTF8("dummy_source_name"));
     audio_source.setExtraData(new MediaStreamAudioSource(true));
     blink_track_.initialize(blink::WebString::fromUTF8("audio_track"),
                             audio_source);
diff --git a/content/renderer/pepper/pepper_media_stream_video_track_host.cc b/content/renderer/pepper/pepper_media_stream_video_track_host.cc
index bbded169a..7b4e70e 100644
--- a/content/renderer/pepper/pepper_media_stream_video_track_host.cc
+++ b/content/renderer/pepper/pepper_media_stream_video_track_host.cc
@@ -515,8 +515,7 @@
   blink::WebMediaStreamSource webkit_source;
   webkit_source.initialize(blink::WebString::fromASCII(source_id),
                            blink::WebMediaStreamSource::TypeVideo,
-                           blink::WebString::fromASCII(kPepperVideoSourceName),
-                           false /* remote */);
+                           blink::WebString::fromASCII(kPepperVideoSourceName));
   MediaStreamVideoSource* const source =
       new VideoSource(weak_factory_.GetWeakPtr());
   webkit_source.setExtraData(source);  // Takes ownership of |source|.
diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc
index d176e98..dd9733c 100644
--- a/content/renderer/renderer_blink_platform_impl.cc
+++ b/content/renderer/renderer_blink_platform_impl.cc
@@ -858,8 +858,6 @@
   AddVideoTrackToMediaStream(
       HtmlVideoElementCapturerSource::CreateFromWebMediaPlayerImpl(
           web_media_player, content::RenderThread::Get()->GetIOTaskRunner()),
-      false,  // is_remote
-      false,  // is_readonly
       web_media_stream);
 #endif
 }
@@ -875,10 +873,8 @@
   blink::WebMediaStreamTrack web_media_stream_track;
   const WebString track_id = WebString::fromUTF8(base::GenerateGUID());
 
-  web_media_stream_source.initialize(track_id,
-                                     blink::WebMediaStreamSource::TypeAudio,
-                                     track_id,
-                                     false /* is_remote */);
+  web_media_stream_source.initialize(
+      track_id, blink::WebMediaStreamSource::TypeAudio, track_id);
   web_media_stream_track.initialize(web_media_stream_source);
 
   MediaStreamAudioSource* const media_stream_source =
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index e6e77c5..dfc51357 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -55,7 +55,7 @@
 #endif
 
 #if BUILDFLAG(ENABLE_WEBRTC)
-#include "third_party/webrtc_overrides/init_webrtc.h"
+#include "third_party/webrtc_overrides/init_webrtc.h"  // nogncheck
 #endif
 
 #if defined(USE_OZONE)
diff --git a/content/renderer/shared_worker/OWNERS b/content/renderer/shared_worker/OWNERS
index 63d62763..595a385 100644
--- a/content/renderer/shared_worker/OWNERS
+++ b/content/renderer/shared_worker/OWNERS
@@ -1,2 +1,5 @@
-atwilson@chromium.org
 horo@chromium.org
+nhiroki@chromium.org
+
+# TEAM: worker-dev@chromium.org
+# COMPONENT: Blink>Workers
diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc
index 638313e..8e04816 100644
--- a/content/shell/renderer/layout_test/blink_test_runner.cc
+++ b/content/shell/renderer/layout_test/blink_test_runner.cc
@@ -761,8 +761,6 @@
   DCHECK(stream);
 #if BUILDFLAG(ENABLE_WEBRTC)
   return AddVideoTrackToMediaStream(base::MakeUnique<MockVideoCapturerSource>(),
-                                    false,  // is_remote
-                                    false,  // is_readonly
                                     stream);
 #else
   return false;
@@ -778,8 +776,6 @@
       48000,  // sample rate
       media::CHANNEL_LAYOUT_STEREO,
       480,  // sample frames per buffer
-      false,  // is_remote
-      false,  // is_readonly
       stream);
 #else
   return false;
diff --git a/content/shell/test_runner/mock_web_user_media_client.cc b/content/shell/test_runner/mock_web_user_media_client.cc
index 19e514f..5ac567e0 100644
--- a/content/shell/test_runner/mock_web_user_media_client.cc
+++ b/content/shell/test_runner/mock_web_user_media_client.cc
@@ -63,7 +63,7 @@
       !delegate_->AddMediaStreamAudioSourceAndTrack(&stream)) {
     WebMediaStreamSource source;
     source.initialize("MockAudioDevice#1", WebMediaStreamSource::TypeAudio,
-                      "Mock audio device", false /* remote */);
+                      "Mock audio device");
     WebMediaStreamTrack web_track;
     web_track.initialize(source);
     stream.addTrack(web_track);
@@ -73,7 +73,7 @@
       !delegate_->AddMediaStreamVideoSourceAndTrack(&stream)) {
     WebMediaStreamSource source;
     source.initialize("MockVideoDevice#1", WebMediaStreamSource::TypeVideo,
-                      "Mock video device", false /* remote */);
+                      "Mock video device");
     WebMediaStreamTrack web_track;
     web_track.initialize(source);
     stream.addTrack(web_track);
diff --git a/content/shell/test_runner/mock_webrtc_peer_connection_handler.cc b/content/shell/test_runner/mock_webrtc_peer_connection_handler.cc
index c2f4f10..078ceaf4 100644
--- a/content/shell/test_runner/mock_webrtc_peer_connection_handler.cc
+++ b/content/shell/test_runner/mock_webrtc_peer_connection_handler.cc
@@ -405,7 +405,7 @@
       blink::WebMediaStreamSource webkit_source;
       webkit_source.initialize(local_audio_tracks[i].id(),
                                blink::WebMediaStreamSource::TypeAudio,
-                               local_audio_tracks[i].id(), true /* remote */);
+                               local_audio_tracks[i].id());
       remote_audio_tracks[i].initialize(webkit_source);
     }
 
@@ -417,7 +417,7 @@
       blink::WebMediaStreamSource webkit_source;
       webkit_source.initialize(local_video_tracks[i].id(),
                                blink::WebMediaStreamSource::TypeVideo,
-                               local_video_tracks[i].id(), true /* remote */);
+                               local_video_tracks[i].id());
       remote_video_tracks[i].initialize(webkit_source);
     }
 
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index f670845..8f4d89f 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -64,7 +64,7 @@
 #endif
 
 #if BUILDFLAG(ENABLE_WEBRTC)
-#include "third_party/webrtc_overrides/init_webrtc.h"
+#include "third_party/webrtc_overrides/init_webrtc.h"  // nogncheck
 #endif
 
 #if defined(SANITIZER_COVERAGE)
diff --git a/media/gpu/dxva_picture_buffer_win.cc b/media/gpu/dxva_picture_buffer_win.cc
index a6f417da..44f27f9 100644
--- a/media/gpu/dxva_picture_buffer_win.cc
+++ b/media/gpu/dxva_picture_buffer_win.cc
@@ -11,6 +11,7 @@
 #include "ui/gl/gl_context.h"
 #include "ui/gl/gl_fence.h"
 #include "ui/gl/gl_image.h"
+#include "ui/gl/gl_image_dxgi.h"
 #include "ui/gl/gl_surface_egl.h"
 #include "ui/gl/scoped_binders.h"
 
@@ -75,20 +76,6 @@
   EGLSurface surface_;
 };
 
-class GLImageEGLStream : public DummyGLImage {
- public:
-  GLImageEGLStream(const gfx::Size& size, EGLStreamKHR stream)
-      : DummyGLImage(size), stream_(stream) {}
-
- private:
-  ~GLImageEGLStream() override {
-    EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
-    eglDestroyStreamKHR(egl_display, stream_);
-  }
-
-  EGLStreamKHR stream_;
-};
-
 }  // namespace
 
 #define RETURN_ON_FAILURE(result, log, ret) \
@@ -432,7 +419,7 @@
   };
   stream_ = eglCreateStreamKHR(egl_display, stream_attributes);
   RETURN_ON_FAILURE(!!stream_, "Could not create stream", false);
-  gl_image_ = make_scoped_refptr(new GLImageEGLStream(size(), stream_));
+  gl_image_ = make_scoped_refptr(new gl::GLImageDXGI(size(), stream_));
   gl::ScopedActiveTexture texture0(GL_TEXTURE0);
   gl::ScopedTextureBinder texture0_binder(
       GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[0]);
@@ -513,6 +500,11 @@
   RETURN_ON_FAILURE(result, "Could not post texture", false);
   result = eglStreamConsumerAcquireKHR(egl_display, stream_);
   RETURN_ON_FAILURE(result, "Could not post acquire stream", false);
+  gl::GLImageDXGI* gl_image_dxgi =
+      gl::GLImageDXGI::FromGLImage(gl_image_.get());
+  DCHECK(gl_image_dxgi);
+
+  gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource);
   return true;
 }
 
@@ -539,7 +531,7 @@
   };
   stream_ = eglCreateStreamKHR(egl_display, stream_attributes);
   RETURN_ON_FAILURE(!!stream_, "Could not create stream", false);
-  gl_image_ = make_scoped_refptr(new GLImageEGLStream(size(), stream_));
+  gl_image_ = make_scoped_refptr(new gl::GLImageDXGI(size(), stream_));
   gl::ScopedActiveTexture texture0(GL_TEXTURE0);
   gl::ScopedTextureBinder texture0_binder(
       GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[0]);
@@ -653,6 +645,11 @@
   RETURN_ON_FAILURE(result, "Could not post stream", false);
   result = eglStreamConsumerAcquireKHR(egl_display, stream_);
   RETURN_ON_FAILURE(result, "Could not post acquire stream", false);
+  gl::GLImageDXGI* gl_image_dxgi =
+      gl::GLImageDXGI::FromGLImage(gl_image_.get());
+  DCHECK(gl_image_dxgi);
+
+  gl_image_dxgi->SetTexture(angle_copy_texture_, 0);
 
   return true;
 }
diff --git a/media/gpu/jpeg_decode_accelerator_unittest.cc b/media/gpu/jpeg_decode_accelerator_unittest.cc
index aa1f42d..4262eb6 100644
--- a/media/gpu/jpeg_decode_accelerator_unittest.cc
+++ b/media/gpu/jpeg_decode_accelerator_unittest.cc
@@ -439,7 +439,7 @@
 };
 
 void JpegDecodeAcceleratorTest::TestDecode(size_t num_concurrent_decoders) {
-  LOG_ASSERT(test_image_files_.size() == expected_status_.size());
+  LOG_ASSERT(test_image_files_.size() >= expected_status_.size());
   base::Thread decoder_thread("DecoderThread");
   ASSERT_TRUE(decoder_thread.Start());
 
@@ -461,8 +461,10 @@
           FROM_HERE, base::Bind(&JpegClient::StartDecode,
                                 base::Unretained(clients[i]), index));
     }
-    for (size_t i = 0; i < num_concurrent_decoders; i++) {
-      ASSERT_EQ(notes[i]->Wait(), expected_status_[index]);
+    if (index < expected_status_.size()) {
+      for (size_t i = 0; i < num_concurrent_decoders; i++) {
+        ASSERT_EQ(notes[i]->Wait(), expected_status_[index]);
+      }
     }
   }
 
@@ -530,6 +532,17 @@
   TestDecode(1);
 }
 
+TEST_F(JpegDecodeAcceleratorTest, Abort) {
+  const size_t kNumOfJpegToDecode = 5;
+  for (size_t i = 0; i < kNumOfJpegToDecode; i++)
+    test_image_files_.push_back(g_env->image_data_1280x720_default_.get());
+  // Verify only one decode success to ensure both decoders have started the
+  // decoding. Then destroy the first decoder when it is still decoding. The
+  // kernel should not crash during this test.
+  expected_status_.push_back(CS_DECODE_PASS);
+  TestDecode(2);
+}
+
 }  // namespace
 }  // namespace media
 
diff --git a/net/cert/cert_verify_proc_unittest.cc b/net/cert/cert_verify_proc_unittest.cc
index 66ce713..d4a0886 100644
--- a/net/cert/cert_verify_proc_unittest.cc
+++ b/net/cert/cert_verify_proc_unittest.cc
@@ -649,6 +649,13 @@
     LOG(INFO) << "Skipping test on iOS because certs with mismatched "
                  "algorithms cannot be imported";
     return false;
+#elif defined(OS_MACOSX)
+    if (base::mac::IsAtLeastOS10_12()) {
+      LOG(INFO) << "Skipping test on macOS >= 10.12 because certs with "
+                   "mismatched algorithms cannot be imported";
+      return false;
+    }
+    return true;
 #else
     return true;
 #endif
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt
index 7205be5..954e916 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt
+++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https-expected.txt
@@ -20,8 +20,6 @@
 PASS MediaStreamTrack interface: attribute muted 
 PASS MediaStreamTrack interface: attribute onmute 
 PASS MediaStreamTrack interface: attribute onunmute 
-FAIL MediaStreamTrack interface: attribute readonly assert_true: The prototype object must have a property "readonly" expected true got false
-PASS MediaStreamTrack interface: attribute remote 
 PASS MediaStreamTrack interface: attribute readyState 
 PASS MediaStreamTrack interface: attribute onended 
 FAIL MediaStreamTrack interface: attribute onoverconstrained assert_true: The prototype object must have a property "onoverconstrained" expected true got false
@@ -40,17 +38,15 @@
 PASS MediaStreamTrack interface: track must inherit property "muted" with the proper type (4) 
 FAIL MediaStreamTrack interface: track must inherit property "onmute" with the proper type (5) Unrecognized type EventHandler
 FAIL MediaStreamTrack interface: track must inherit property "onunmute" with the proper type (6) Unrecognized type EventHandler
-FAIL MediaStreamTrack interface: track must inherit property "readonly" with the proper type (7) assert_inherits: property "readonly" not found in prototype chain
-PASS MediaStreamTrack interface: track must inherit property "remote" with the proper type (8) 
-FAIL MediaStreamTrack interface: track must inherit property "readyState" with the proper type (9) Unrecognized type MediaStreamTrackState
-FAIL MediaStreamTrack interface: track must inherit property "onended" with the proper type (10) Unrecognized type EventHandler
-FAIL MediaStreamTrack interface: track must inherit property "onoverconstrained" with the proper type (11) assert_inherits: property "onoverconstrained" not found in prototype chain
-PASS MediaStreamTrack interface: track must inherit property "clone" with the proper type (12) 
-PASS MediaStreamTrack interface: track must inherit property "stop" with the proper type (13) 
-FAIL MediaStreamTrack interface: track must inherit property "getCapabilities" with the proper type (14) assert_inherits: property "getCapabilities" not found in prototype chain
-PASS MediaStreamTrack interface: track must inherit property "getConstraints" with the proper type (15) 
-PASS MediaStreamTrack interface: track must inherit property "getSettings" with the proper type (16) 
-FAIL MediaStreamTrack interface: track must inherit property "applyConstraints" with the proper type (17) assert_inherits: property "applyConstraints" not found in prototype chain
+FAIL MediaStreamTrack interface: track must inherit property "readyState" with the proper type (7) Unrecognized type MediaStreamTrackState
+FAIL MediaStreamTrack interface: track must inherit property "onended" with the proper type (8) Unrecognized type EventHandler
+FAIL MediaStreamTrack interface: track must inherit property "onoverconstrained" with the proper type (9) assert_inherits: property "onoverconstrained" not found in prototype chain
+PASS MediaStreamTrack interface: track must inherit property "clone" with the proper type (10) 
+PASS MediaStreamTrack interface: track must inherit property "stop" with the proper type (11) 
+FAIL MediaStreamTrack interface: track must inherit property "getCapabilities" with the proper type (12) assert_inherits: property "getCapabilities" not found in prototype chain
+PASS MediaStreamTrack interface: track must inherit property "getConstraints" with the proper type (13) 
+PASS MediaStreamTrack interface: track must inherit property "getSettings" with the proper type (14) 
+FAIL MediaStreamTrack interface: track must inherit property "applyConstraints" with the proper type (15) assert_inherits: property "applyConstraints" not found in prototype chain
 FAIL MediaStreamTrack interface: calling applyConstraints(MediaTrackConstraints) on track with too few arguments must throw TypeError assert_inherits: property "applyConstraints" not found in prototype chain
 PASS EventTarget interface: track must inherit property "addEventListener" with the proper type (0) 
 PASS EventTarget interface: calling addEventListener(DOMString,EventListener,boolean) on track with too few arguments must throw TypeError 
diff --git a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https.html b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https.html
index 3aa12052..2be2d81 100644
--- a/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https.html
+++ b/third_party/WebKit/LayoutTests/external/wpt/mediacapture-streams/MediaStreamTrack-init.https.html
@@ -40,8 +40,6 @@
     readonly    attribute boolean               muted;\
                 attribute EventHandler          onmute;\
                 attribute EventHandler          onunmute;\
-    readonly    attribute boolean               _readonly;\
-    readonly    attribute boolean               remote;\
     readonly    attribute MediaStreamTrackState readyState;\
                 attribute EventHandler          onended;\
                 attribute EventHandler          onoverconstrained;\
diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams-expected.txt b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams-expected.txt
deleted file mode 100644
index a758bb0c..0000000
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams-expected.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-Tests that an RTCPeerConnection can signal that remote streams are added and removed.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS local_stream.getAudioTracks()[0].remote is false
-PASS local_stream.getVideoTracks()[0].remote is false
-PASS pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailedUnexpectedly); did not throw exception.
-PASS remote stream was added
-PASS event.stream.getVideoTracks().length is 1
-PASS event.stream.getAudioTracks().length is 1
-PASS event.stream.active is true
-PASS event.stream.getAudioTracks()[0].remote is true
-PASS event.stream.getVideoTracks()[0].remote is true
-PASS requestSucceeded was called.
-PASS pc.getRemoteStreams().length is 1
-PASS pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailedUnexpectedly); did not throw exception.
-PASS remote stream was removed
-PASS event.stream.getVideoTracks().length is 0
-PASS event.stream.getAudioTracks().length is 0
-PASS event.stream.active is false
-PASS requestSucceeded was called.
-PASS pc.getRemoteStreams().length is 0
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html b/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html
deleted file mode 100644
index a693e494..0000000
--- a/third_party/WebKit/LayoutTests/fast/peerconnection/RTCPeerConnection-remotestreams.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../../resources/js-test.js"></script>
-</head>
-<body>
-<script>
-description("Tests that an RTCPeerConnection can signal that remote streams are added and removed.");
-
-var pc = null;
-var local_stream = null;
-
-function error() {
-    testFailed('Stream generation failed.');
-    finishJSTest();
-}
-
-function getUserMedia(dictionary, callback) {
-    try {
-        navigator.webkitGetUserMedia(dictionary, callback, error);
-    } catch (e) {
-        testFailed('webkitGetUserMedia threw exception :' + e);
-        finishJSTest();
-    }
-}
-
-function requestSucceeded2()
-{
-    testPassed('requestSucceeded was called.');
-    shouldBeEqualToNumber('pc.getRemoteStreams().length', 0);
-    finishJSTest();
-}
-
-function requestSucceeded1()
-{
-    testPassed('requestSucceeded was called.');
-    shouldBeEqualToNumber('pc.getRemoteStreams().length', 1);
-
-    sessionDescription = new RTCSessionDescription({type:"offer", sdp:"remote"});
-    shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded2, requestFailedUnexpectedly);');
-}
-
-function requestFailedUnexpectedly()
-{
-    testFailed('requestFailed was called.');
-    finishJSTest();
-}
-
-function gotStream(stream) {
-    local_stream = stream;
-    shouldBeFalse('local_stream.getAudioTracks()[0].remote');
-    shouldBeFalse('local_stream.getVideoTracks()[0].remote');
-    pc.addStream(local_stream);
-
-    sessionDescription = new RTCSessionDescription({type:"answer", sdp:"remote"});
-    shouldNotThrow('pc.setRemoteDescription(sessionDescription, requestSucceeded1, requestFailedUnexpectedly);');
-}
-
-function onAddStream(event) {
-    testPassed('remote stream was added');
-    shouldBeEqualToNumber('event.stream.getVideoTracks().length', 1);
-    shouldBeEqualToNumber('event.stream.getAudioTracks().length', 1);
-    shouldBeTrue('event.stream.active')
-    shouldBeTrue('event.stream.getAudioTracks()[0].remote');
-    shouldBeTrue('event.stream.getVideoTracks()[0].remote');
-    pc.removeStream(local_stream);
-}
-
-function onRemoveStream(event) {
-    testPassed('remote stream was removed');
-    shouldBeEqualToNumber('event.stream.getVideoTracks().length', 0);
-    shouldBeEqualToNumber('event.stream.getAudioTracks().length', 0);
-    shouldBeFalse('event.stream.active')
-}
-
-pc = new RTCPeerConnection();
-pc.onaddstream = onAddStream;
-pc.onremovestream = onRemoveStream;
-getUserMedia({audio:true, video:true}, gotStream);
-
-
-window.jsTestIsAsync = true;
-window.successfullyParsed = true;
-</script>
-</body>
-</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt b/third_party/WebKit/LayoutTests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt
index 54307f8..c9d2d8cb 100644
--- a/third_party/WebKit/LayoutTests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/worklet/webexposed/global-interface-listing-paint-worklet-expected.txt
@@ -66,6 +66,13 @@
 CONSOLE MESSAGE: line 138: interface CSSNumberValue : CSSStyleValue
 CONSOLE MESSAGE: line 138:     getter value
 CONSOLE MESSAGE: line 138:     method constructor
+CONSOLE MESSAGE: line 138: interface CSSNumericValue : CSSStyleValue
+CONSOLE MESSAGE: line 138:     method add
+CONSOLE MESSAGE: line 138:     method constructor
+CONSOLE MESSAGE: line 138:     method div
+CONSOLE MESSAGE: line 138:     method mul
+CONSOLE MESSAGE: line 138:     method sub
+CONSOLE MESSAGE: line 138:     method to
 CONSOLE MESSAGE: line 138: interface CSSPerspective : CSSTransformComponent
 CONSOLE MESSAGE: line 138:     getter length
 CONSOLE MESSAGE: line 138:     method constructor
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
index 0570525f..2eb51d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3440,7 +3440,6 @@
     getter onmute
     getter onunmute
     getter readyState
-    getter remote
     method clone
     method constructor
     method getConstraints
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
index c3d52c3..befe983 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3369,7 +3369,6 @@
     getter onmute
     getter onunmute
     getter readyState
-    getter remote
     method clone
     method constructor
     method getConstraints
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index e0e6f609..a0d48ef 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -584,6 +584,14 @@
     attribute @@toStringTag
     getter value
     method constructor
+interface CSSNumericValue : CSSStyleValue
+    attribute @@toStringTag
+    method add
+    method constructor
+    method div
+    method mul
+    method sub
+    method to
 interface CSSPageRule : CSSRule
     attribute @@toStringTag
     getter selectorText
@@ -4114,7 +4122,6 @@
     getter onmute
     getter onunmute
     getter readyState
-    getter remote
     method clone
     method constructor
     method getConstraints
diff --git a/third_party/WebKit/Source/bindings/scripts/idl_types.py b/third_party/WebKit/Source/bindings/scripts/idl_types.py
index dbfb3e9..d218ab0 100644
--- a/third_party/WebKit/Source/bindings/scripts/idl_types.py
+++ b/third_party/WebKit/Source/bindings/scripts/idl_types.py
@@ -324,6 +324,21 @@
         return set(flattened_members.values())
 
     @property
+    def number_of_nullable_member_types(self):
+        """Returns the union's number of nullable types.
+
+        http://heycam.github.io/webidl/#dfn-number-of-nullable-member-types
+        """
+        count = 0
+        for member in self.member_types:
+            if member.is_nullable:
+                count += 1
+                member = member.inner_type
+            if member.is_union_type:
+                count += member.number_of_nullable_member_types
+        return count
+
+    @property
     def is_union_type(self):
         return True
 
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_types.py b/third_party/WebKit/Source/bindings/scripts/v8_types.py
index 304f56b8..dcabd8a 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_types.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_types.py
@@ -1059,21 +1059,6 @@
 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
 
 
-def number_of_nullable_member_types_union(idl_type):
-    # http://heycam.github.io/webidl/#dfn-number-of-nullable-member-types
-    count = 0
-    for member in idl_type.member_types:
-        if member.is_nullable:
-            count += 1
-            member = member.inner_type
-        if member.is_union_type:
-            count += number_of_nullable_member_types_union(member)
-    return count
-
-IdlUnionType.number_of_nullable_member_types = property(
-    number_of_nullable_member_types_union)
-
-
 def includes_nullable_type_union(idl_type):
     # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
     return idl_type.number_of_nullable_member_types == 1
diff --git a/third_party/WebKit/Source/build/scripts/css_properties.py b/third_party/WebKit/Source/build/scripts/css_properties.py
index 78b4d7a..a589a52 100755
--- a/third_party/WebKit/Source/build/scripts/css_properties.py
+++ b/third_party/WebKit/Source/build/scripts/css_properties.py
@@ -41,6 +41,11 @@
         # StylePropertyMetadata additionally assumes there are under 1024 properties.
         assert self._first_enum_value + len(properties) < 512, 'Property aliasing expects there are under 512 properties.'
 
+        for property in properties:
+            assert property['is_descriptor'] or property['is_property'], \
+                property['name'] + ' must be either a property, a descriptor' +\
+                ' or both'
+
         for offset, property in enumerate(properties):
             property['property_id'] = name_utilities.enum_for_css_property(property['name'])
             property['upper_camel_name'] = name_utilities.camel_case(property['name'])
diff --git a/third_party/WebKit/Source/build/scripts/make_css_property_metadata.py b/third_party/WebKit/Source/build/scripts/make_css_property_metadata.py
index 97937fa..80df8355 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_property_metadata.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_metadata.py
@@ -24,7 +24,8 @@
     def generate_css_property_metadata_cpp(self):
         return {
             'properties_including_aliases': self._properties_including_aliases,
-            'switches': [('descriptor_only', 'isDescriptorOnly'),
+            'switches': [('is_descriptor', 'isDescriptor'),
+                         ('is_property', 'isProperty'),
                          ('interpolable', 'isInterpolableProperty'),
                          ('inherited', 'isInheritedProperty'),
                          ('supports_percentage', 'propertySupportsPercentage'),
diff --git a/third_party/WebKit/Source/build/scripts/make_style_builder.py b/third_party/WebKit/Source/build/scripts/make_style_builder.py
index f378e5f..70cc8e9 100755
--- a/third_party/WebKit/Source/build/scripts/make_style_builder.py
+++ b/third_party/WebKit/Source/build/scripts/make_style_builder.py
@@ -69,7 +69,7 @@
                 property['is_inherited_setter'] = 'set' + name + 'IsInherited'
             property['should_declare_functions'] = not property['use_handlers_for'] and not property['longhands'] \
                 and not property['direction_aware'] and not property['builder_skip'] \
-                and not property['descriptor_only']
+                and property['is_property']
 
     @template_expander.use_jinja('StyleBuilderFunctions.h.tmpl',
                                  filters=filters)
diff --git a/third_party/WebKit/Source/core/core_idl_files.gni b/third_party/WebKit/Source/core/core_idl_files.gni
index 5f02fc6..569c9c17 100644
--- a/third_party/WebKit/Source/core/core_idl_files.gni
+++ b/third_party/WebKit/Source/core/core_idl_files.gni
@@ -70,6 +70,7 @@
                                  "css/cssom/CSSLengthValue.idl",
                                  "css/cssom/CSSMatrixComponent.idl",
                                  "css/cssom/CSSNumberValue.idl",
+                                 "css/cssom/CSSNumericValue.idl",
                                  "css/cssom/CSSPerspective.idl",
                                  "css/cssom/CSSPositionValue.idl",
                                  "css/cssom/CSSResourceValue.idl",
diff --git a/third_party/WebKit/Source/core/css/BUILD.gn b/third_party/WebKit/Source/core/css/BUILD.gn
index a01ee099..da41d11 100644
--- a/third_party/WebKit/Source/core/css/BUILD.gn
+++ b/third_party/WebKit/Source/core/css/BUILD.gn
@@ -258,6 +258,8 @@
     "cssom/CSSMatrixComponent.cpp",
     "cssom/CSSMatrixComponent.h",
     "cssom/CSSNumberValue.h",
+    "cssom/CSSNumericValue.cpp",
+    "cssom/CSSNumericValue.h",
     "cssom/CSSOMKeywords.h",
     "cssom/CSSOMTypes.h",
     "cssom/CSSPerspective.cpp",
diff --git a/third_party/WebKit/Source/core/css/CSSFontFace.cpp b/third_party/WebKit/Source/core/css/CSSFontFace.cpp
index a7bfebe..48c50257 100644
--- a/third_party/WebKit/Source/core/css/CSSFontFace.cpp
+++ b/third_party/WebKit/Source/core/css/CSSFontFace.cpp
@@ -65,7 +65,7 @@
       m_sources.clear();
       setLoadStatus(FontFace::Error);
     } else {
-      m_sources.removeFirst();
+      m_sources.pop_front();
       load();
     }
   }
@@ -103,7 +103,7 @@
         setLoadStatus(FontFace::Loaded);
       return result.release();
     }
-    m_sources.removeFirst();
+    m_sources.pop_front();
   }
 
   if (loadStatus() == FontFace::Unloaded)
@@ -169,7 +169,7 @@
         return;
       }
     }
-    m_sources.removeFirst();
+    m_sources.pop_front();
   }
   setLoadStatus(FontFace::Error);
 }
diff --git a/third_party/WebKit/Source/core/css/CSSProperties.json5 b/third_party/WebKit/Source/core/css/CSSProperties.json5
index d7fb4e8..a7a0191 100644
--- a/third_party/WebKit/Source/core/css/CSSProperties.json5
+++ b/third_party/WebKit/Source/core/css/CSSProperties.json5
@@ -17,10 +17,16 @@
     runtime_flag: {
     },
 
-    // - descriptor_only
-    // These are actually descriptors and not CSS properties. Properties with
-    // the same name as a descriptor do not get this flag.
-    descriptor_only: {
+    // - is_descriptor
+    // Whether it is the name of a CSS descriptor.
+    // TODO(alancutter): Don't use CSSPropertyID for descriptors.
+    is_descriptor: {
+    },
+
+    // - is_property
+    // Whether it is the name of a CSS property.
+    is_property: {
+      default: true,
     },
 
     // - longhands: "property;other-property"
@@ -342,6 +348,7 @@
       api_class: true,
       api_methods: ["parseSingleValue"],
       converter: "convertFontFamily",
+      is_descriptor: true,
       font: true,
       inherited: true,
       name_for_methods: "FamilyDescription",
@@ -382,6 +389,7 @@
     },
     {
       name: "font-stretch",
+      is_descriptor: true,
       font: true,
       inherited: true,
       name_for_methods: "Stretch",
@@ -390,6 +398,7 @@
     },
     {
       name: "font-style",
+      is_descriptor: true,
       font: true,
       inherited: true,
       name_for_methods: "Style",
@@ -430,6 +439,7 @@
     {
       name: "font-weight",
       converter: "convertFontWeight",
+      is_descriptor: true,
       font: true,
       inherited: true,
       interpolable: true,
@@ -440,6 +450,7 @@
     {
       name: "font-feature-settings",
       converter: "convertFontFeatureSettings",
+      is_descriptor: true,
       font: true,
       inherited: true,
       name_for_methods: "FeatureSettings",
@@ -514,6 +525,7 @@
       api_class: true,
       api_methods: ["parseSingleValue"],
       custom_all: true,
+      is_descriptor: true,
       priority: "High",
     },
 
@@ -1099,6 +1111,7 @@
       name: "height",
       api_class: "CSSPropertyAPIWidthOrHeight",
       converter: "convertLengthSizing",
+      is_descriptor: true,
       initial: "initialSize",
       interpolable: true,
       keywords: ["auto", "fit-content", "min-content", "max-content"],
@@ -1293,12 +1306,14 @@
     {
       name: "max-height",
       converter: "convertLengthMaxSizing",
+      is_descriptor: true,
       initial: "initialMaxSize",
       interpolable: true,
     },
     {
       name: "max-width",
       converter: "convertLengthMaxSizing",
+      is_descriptor: true,
       initial: "initialMaxSize",
       interpolable: true,
     },
@@ -1306,6 +1321,7 @@
       name: "min-height",
       api_class: "CSSPropertyAPIWidthOrHeight",
       converter: "convertLengthSizing",
+      is_descriptor: true,
       initial: "initialMinSize",
       interpolable: true,
     },
@@ -1313,6 +1329,7 @@
       name: "min-width",
       api_class: "CSSPropertyAPIWidthOrHeight",
       converter: "convertLengthSizing",
+      is_descriptor: true,
       initial: "initialMinSize",
       interpolable: true,
     },
@@ -2345,6 +2362,7 @@
       name: "width",
       api_class: "CSSPropertyAPIWidthOrHeight",
       converter: "convertLengthSizing",
+      is_descriptor: true,
       initial: "initialSize",
       interpolable: true,
       keywords: ["auto", "fit-content", "min-content", "max-content"],
@@ -2584,36 +2602,43 @@
       inherited: true,
     },
 
-    // Descriptors
+    // Descriptor only names
 
     {
       name: "font-display",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
       runtime_flag: "CSSFontDisplay",
     },
     {
       name: "max-zoom",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
     },
     {
       name: "min-zoom",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
     },
     {
       name: "orientation",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
     },
     {
       name: "src",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
     },
     {
       name: "unicode-range",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
     },
     {
       name: "user-zoom",
-      descriptor_only: true,
+      is_descriptor: true,
+      is_property: false,
     },
 
     // Shorthands
@@ -2694,6 +2719,7 @@
     },
     {
       name: "font-variant",
+      is_descriptor: true,
       longhands: "font-variant-ligatures;font-variant-caps;font-variant-numeric",
     },
     {
diff --git a/third_party/WebKit/Source/core/css/CSSProperty.cpp b/third_party/WebKit/Source/core/css/CSSProperty.cpp
index b3adce7..df821c4 100644
--- a/third_party/WebKit/Source/core/css/CSSProperty.cpp
+++ b/third_party/WebKit/Source/core/css/CSSProperty.cpp
@@ -275,7 +275,7 @@
   if (propertyID == CSSPropertyVariable)
     return false;
 
-  if (CSSPropertyMetadata::isDescriptorOnly(propertyID))
+  if (!CSSPropertyMetadata::isProperty(propertyID))
     return false;
 
   // all shorthand spec says:
diff --git a/third_party/WebKit/Source/core/css/CSSPropertyMetadata.h b/third_party/WebKit/Source/core/css/CSSPropertyMetadata.h
index c41b661..7b38f0f 100644
--- a/third_party/WebKit/Source/core/css/CSSPropertyMetadata.h
+++ b/third_party/WebKit/Source/core/css/CSSPropertyMetadata.h
@@ -22,7 +22,8 @@
   static bool propertySupportsPercentage(CSSPropertyID unresolvedProperty);
   static bool propertyIsRepeated(CSSPropertyID unresolvedProperty);
   static char repetitionSeparator(CSSPropertyID unresolvedProperty);
-  static bool isDescriptorOnly(CSSPropertyID unresolvedProperty);
+  static bool isDescriptor(CSSPropertyID unresolvedProperty);
+  static bool isProperty(CSSPropertyID unresolvedProperty);
 
   static void filterEnabledCSSPropertiesIntoVector(const CSSPropertyID*,
                                                    size_t length,
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.cpp
new file mode 100644
index 0000000..da80713
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.cpp
@@ -0,0 +1,15 @@
+// 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/css/cssom/CSSNumericValue.h"
+
+namespace blink {
+
+CSSNumericValue* CSSNumericValue::parse(const String& cssText,
+                                        ExceptionState&) {
+  // TODO(meade): Implement
+  return nullptr;
+}
+
+}  // namespace blink
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.h b/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.h
new file mode 100644
index 0000000..755fc2b
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.h
@@ -0,0 +1,34 @@
+// 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 CSSNumericValue_h
+#define CSSNumericValue_h
+
+#include "bindings/core/v8/ScriptWrappable.h"
+#include "core/CoreExport.h"
+#include "core/css/cssom/CSSStyleValue.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+class ExceptionState;
+
+class CORE_EXPORT CSSNumericValue : public CSSStyleValue {
+  WTF_MAKE_NONCOPYABLE(CSSNumericValue);
+  DEFINE_WRAPPERTYPEINFO();
+
+ public:
+  static CSSNumericValue* parse(const String& cssText, ExceptionState&);
+
+  virtual CSSNumericValue* add(const CSSNumericValue*, ExceptionState&) = 0;
+  virtual CSSNumericValue* sub(const CSSNumericValue*, ExceptionState&) = 0;
+  virtual CSSNumericValue* mul(double, ExceptionState&) = 0;
+  virtual CSSNumericValue* div(double, ExceptionState&) = 0;
+
+  virtual CSSNumericValue* to(const String&, ExceptionState&) = 0;
+};
+
+}  // namespace blink
+
+#endif  // CSSNumericValue_h
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.idl b/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.idl
new file mode 100644
index 0000000..e4907bcc
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/cssom/CSSNumericValue.idl
@@ -0,0 +1,18 @@
+// 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.
+// https://drafts.css-houdini.org/css-typed-om/#numeric-objects
+
+[
+  Exposed=(Window,PaintWorklet),
+  RuntimeEnabled=CSSTypedOM
+] interface CSSNumericValue : CSSStyleValue {
+  [RaisesException, NewObject] CSSNumericValue add(CSSNumericValue value);
+  [RaisesException, NewObject] CSSNumericValue sub(CSSNumericValue value);
+  [RaisesException, NewObject] CSSNumericValue mul(double value);
+  [RaisesException, NewObject] CSSNumericValue div(double value);
+
+  [RaisesException, NewObject] CSSNumericValue to(DOMString unit);
+
+  [RaisesException, NewObject] static CSSNumericValue parse(DOMString cssText);
+};
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
index 2f16c13c..0604e13 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserFastPaths.cpp
@@ -973,7 +973,7 @@
       return nullptr;
 
     // Descriptors do not support css wide keywords.
-    if (CSSPropertyMetadata::isDescriptorOnly(propertyId))
+    if (!CSSPropertyMetadata::isProperty(propertyId))
       return nullptr;
   }
 
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 7486d5a..bf8886f 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -278,7 +278,7 @@
   CSSPropertyID property = resolveCSSPropertyID(unresolvedProperty);
   const StylePropertyShorthand& shorthand = shorthandForProperty(property);
   if (!shorthand.length()) {
-    if (CSSPropertyMetadata::isDescriptorOnly(unresolvedProperty))
+    if (!CSSPropertyMetadata::isProperty(unresolvedProperty))
       return false;
     addProperty(property, CSSPropertyInvalid, *value, important);
   } else {
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 7b43059..e184fe3 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -4476,7 +4476,7 @@
 void Document::runExecutionContextTask(
     std::unique_ptr<ExecutionContextTask> task,
     bool isInstrumented) {
-  probe::AsyncTask asyncTask(this, task.get(), isInstrumented);
+  probe::AsyncTask asyncTask(this, task.get(), nullptr, isInstrumented);
   task->performTask(this);
 }
 
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 7439353..cde1c10 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -531,7 +531,7 @@
   // crbug.com/623079.
   bool disableCustomCallbacks = !scrollState.isDirectManipulation() &&
                                 !document()
-                                     .frameHost()
+                                     .page()
                                      ->globalRootScrollerController()
                                      .isViewportScrollCallback(callback);
 
@@ -620,7 +620,7 @@
   // crbug.com/623079.
   bool disableCustomCallbacks = !scrollState.isDirectManipulation() &&
                                 !document()
-                                     .frameHost()
+                                     .page()
                                      ->globalRootScrollerController()
                                      .isViewportScrollCallback(callback);
 
diff --git a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp
index d873b57..20be75d 100644
--- a/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptedIdleTaskController.cpp
@@ -103,6 +103,9 @@
   m_callbacks.set(id, callback);
   long long timeoutMillis = options.timeout();
 
+  probe::asyncTaskScheduled(getExecutionContext(), "requestIdleCallback",
+                            callback);
+
   RefPtr<internal::IdleRequestCallbackWrapper> callbackWrapper =
       internal::IdleRequestCallbackWrapper::create(id, this);
   m_scheduler->postIdleTask(
@@ -158,7 +161,7 @@
     double deadlineSeconds,
     IdleDeadline::CallbackType callbackType) {
   DCHECK(!m_suspended);
-  auto callback = m_callbacks.take(id);
+  IdleRequestCallback* callback = m_callbacks.take(id);
   if (!callback)
     return;
 
@@ -170,8 +173,10 @@
       ("WebCore.ScriptedIdleTaskController.IdleCallbackDeadline", 0, 50, 50));
   idleCallbackDeadlineHistogram.count(allottedTimeMillis);
 
+  probe::AsyncTask asyncTask(getExecutionContext(), callback);
   probe::UserCallback probe(getExecutionContext(), "requestIdleCallback",
                             AtomicString(), true);
+
   TRACE_EVENT1(
       "devtools.timeline", "FireIdleCallback", "data",
       InspectorIdleCallbackFireEvent::data(
diff --git a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
index 51de7da..10db110 100644
--- a/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/UndoStack.cpp
@@ -48,7 +48,7 @@
   if (m_undoStack.size())
     DCHECK_GE(step->sequenceNumber(), m_undoStack.back()->sequenceNumber());
   if (m_undoStack.size() == maximumUndoStackDepth)
-    m_undoStack.removeFirst();  // drop oldest item off the far end
+    m_undoStack.pop_front();  // drop oldest item off the far end
   if (!m_inRedo)
     m_redoStack.clear();
   m_undoStack.push_back(step);
diff --git a/third_party/WebKit/Source/core/fileapi/FileReader.cpp b/third_party/WebKit/Source/core/fileapi/FileReader.cpp
index c2fe676013..58a75173 100644
--- a/third_party/WebKit/Source/core/fileapi/FileReader.cpp
+++ b/third_party/WebKit/Source/core/fileapi/FileReader.cpp
@@ -93,7 +93,7 @@
     if (!controller)
       return;
 
-    probe::asyncTaskScheduled(context, "FileReader", reader, true);
+    probe::asyncTaskScheduled(context, "FileReader", reader);
     controller->pushReader(reader);
   }
 
@@ -452,7 +452,7 @@
 }
 
 void FileReader::fireEvent(const AtomicString& type) {
-  probe::AsyncTask asyncTask(getExecutionContext(), this);
+  probe::AsyncTask asyncTask(getExecutionContext(), this, "event");
   if (!m_loader) {
     dispatchEvent(ProgressEvent::create(type, false, 0, 0));
     return;
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
index fb011686..a57062c 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -104,7 +104,7 @@
                        InspectorTimerInstallEvent::data(context, timeoutID,
                                                         interval, singleShot));
   probe::asyncTaskScheduledBreakable(
-      context, singleShot ? "setTimeout" : "setInterval", this, !singleShot);
+      context, singleShot ? "setTimeout" : "setInterval", this);
 }
 
 DOMTimer::~DOMTimer() {
@@ -145,7 +145,8 @@
   probe::UserCallback probe(context,
                             repeatInterval() ? "setInterval" : "setTimeout",
                             AtomicString(), true);
-  probe::AsyncTask asyncTask(context, this);
+  probe::AsyncTask asyncTask(context, this,
+                             repeatInterval() ? "fired" : nullptr);
 
   // Simple case for non-one-shot timers.
   if (isActive()) {
diff --git a/third_party/WebKit/Source/core/frame/FrameHost.cpp b/third_party/WebKit/Source/core/frame/FrameHost.cpp
index f998cf1..46029a60 100644
--- a/third_party/WebKit/Source/core/frame/FrameHost.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameHost.cpp
@@ -86,11 +86,6 @@
   return *m_consoleMessageStorage;
 }
 
-TopDocumentRootScrollerController& FrameHost::globalRootScrollerController()
-    const {
-  return page().globalRootScrollerController();
-}
-
 DEFINE_TRACE(FrameHost) {
   visitor->trace(m_page);
   visitor->trace(m_overscrollController);
diff --git a/third_party/WebKit/Source/core/frame/FrameHost.h b/third_party/WebKit/Source/core/frame/FrameHost.h
index 10645087..7be48180 100644
--- a/third_party/WebKit/Source/core/frame/FrameHost.h
+++ b/third_party/WebKit/Source/core/frame/FrameHost.h
@@ -44,7 +44,6 @@
 class ConsoleMessageStorage;
 class OverscrollController;
 class Page;
-class TopDocumentRootScrollerController;
 
 // FrameHost is the set of global data shared between multiple frames
 // and is provided by the embedder to each frame when created.
@@ -76,8 +75,6 @@
   ConsoleMessageStorage& consoleMessageStorage();
   const ConsoleMessageStorage& consoleMessageStorage() const;
 
-  TopDocumentRootScrollerController& globalRootScrollerController() const;
-
   DECLARE_TRACE();
 
   // Don't allow more than a certain number of frames in a page.
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 00ea3e0c..a81c444 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -346,12 +346,12 @@
   if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
     scrollingCoordinator->willDestroyScrollableArea(this);
 
-  FrameHost* frameHost = m_frame->host();
+  Page* page = m_frame->page();
   // TODO(dcheng): It's wrong that the frame can be detached before the
   // FrameView. Figure out what's going on and fix FrameView to be disposed with
   // the correct timing.
-  if (frameHost)
-    frameHost->globalRootScrollerController().didDisposeScrollableArea(*this);
+  if (page)
+    page->globalRootScrollerController().didDisposeScrollableArea(*this);
 
   // We need to clear the RootFrameViewport's animator since it gets called
   // from non-GC'd objects and RootFrameViewport will still have a pointer to
@@ -1626,7 +1626,7 @@
 
 void FrameView::viewportSizeChanged(bool widthChanged, bool heightChanged) {
   DCHECK(widthChanged || heightChanged);
-  DCHECK(m_frame->host());
+  DCHECK(m_frame->page());
 
   if (LayoutViewItem layoutView = this->layoutViewItem()) {
     if (layoutView.usesCompositing())
@@ -1636,7 +1636,7 @@
   // Ensure the root scroller compositing layers update geometry in response to
   // the URL bar resizing.
   if (m_frame->isMainFrame())
-    m_frame->host()->globalRootScrollerController().mainFrameViewResized();
+    m_frame->page()->globalRootScrollerController().mainFrameViewResized();
 
   showOverlayScrollbars();
 
@@ -2767,8 +2767,9 @@
         RootFrameViewport::create(visualViewport, *layoutViewport);
     m_viewportScrollableArea = rootFrameViewport;
 
-    frameHost->globalRootScrollerController().initializeViewportScrollCallback(
-        *rootFrameViewport);
+    frameHost->page()
+        .globalRootScrollerController()
+        .initializeViewportScrollCallback(*rootFrameViewport);
   }
 }
 
@@ -3068,7 +3069,7 @@
       DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() ||
              lifecycle().state() >= DocumentLifecycle::CompositingClean);
 
-      m_frame->host()->globalRootScrollerController().didUpdateCompositing();
+      m_frame->page()->globalRootScrollerController().didUpdateCompositing();
 
       if (targetState >= DocumentLifecycle::PrePaintClean) {
         if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
@@ -3787,11 +3788,11 @@
 bool FrameView::visualViewportSuppliesScrollbars() {
   // On desktop, we always use the layout viewport's scrollbars.
   if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() ||
-      !m_frame->document() || !m_frame->host())
+      !m_frame->document() || !m_frame->page())
     return false;
 
   const TopDocumentRootScrollerController& controller =
-      m_frame->host()->globalRootScrollerController();
+      m_frame->page()->globalRootScrollerController();
 
   if (!layoutViewportScrollableArea())
     return false;
@@ -3850,8 +3851,8 @@
   IntSize visibleSize = visibleContentSize(ExcludeScrollbars);
   IntSize contentBounds = contentsSize();
 
-  FrameHost* host = m_frame->host();
-  DCHECK(host);
+  Page* page = m_frame->page();
+  DCHECK(page);
 
   // We need to perform this const_cast since maximumScrollOffsetInt is a const
   // method but we can't make layoutViewportScrollableArea const since it can
@@ -3860,7 +3861,7 @@
   const ScrollableArea* layoutViewport =
       const_cast<FrameView*>(this)->layoutViewportScrollableArea();
   TopDocumentRootScrollerController& controller =
-      host->globalRootScrollerController();
+      page->globalRootScrollerController();
   if (layoutViewport == controller.rootScrollerArea())
     visibleSize = controller.rootScrollerVisibleArea();
 
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
index 7d37751..13e32ea 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLParserScriptRunner.cpp
@@ -374,7 +374,7 @@
       // this code path.
       CHECK(false);
 
-      m_scriptsToExecuteAfterParsing.removeFirst();
+      m_scriptsToExecuteAfterParsing.pop_front();
       // TODO(hiroshige): executeScriptsWaitingForParsing() should be
       // called later at the appropriate time. https://crbug.com/696775
     }
diff --git a/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp b/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp
index 49cadda8..cf93784f 100644
--- a/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp
+++ b/third_party/WebKit/Source/core/inspector/ConsoleMessageStorage.cpp
@@ -19,7 +19,7 @@
   DCHECK(m_messages.size() <= maxConsoleMessageCount);
   if (m_messages.size() == maxConsoleMessageCount) {
     ++m_expiredCount;
-    m_messages.removeFirst();
+    m_messages.pop_front();
   }
   m_messages.push_back(message);
 }
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
index f8c3cef8..de9995e6 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp
@@ -1100,7 +1100,7 @@
     CSSPropertyID propertyId = static_cast<CSSPropertyID>(id);
     if (!CSSPropertyMetadata::isEnabledProperty(propertyId) ||
         isShorthandProperty(propertyId) ||
-        CSSPropertyMetadata::isDescriptorOnly(propertyId))
+        !CSSPropertyMetadata::isProperty(propertyId))
       continue;
     (*style)->addItem(
         protocol::CSS::CSSComputedStyleProperty::create()
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
index cb3d3139..a16579e 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
@@ -71,43 +71,51 @@
   return captureEndTime() - m_startTime;
 }
 
-AsyncTask::AsyncTask(ExecutionContext* context, void* task)
-    : AsyncTask(context, task, true) {}
-
-AsyncTask::AsyncTask(ExecutionContext* context, void* task, bool enabled)
+AsyncTask::AsyncTask(ExecutionContext* context,
+                     void* task,
+                     const char* step,
+                     bool enabled)
     : m_debugger(enabled ? ThreadDebugger::from(toIsolate(context)) : nullptr),
-      m_task(task) {
-  TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", task);
+      m_task(task),
+      m_recurring(step) {
+  if (m_recurring) {
+    TRACE_EVENT_FLOW_STEP0("devtools.timeline.async", "AsyncTask", task,
+                           step ? step : "");
+  } else {
+    TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", task);
+  }
   if (m_debugger)
     m_debugger->asyncTaskStarted(m_task);
 }
 
 AsyncTask::~AsyncTask() {
-  if (m_debugger)
+  if (m_debugger) {
     m_debugger->asyncTaskFinished(m_task);
+    if (!m_recurring)
+      m_debugger->asyncTaskCanceled(m_task);
+  }
 }
 
 void asyncTaskScheduled(ExecutionContext* context,
                         const String& name,
-                        void* task,
-                        bool recurring) {
+                        void* task) {
   TRACE_EVENT_FLOW_BEGIN1("devtools.timeline.async", "AsyncTask", task, "data",
                           InspectorAsyncTask::data(name));
   if (ThreadDebugger* debugger = ThreadDebugger::from(toIsolate(context)))
-    debugger->asyncTaskScheduled(name, task, recurring);
+    debugger->asyncTaskScheduled(name, task, true);
 }
 
 void asyncTaskScheduledBreakable(ExecutionContext* context,
                                  const char* name,
-                                 void* task,
-                                 bool recurring) {
-  asyncTaskScheduled(context, name, task, recurring);
+                                 void* task) {
+  asyncTaskScheduled(context, name, task);
   breakableLocation(context, name);
 }
 
 void asyncTaskCanceled(ExecutionContext* context, void* task) {
   if (ThreadDebugger* debugger = ThreadDebugger::from(toIsolate(context)))
     debugger->asyncTaskCanceled(task);
+  TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", task);
 }
 
 void asyncTaskCanceledBreakable(ExecutionContext* context,
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h
index 72803aa..a188d56 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.h
@@ -63,13 +63,16 @@
   STACK_ALLOCATED();
 
  public:
-  AsyncTask(ExecutionContext*, void* task);
-  AsyncTask(ExecutionContext*, void* task, bool enabled);
+  AsyncTask(ExecutionContext*,
+            void* task,
+            const char* step = nullptr,
+            bool enabled = true);
   ~AsyncTask();
 
  private:
   ThreadDebugger* m_debugger;
   void* m_task;
+  bool m_recurring;
 };
 
 // Called from generated instrumentation code.
@@ -112,12 +115,10 @@
 
 CORE_EXPORT void asyncTaskScheduled(ExecutionContext*,
                                     const String& name,
-                                    void*,
-                                    bool recurring = false);
+                                    void*);
 CORE_EXPORT void asyncTaskScheduledBreakable(ExecutionContext*,
                                              const char* name,
-                                             void*,
-                                             bool recurring = false);
+                                             void*);
 CORE_EXPORT void asyncTaskCanceled(ExecutionContext*, void*);
 CORE_EXPORT void asyncTaskCanceledBreakable(ExecutionContext*,
                                             const char* name,
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl
index fe54000..9ed6f71 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl
@@ -169,7 +169,7 @@
     void didReceiveEncodedDataLength([Keep] LocalFrame*, unsigned long identifier, int encodedDataLength);
 
     [Network, TraceEvents]
-    void didFinishLoading(LocalFrame* frame, unsigned long identifier, double finishTime, int64_t encodedDataLength, int64_t decodedBodyLength);
+    void didFinishLoading([Keep] LocalFrame* frame, unsigned long identifier, double finishTime, int64_t encodedDataLength, int64_t decodedBodyLength);
 
     [Network]
     void didReceiveCORSRedirectResponse([Keep] LocalFrame*, unsigned long identifier, DocumentLoader*, const ResourceResponse&, Resource*);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
index 053130c..803e9d66 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.cpp
@@ -803,7 +803,8 @@
   m_resourcesData->addPendingEncodedDataLength(requestId, encodedDataLength);
 }
 
-void InspectorNetworkAgent::didFinishLoading(unsigned long identifier,
+void InspectorNetworkAgent::didFinishLoading(LocalFrame*,
+                                             unsigned long identifier,
                                              double monotonicFinishTime,
                                              int64_t encodedDataLength,
                                              int64_t decodedBodyLength) {
@@ -841,8 +842,8 @@
     Resource* resource) {
   // Update the response and finish loading
   didReceiveResourceResponse(frame, identifier, loader, response, resource);
-  didFinishLoading(identifier, 0, WebURLLoaderClient::kUnknownEncodedDataLength,
-                   0);
+  didFinishLoading(frame, identifier, 0,
+                   WebURLLoaderClient::kUnknownEncodedDataLength, 0);
 }
 
 void InspectorNetworkAgent::didFailLoading(unsigned long identifier,
diff --git a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h
index 8b7ab5a..d7861d1 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorNetworkAgent.h
@@ -100,7 +100,8 @@
   void didReceiveEncodedDataLength(LocalFrame*,
                                    unsigned long identifier,
                                    int encodedDataLength);
-  void didFinishLoading(unsigned long identifier,
+  void didFinishLoading(LocalFrame*,
+                        unsigned long identifier,
                         double monotonicFinishTime,
                         int64_t encodedDataLength,
                         int64_t decodedBodyLength);
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
index 41c59523..9cf27cb 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -115,7 +115,8 @@
       InspectorReceiveDataEvent::data(identifier, frame, encodedDataLength));
 }
 
-void InspectorTraceEvents::didFinishLoading(unsigned long identifier,
+void InspectorTraceEvents::didFinishLoading(LocalFrame* frame,
+                                            unsigned long identifier,
                                             double finishTime,
                                             int64_t encodedDataLength,
                                             int64_t decodedBodyLength) {
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
index 5fe45d7..bf79cae 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
@@ -93,7 +93,8 @@
                       unsigned long identifier,
                       const char* data,
                       int dataLength);
-  void didFinishLoading(unsigned long identifier,
+  void didFinishLoading(LocalFrame*,
+                        unsigned long identifier,
                         double monotonicFinishTime,
                         int64_t encodedDataLength,
                         int64_t decodedBodyLength);
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
index 8dd0dbe..4726e94 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -1376,7 +1376,7 @@
       pixelSnappedIntRect(layoutBox.overflowClipRect(LayoutPoint()));
 
   const TopDocumentRootScrollerController& globalRootScrollerController =
-      layoutBox.document().frameHost()->globalRootScrollerController();
+      layoutBox.document().page()->globalRootScrollerController();
 
   if (&m_owningLayer == globalRootScrollerController.rootScrollerPaintLayer()) {
     LayoutRect clipRect =
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
index 2153a447..08d08aa 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMappingTest.cpp
@@ -939,7 +939,7 @@
   NonThrowableExceptionState nonThrow;
 
   TopDocumentRootScrollerController& rootScrollerController =
-      document().frameHost()->globalRootScrollerController();
+      document().page()->globalRootScrollerController();
 
   setBodyInnerHTML(
       // The container DIV is composited with scrolling contents and a
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
index 9c48aa4..a2b984e 100644
--- a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -495,7 +495,7 @@
   }
 
   const TopDocumentRootScrollerController& globalRootScrollerController =
-      m_layoutView.document().frameHost()->globalRootScrollerController();
+      m_layoutView.document().page()->globalRootScrollerController();
 
   Element* documentElement = m_layoutView.document().documentElement();
   bool frameIsRootScroller =
@@ -640,7 +640,7 @@
   FrameView* frameView = m_layoutView.frameView();
 
   const TopDocumentRootScrollerController& globalRootScrollerController =
-      m_layoutView.document().frameHost()->globalRootScrollerController();
+      m_layoutView.document().page()->globalRootScrollerController();
 
   // The global root scroller must always size to the root FrameView.
   if (rootLayer() &&
diff --git a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
index 1abf9c82..5c08631 100644
--- a/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/RootScrollerController.cpp
@@ -6,11 +6,11 @@
 
 #include "core/dom/Document.h"
 #include "core/dom/Element.h"
-#include "core/frame/FrameHost.h"
 #include "core/frame/FrameView.h"
 #include "core/layout/LayoutBox.h"
 #include "core/layout/api/LayoutViewItem.h"
 #include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/page/Page.h"
 #include "core/page/scrolling/RootScrollerUtil.h"
 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
 #include "core/paint/PaintLayer.h"
@@ -122,8 +122,8 @@
         CompositingUpdateRebuildTree);
   }
 
-  if (FrameHost* frameHost = m_document->frameHost())
-    frameHost->globalRootScrollerController().didChangeRootScroller();
+  if (Page* page = m_document->page())
+    page->globalRootScrollerController().didChangeRootScroller();
 }
 
 bool RootScrollerController::isValidRootScroller(const Element& element) const {
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 7a2393b..291ea69 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -172,7 +172,7 @@
 
   box()
       .document()
-      .frameHost()
+      .page()
       ->globalRootScrollerController()
       .didDisposeScrollableArea(*this);
 
@@ -508,10 +508,10 @@
   IntSize visibleSize =
       pixelSnappedIntRect(box().overflowClipRect(box().location())).size();
 
-  FrameHost* host = layoutBox()->document().frameHost();
-  DCHECK(host);
+  Page* page = layoutBox()->document().page();
+  DCHECK(page);
   TopDocumentRootScrollerController& controller =
-      host->globalRootScrollerController();
+      page->globalRootScrollerController();
 
   // The global root scroller should be clipped by the top FrameView rather
   // than it's overflow clipping box. This is to ensure that content exposed by
@@ -1898,7 +1898,7 @@
     return false;
 
   const TopDocumentRootScrollerController& controller =
-      layoutBox()->document().frameHost()->globalRootScrollerController();
+      layoutBox()->document().page()->globalRootScrollerController();
 
   return RootScrollerUtil::scrollableAreaForRootScroller(
              controller.globalRootScroller()) == this;
diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
index 4bf634a..bbe53785f 100644
--- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
@@ -59,7 +59,7 @@
     std::unique_ptr<ExecutionContextTask> task,
     bool isInstrumented) {
   DCHECK(thread()->isCurrentThread());
-  probe::AsyncTask asyncTask(this, task.get(), isInstrumented);
+  probe::AsyncTask asyncTask(this, task.get(), nullptr, isInstrumented);
   task->performTask(this);
 }
 
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index bc4fc68..7a5f9b9 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -958,8 +958,7 @@
   // Also, only async requests support upload progress events.
   bool uploadEvents = false;
   if (m_async) {
-    probe::asyncTaskScheduled(&executionContext, "XMLHttpRequest.send", this,
-                              true);
+    probe::asyncTaskScheduled(&executionContext, "XMLHttpRequest.send", this);
     dispatchProgressEvent(EventTypeNames::loadstart, 0, 0);
     // Event handler could have invalidated this send operation,
     // (re)setting the send flag and/or initiating another send
@@ -1216,11 +1215,11 @@
       lengthComputable ? static_cast<unsigned long long>(expectedLength) : 0;
 
   ExecutionContext* context = getExecutionContext();
-  probe::AsyncTask asyncTask(context, this, m_async);
+  probe::AsyncTask asyncTask(
+      context, this, type == EventTypeNames::loadend ? nullptr : "progress",
+      m_async);
   m_progressEventThrottle->dispatchProgressEvent(type, lengthComputable, loaded,
                                                  total);
-  if (m_async && type == EventTypeNames::loadend)
-    probe::asyncTaskCanceled(context, this);
 }
 
 void XMLHttpRequest::dispatchProgressEventFromSnapshot(
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
index 8bf8019e..2ca947a 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestProgressEventThrottle.cpp
@@ -132,7 +132,7 @@
     // the event handler calls xhr.abort()). In such cases a
     // readystatechange should have been already dispatched if necessary.
     probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target,
-                               m_target->isAsync());
+                               "progress", m_target->isAsync());
     m_target->dispatchEvent(event);
   }
 }
@@ -146,7 +146,7 @@
                  InspectorXhrReadyStateChangeEvent::data(
                      m_target->getExecutionContext(), m_target));
     probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target,
-                               m_target->isAsync());
+                               "progress", m_target->isAsync());
     m_target->dispatchEvent(Event::create(EventTypeNames::readystatechange));
   }
 
@@ -155,7 +155,7 @@
 
   m_hasDispatchedProgressProgressEvent = true;
   probe::AsyncTask asyncTask(m_target->getExecutionContext(), m_target,
-                             m_target->isAsync());
+                             "progress", m_target->isAsync());
   m_target->dispatchEvent(progressEvent);
 }
 
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp
index 1822923..3656dcd 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequestUpload.cpp
@@ -52,7 +52,7 @@
   m_lastBytesSent = bytesSent;
   m_lastTotalBytesToBeSent = totalBytesToBeSent;
   probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest,
-                             m_xmlHttpRequest->isAsync());
+                             "progress", m_xmlHttpRequest->isAsync());
   dispatchEvent(ProgressEvent::create(EventTypeNames::progress, true, bytesSent,
                                       totalBytesToBeSent));
 }
@@ -63,7 +63,7 @@
                                                    unsigned long long total) {
   DCHECK(type == EventTypeNames::load || type == EventTypeNames::abort ||
          type == EventTypeNames::error || type == EventTypeNames::timeout);
-  probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest,
+  probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest, "event",
                              m_xmlHttpRequest->isAsync());
   dispatchEvent(
       ProgressEvent::create(type, lengthComputable, bytesSent, total));
@@ -74,7 +74,7 @@
 void XMLHttpRequestUpload::handleRequestError(const AtomicString& type) {
   bool lengthComputable = m_lastTotalBytesToBeSent > 0 &&
                           m_lastBytesSent <= m_lastTotalBytesToBeSent;
-  probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest,
+  probe::AsyncTask asyncTask(getExecutionContext(), m_xmlHttpRequest, "error",
                              m_xmlHttpRequest->isAsync());
   dispatchEvent(ProgressEvent::create(EventTypeNames::progress,
                                       lengthComputable, m_lastBytesSent,
diff --git a/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js b/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js
index 7c1c6e9..f772bad 100644
--- a/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js
+++ b/third_party/WebKit/Source/devtools/front_end/perf_ui/FlameChart.js
@@ -955,29 +955,44 @@
     context.scale(ratio, ratio);
     context.translate(0, -top);
 
-    context.fillStyle = '#7f0000';
-    context.strokeStyle = '#7f0000';
+    context.fillStyle = '#7f5050';
+    context.strokeStyle = '#7f5050';
     var td = this._timelineData();
     var endIndex = td.flowStartTimes.lowerBound(this._timeWindowRight);
 
     context.lineWidth = 0.5;
     for (var i = 0; i < endIndex; ++i) {
-      if (td.flowEndTimes[i] < this._timeWindowLeft)
+      if (!td.flowEndTimes[i] || td.flowEndTimes[i] < this._timeWindowLeft)
         continue;
       var startX = this._timeToPosition(td.flowStartTimes[i]);
       var endX = this._timeToPosition(td.flowEndTimes[i]);
       var startY = this._levelToHeight(td.flowStartLevels[i]) + this._barHeight / 2;
       var endY = this._levelToHeight(td.flowEndLevels[i]) + this._barHeight / 2;
-      var distance = (endY - startY) / 10;
-      var spread = 30;
-      var lineY = spread + Math.max(0, startY + distance * (i % spread));
+
 
       var segment = Math.min((endX - startX) / 4, 40);
+      var distanceTime = td.flowEndTimes[i] - td.flowStartTimes[i];
+      var distanceY = (endY - startY) / 10;
+      var spread = 30;
+      var lineY = distanceTime < 1 ? startY : spread + Math.max(0, startY + distanceY * (i % spread));
+
+      var p = [];
+      p.push({x: startX, y: startY});
+      p.push({x: startX + arrowWidth, y: startY});
+      p.push({x: startX + segment + 2 * arrowWidth, y: startY});
+      p.push({x: startX + segment, y: lineY});
+      p.push({x: startX + segment * 2, y: lineY});
+      p.push({x: endX - segment * 2, y: lineY});
+      p.push({x: endX - segment, y: lineY});
+      p.push({x: endX - segment - 2 * arrowWidth, y: endY});
+      p.push({x: endX - arrowWidth, y: endY});
+
       context.beginPath();
-      context.moveTo(startX, startY);
-      context.bezierCurveTo(startX + segment, startY, startX + segment, lineY, startX + segment * 2, lineY);
-      context.lineTo(endX - segment * 2, lineY);
-      context.bezierCurveTo(endX - segment, lineY, endX - segment, endY, endX - arrowWidth, endY);
+      context.moveTo(p[0].x, p[0].y);
+      context.lineTo(p[1].x, p[1].y);
+      context.bezierCurveTo(p[2].x, p[2].y, p[3].x, p[3].y, p[4].x, p[4].y);
+      context.lineTo(p[5].x, p[5].y);
+      context.bezierCurveTo(p[6].x, p[6].y, p[7].x, p[7].y, p[8].x, p[8].y);
       context.stroke();
 
       context.beginPath();
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
index e85439f..ceb1b1e 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -337,7 +337,8 @@
       var level = this._currentLevel + openEvents.length;
       if (flowEventsEnabled)
         this._appendFlowEvent(e, level);
-      this._appendEvent(e, level);
+      if (e.phase !== SDK.TracingModel.Phase.FlowEnd)
+        this._appendEvent(e, level);
       if (!isExtension && TimelineModel.TimelineModel.isMarkerEvent(e))
         this._timelineData.entryTotalTimes[this._entryData.length] = undefined;
 
@@ -768,7 +769,6 @@
         this._flowEventIndexById.set(event.id, pushStartFlow(event));
         break;
       case SDK.TracingModel.Phase.FlowEnd:
-        pushEndFlow(event, this._flowEventIndexById.get(event.id));
         this._flowEventIndexById.delete(event.id);
         break;
     }
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
index 1d4adcf..ad1511c 100644
--- a/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BytesConsumer.cpp
@@ -172,7 +172,7 @@
       m_offset += read;
       if (chunk->size() == m_offset) {
         m_offset = 0;
-        m_chunks.removeFirst();
+        m_chunks.pop_front();
       }
       if (m_chunks.isEmpty() &&
           m_tee->getPublicState() == PublicState::Closed) {
diff --git a/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.cpp
index c33eab2..dd3b860d 100644
--- a/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.cpp
+++ b/third_party/WebKit/Source/modules/fetch/BytesConsumerTestUtil.cpp
@@ -60,17 +60,17 @@
       *available = command.body().size() - m_offset;
       return Result::Ok;
     case Command::Done:
-      m_commands.removeFirst();
+      m_commands.pop_front();
       close();
       return Result::Done;
     case Command::Error: {
       Error e(String::fromUTF8(command.body().data(), command.body().size()));
-      m_commands.removeFirst();
+      m_commands.pop_front();
       error(std::move(e));
       return Result::Error;
     }
     case Command::Wait:
-      m_commands.removeFirst();
+      m_commands.pop_front();
       m_state = InternalState::Waiting;
       TaskRunnerHelper::get(TaskType::Networking, m_executionContext)
           ->postTask(BLINK_FROM_HERE,
@@ -92,7 +92,7 @@
     return Result::Ok;
 
   m_offset = 0;
-  m_commands.removeFirst();
+  m_commands.pop_front();
   return Result::Ok;
 }
 
diff --git a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
index 1e1fe382..e1861a1 100644
--- a/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
+++ b/third_party/WebKit/Source/modules/fetch/DataConsumerHandleTestUtil.cpp
@@ -217,7 +217,7 @@
   bool fullyConsumed = (size + m_offset >= top().body().size());
   if (fullyConsumed) {
     m_offset = 0;
-    m_commands.removeFirst();
+    m_commands.pop_front();
   } else {
     m_offset += size;
   }
diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
index d93aed6..74fdeed 100644
--- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
+++ b/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
@@ -60,8 +60,7 @@
   if (!executionContext)
     return;
   DCHECK(executionContext->isContextThread());
-  probe::AsyncTask asyncTask(executionContext, task.get(),
-                             true /* isInstrumented */);
+  probe::AsyncTask asyncTask(executionContext, task.get());
   (*task)();
 }
 
diff --git a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
index 9ee8d79..484478c9 100644
--- a/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/WebIDBCallbacksImpl.cpp
@@ -63,7 +63,7 @@
 WebIDBCallbacksImpl::WebIDBCallbacksImpl(IDBRequest* request)
     : m_request(request) {
   probe::asyncTaskScheduled(m_request->getExecutionContext(),
-                            IndexedDBNames::IndexedDB, this, true);
+                            IndexedDBNames::IndexedDB, this);
 }
 
 WebIDBCallbacksImpl::~WebIDBCallbacksImpl() {
@@ -77,7 +77,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "error");
   m_request->onError(DOMException::create(error.code(), error.message()));
 }
 
@@ -88,7 +88,7 @@
   Vector<String> stringList;
   for (size_t i = 0; i < webStringList.size(); ++i)
     stringList.push_back(webStringList[i]);
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess(stringList);
 }
 
@@ -99,7 +99,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess(WTF::wrapUnique(cursor), key, primaryKey,
                        IDBValue::create(value, m_request->isolate()));
 }
@@ -108,7 +108,8 @@
                                     const WebIDBMetadata& metadata) {
   std::unique_ptr<WebIDBDatabase> db = WTF::wrapUnique(backend);
   if (m_request) {
-    probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+    probe::AsyncTask asyncTask(m_request->getExecutionContext(), this,
+                               "success");
     m_request->onSuccess(std::move(db), IDBDatabaseMetadata(metadata));
   } else if (db) {
     db->close();
@@ -119,7 +120,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess(key);
 }
 
@@ -127,7 +128,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess(IDBValue::create(value, m_request->isolate()));
 }
 
@@ -135,7 +136,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   Vector<RefPtr<IDBValue>> idbValues(values.size());
   for (size_t i = 0; i < values.size(); ++i)
     idbValues[i] = IDBValue::create(values[i], m_request->isolate());
@@ -146,7 +147,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess(value);
 }
 
@@ -154,7 +155,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess();
 }
 
@@ -164,7 +165,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "success");
   m_request->onSuccess(key, primaryKey,
                        IDBValue::create(value, m_request->isolate()));
 }
@@ -173,7 +174,7 @@
   if (!m_request)
     return;
 
-  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_request->getExecutionContext(), this, "blocked");
   m_request->onBlocked(oldVersion);
 }
 
@@ -184,7 +185,8 @@
                                           WebString dataLossMessage) {
   std::unique_ptr<WebIDBDatabase> db = WTF::wrapUnique(database);
   if (m_request) {
-    probe::AsyncTask asyncTask(m_request->getExecutionContext(), this);
+    probe::AsyncTask asyncTask(m_request->getExecutionContext(), this,
+                               "upgradeNeeded");
     m_request->onUpgradeNeeded(
         oldVersion, std::move(db), IDBDatabaseMetadata(metadata),
         static_cast<WebIDBDataLoss>(dataLoss), dataLossMessage);
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
index 02225b119..0777b002 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.cpp
@@ -167,10 +167,6 @@
   m_component->setContentHint(translatedHint);
 }
 
-bool MediaStreamTrack::remote() const {
-  return m_component->source()->remote();
-}
-
 String MediaStreamTrack::readyState() const {
   if (ended())
     return "ended";
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h
index 3831590..911e64e 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h
+++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.h
@@ -60,7 +60,6 @@
   String kind() const;
   String id() const;
   String label() const;
-  bool remote() const;
 
   bool enabled() const;
   void setEnabled(bool);
diff --git a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.idl b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.idl
index b87e17e..175801f 100644
--- a/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.idl
+++ b/third_party/WebKit/Source/modules/mediastream/MediaStreamTrack.idl
@@ -51,8 +51,4 @@
     [ImplementedAs=stopTrack, RaisesException] void stop();
     [RuntimeEnabled=MediaConstraints] MediaTrackConstraints getConstraints();
     [RuntimeEnabled=MediaGetSettings] MediaTrackSettings getSettings();
-
-
-    // Non-standard APIs
-    [MeasureAs=MediaStreamTrackRemote] readonly attribute boolean remote;
 };
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
index d06f09e..6e269ae 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -319,14 +319,14 @@
     switch (message->type) {
       case MessageTypeText:
         client->sendString(m_url, m_id, message->text, m_proxy.get());
-        m_messages.removeFirst();
+        m_messages.pop_front();
         break;
       case MessageTypeArrayBuffer:
         client->sendArrayBuffer(
             m_url, m_id,
             static_cast<const uint8_t*>(message->arrayBuffer->data()),
             message->arrayBuffer->byteLength(), m_proxy.get());
-        m_messages.removeFirst();
+        m_messages.pop_front();
         break;
       case MessageTypeBlob:
         ASSERT(!m_blobLoader);
@@ -483,7 +483,7 @@
                          buffer->byteLength(), m_proxy.get());
   }
 
-  m_messages.removeFirst();
+  m_messages.pop_front();
   m_blobLoader.clear();
   handleMessageQueue();
 }
@@ -493,7 +493,7 @@
   ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
   // FIXME: generate error message?
   // Ignore the current failed blob item and continue with next items.
-  m_messages.removeFirst();
+  m_messages.pop_front();
   m_blobLoader.clear();
   handleMessageQueue();
 }
diff --git a/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp b/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp
index 50d0463d..bfcc6df 100644
--- a/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp
+++ b/third_party/WebKit/Source/modules/speech/SpeechSynthesis.cpp
@@ -144,7 +144,7 @@
   // If the utterance that completed was the one we're currently speaking,
   // remove it from the queue and start speaking the next one.
   if (utterance == currentSpeechUtterance()) {
-    m_utteranceQueue.removeFirst();
+    m_utteranceQueue.pop_front();
     shouldStartSpeaking = !!m_utteranceQueue.size();
   }
 
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
index b76b550..6c1d9de 100644
--- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioDestinationNode.cpp
@@ -52,8 +52,8 @@
                                 AudioUtilities::kRenderQuantumFrames)) {
   m_source = MediaStreamSource::create(
       "WebAudio-" + createCanonicalUUIDString(), MediaStreamSource::TypeAudio,
-      "MediaStreamAudioDestinationNode", false,
-      MediaStreamSource::ReadyStateLive, true);
+      "MediaStreamAudioDestinationNode", MediaStreamSource::ReadyStateLive,
+      true);
   MediaStreamSourceVector audioSources;
   audioSources.push_back(m_source.get());
   MediaStreamSourceVector videoSources;
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
index 6efdaece..a7776fd 100644
--- a/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransaction.cpp
@@ -72,8 +72,7 @@
       m_readOnly(readOnly) {
   DCHECK(isMainThread());
   ASSERT(m_database);
-  probe::asyncTaskScheduled(db->getExecutionContext(), "SQLTransaction", this,
-                            true);
+  probe::asyncTaskScheduled(db->getExecutionContext(), "SQLTransaction", this);
 }
 
 SQLTransaction::~SQLTransaction() {}
@@ -153,7 +152,8 @@
 
 SQLTransactionState SQLTransaction::deliverTransactionCallback() {
   bool shouldDeliverErrorCallback = false;
-  probe::AsyncTask asyncTask(m_database->getExecutionContext(), this);
+  probe::AsyncTask asyncTask(m_database->getExecutionContext(), this,
+                             "transaction");
 
   // Spec 4.3.2 4: Invoke the transaction callback with the new SQLTransaction
   // object.
@@ -179,7 +179,6 @@
 
 SQLTransactionState SQLTransaction::deliverTransactionErrorCallback() {
   probe::AsyncTask asyncTask(m_database->getExecutionContext(), this);
-  probe::asyncTaskCanceled(m_database->getExecutionContext(), this);
 
   // Spec 4.3.2.10: If exists, invoke error callback with the last
   // error to have occurred in this transaction.
@@ -243,7 +242,6 @@
 SQLTransactionState SQLTransaction::deliverSuccessCallback() {
   DCHECK(isMainThread());
   probe::AsyncTask asyncTask(m_database->getExecutionContext(), this);
-  probe::asyncTaskCanceled(m_database->getExecutionContext(), this);
 
   // Spec 4.3.2.8: Deliver success callback.
   if (VoidCallback* successCallback = m_successCallback.release())
diff --git a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp
index 90df91b..9e8b2ee6 100644
--- a/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp
+++ b/third_party/WebKit/Source/modules/webdatabase/SQLTransactionCoordinator.cpp
@@ -62,7 +62,7 @@
     } while (!info.pendingTransactions.isEmpty() &&
              info.pendingTransactions.first()->isReadOnly());
   } else if (info.activeReadTransactions.isEmpty()) {
-    info.pendingTransactions.removeFirst();
+    info.pendingTransactions.pop_front();
     info.activeWriteTransaction = firstPendingTransaction;
     firstPendingTransaction->lockAcquired();
   }
diff --git a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
index 99a715d..82f47cd 100644
--- a/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
+++ b/third_party/WebKit/Source/modules/websockets/DocumentWebSocketChannel.cpp
@@ -388,7 +388,7 @@
   *consumedBufferedAmount += size;
 
   if (final) {
-    m_messages.removeFirst();
+    m_messages.pop_front();
     m_sentSizeOfTopMessage = 0;
   }
 }
@@ -430,7 +430,7 @@
         DCHECK_EQ(m_messages.size(), 1u);
         DCHECK_EQ(m_sentSizeOfTopMessage, 0u);
         m_handle->close(message->code, message->reason);
-        m_messages.removeFirst();
+        m_messages.pop_front();
         break;
       }
     }
diff --git a/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp b/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp
index 6568102..56e5e5a70 100644
--- a/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp
+++ b/third_party/WebKit/Source/platform/exported/WebMediaStreamSource.cpp
@@ -91,15 +91,7 @@
                                       Type type,
                                       const WebString& name) {
   m_private = MediaStreamSource::create(
-      id, static_cast<MediaStreamSource::StreamType>(type), name, false);
-}
-
-void WebMediaStreamSource::initialize(const WebString& id,
-                                      Type type,
-                                      const WebString& name,
-                                      bool remote) {
-  m_private = MediaStreamSource::create(
-      id, static_cast<MediaStreamSource::StreamType>(type), name, remote);
+      id, static_cast<MediaStreamSource::StreamType>(type), name);
 }
 
 WebString WebMediaStreamSource::id() const {
@@ -117,11 +109,6 @@
   return m_private.get()->name();
 }
 
-bool WebMediaStreamSource::remote() const {
-  ASSERT(!m_private.isNull());
-  return m_private.get()->remote();
-}
-
 void WebMediaStreamSource::setReadyState(ReadyState state) {
   ASSERT(!m_private.isNull());
   m_private->setReadyState(static_cast<MediaStreamSource::ReadyState>(state));
diff --git a/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp b/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp
index 3fe9b6f..d9cf272 100644
--- a/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp
+++ b/third_party/WebKit/Source/platform/fonts/ScriptRunIterator.cpp
@@ -177,7 +177,7 @@
 
 void ScriptRunIterator::openBracket(UChar32 ch) {
   if (m_brackets.size() == kMaxBrackets) {
-    m_brackets.removeFirst();
+    m_brackets.pop_front();
     if (m_bracketsFixupDepth == kMaxBrackets) {
       --m_bracketsFixupDepth;
     }
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp
index f43d5588..703f31b 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedContextRateLimiter.cpp
@@ -57,7 +57,7 @@
       GLuint result;
       gl->GetQueryObjectuivEXT(m_queries.first(), GL_QUERY_RESULT_EXT, &result);
       gl->DeleteQueriesEXT(1, &m_queries.first());
-      m_queries.removeFirst();
+      m_queries.pop_front();
     } else {
       gl->Finish();
       reset();
@@ -73,7 +73,7 @@
   if (gl && gl->GetGraphicsResetStatusKHR() == GL_NO_ERROR) {
     while (m_queries.size() > 0) {
       gl->DeleteQueriesEXT(1, &m_queries.first());
-      m_queries.removeFirst();
+      m_queries.pop_front();
     }
   } else {
     m_queries.clear();
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp
index c658901..e1ba1aa0 100644
--- a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp
+++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp
@@ -35,23 +35,19 @@
 MediaStreamSource* MediaStreamSource::create(const String& id,
                                              StreamType type,
                                              const String& name,
-                                             bool remote,
                                              ReadyState readyState,
                                              bool requiresConsumer) {
-  return new MediaStreamSource(id, type, name, remote, readyState,
-                               requiresConsumer);
+  return new MediaStreamSource(id, type, name, readyState, requiresConsumer);
 }
 
 MediaStreamSource::MediaStreamSource(const String& id,
                                      StreamType type,
                                      const String& name,
-                                     bool remote,
                                      ReadyState readyState,
                                      bool requiresConsumer)
     : m_id(id),
       m_type(type),
       m_name(name),
-      m_remote(remote),
       m_readyState(readyState),
       m_requiresConsumer(requiresConsumer) {}
 
diff --git a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h
index 010dfbe..d05fc45e6 100644
--- a/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h
+++ b/third_party/WebKit/Source/platform/mediastream/MediaStreamSource.h
@@ -71,7 +71,6 @@
   static MediaStreamSource* create(const String& id,
                                    StreamType,
                                    const String& name,
-                                   bool remote,
                                    ReadyState = ReadyStateLive,
                                    bool requiresConsumer = false);
 
@@ -80,7 +79,6 @@
   const String& id() const { return m_id; }
   StreamType type() const { return m_type; }
   const String& name() const { return m_name; }
-  bool remote() const { return m_remote; }
 
   void setReadyState(ReadyState);
   ReadyState getReadyState() const { return m_readyState; }
@@ -118,14 +116,12 @@
   MediaStreamSource(const String& id,
                     StreamType,
                     const String& name,
-                    bool remote,
                     ReadyState,
                     bool requiresConsumer);
 
   String m_id;
   StreamType m_type;
   String m_name;
-  bool m_remote;
   ReadyState m_readyState;
   bool m_requiresConsumer;
   HeapHashSet<WeakMember<Observer>> m_observers;
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 91cd671..0d1daa1 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -3831,7 +3831,7 @@
 
   // Get the outer viewport scroll layer.
   GraphicsLayer* layoutViewportScrollLayer =
-      page()->frameHost().globalRootScrollerController().rootScrollerLayer();
+      page()->globalRootScrollerController().rootScrollerLayer();
   WebLayer* layoutViewportWebLayer =
       layoutViewportScrollLayer ? layoutViewportScrollLayer->platformLayer()
                                 : nullptr;
diff --git a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
index 231e2ca2..8a75f24 100644
--- a/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
+++ b/third_party/WebKit/Source/web/tests/RootScrollerTest.cpp
@@ -524,7 +524,7 @@
   Element* container = iframe->contentDocument()->getElementById("container");
 
   const TopDocumentRootScrollerController& mainController =
-      mainFrame()->document()->frameHost()->globalRootScrollerController();
+      mainFrame()->document()->page()->globalRootScrollerController();
 
   NonThrowableExceptionState nonThrow;
 
@@ -762,7 +762,7 @@
   RootScrollerController& childController =
       iframe->contentDocument()->rootScrollerController();
   TopDocumentRootScrollerController& globalController =
-      frameHost().globalRootScrollerController();
+      page().globalRootScrollerController();
 
   LayoutView* mainLayoutView = mainFrameView()->layoutView();
   LayoutView* childLayoutView = iframe->contentDocument()->layoutView();
@@ -1092,7 +1092,7 @@
   executeScript("document.documentElement.style.display = 'none';");
 
   const TopDocumentRootScrollerController& globalController =
-      mainFrame()->document()->frameHost()->globalRootScrollerController();
+      mainFrame()->document()->page()->globalRootScrollerController();
 
   EXPECT_EQ(mainFrame()->document()->documentElement(),
             globalController.globalRootScroller());
diff --git a/third_party/WebKit/Source/wtf/Deque.h b/third_party/WebKit/Source/wtf/Deque.h
index 7d3689a..8a3acd686 100644
--- a/third_party/WebKit/Source/wtf/Deque.h
+++ b/third_party/WebKit/Source/wtf/Deque.h
@@ -127,7 +127,6 @@
 
   template <typename U>
   void prepend(U&&);
-  void removeFirst();
   void remove(iterator&);
   void remove(const_iterator&);
 
@@ -139,7 +138,7 @@
     prepend(std::forward<U>(u));
   }
   void pop_back();
-  void pop_front() { removeFirst(); }
+  void pop_front();
   bool empty() const { return isEmpty(); }
   T& front() { return first(); }
   const T& front() const { return first(); }
@@ -486,7 +485,7 @@
 template <typename T, size_t inlineCapacity, typename Allocator>
 inline T Deque<T, inlineCapacity, Allocator>::takeFirst() {
   T oldFirst = std::move(first());
-  removeFirst();
+  pop_front();
   return oldFirst;
 }
 
@@ -544,7 +543,7 @@
 }
 
 template <typename T, size_t inlineCapacity, typename Allocator>
-inline void Deque<T, inlineCapacity, Allocator>::removeFirst() {
+inline void Deque<T, inlineCapacity, Allocator>::pop_front() {
   DCHECK(!isEmpty());
   TypeOperations::destruct(&m_buffer.buffer()[m_start],
                            &m_buffer.buffer()[m_start + 1]);
diff --git a/third_party/WebKit/Source/wtf/DequeTest.cpp b/third_party/WebKit/Source/wtf/DequeTest.cpp
index ef0da37..f3a8873 100644
--- a/third_party/WebKit/Source/wtf/DequeTest.cpp
+++ b/third_party/WebKit/Source/wtf/DequeTest.cpp
@@ -204,13 +204,13 @@
   EXPECT_EQ(0, destructNumber);
 
   EXPECT_EQ(0, deque.first()->get());
-  deque.removeFirst();
+  deque.pop_front();
   EXPECT_EQ(1, deque.first()->get());
   EXPECT_EQ(1u, deque.size());
   EXPECT_EQ(1, destructNumber);
 
   std::unique_ptr<DestructCounter> ownCounter1 = std::move(deque.first());
-  deque.removeFirst();
+  deque.pop_front();
   EXPECT_EQ(counter1, ownCounter1->get());
   EXPECT_EQ(0u, deque.size());
   EXPECT_EQ(1, destructNumber);
@@ -411,7 +411,7 @@
       EXPECT_EQ(j, LivenessCounter::s_live);
       EXPECT_EQ(j, deque.size());
       for (unsigned k = 0; k < i; k++)
-        deque.removeFirst();
+        deque.pop_front();
 
       EXPECT_EQ(j - i, LivenessCounter::s_live);
       EXPECT_EQ(j - i, deque.size());
@@ -439,7 +439,7 @@
         EXPECT_EQ(j - i, deque.size());
         EXPECT_EQ(3u, deque2.size());
 
-        deque2.removeFirst();
+        deque2.pop_front();
         deque2.push_back(&counter);
       }
     }
@@ -526,7 +526,7 @@
   EXPECT_EQ(2, *last);
 
   EXPECT_EQ(2u, deque.size());
-  deque.removeFirst();
+  deque.pop_front();
   deque.pop_back();
   EXPECT_EQ(0u, deque.size());
 
diff --git a/third_party/WebKit/public/platform/WebMediaStreamSource.h b/third_party/WebKit/public/platform/WebMediaStreamSource.h
index 4f6f2418..23a63c7 100644
--- a/third_party/WebKit/public/platform/WebMediaStreamSource.h
+++ b/third_party/WebKit/public/platform/WebMediaStreamSource.h
@@ -88,18 +88,13 @@
 
   BLINK_PLATFORM_EXPORT void initialize(const WebString& id,
                                         Type,
-                                        const WebString& name);  // DEPRECATED
-  BLINK_PLATFORM_EXPORT void initialize(const WebString& id,
-                                        Type,
-                                        const WebString& name,
-                                        bool remote);
+                                        const WebString& name);
   BLINK_PLATFORM_EXPORT void reset();
   bool isNull() const { return m_private.isNull(); }
 
   BLINK_PLATFORM_EXPORT WebString id() const;
   BLINK_PLATFORM_EXPORT Type getType() const;
   BLINK_PLATFORM_EXPORT WebString name() const;
-  BLINK_PLATFORM_EXPORT bool remote() const;
 
   BLINK_PLATFORM_EXPORT void setReadyState(ReadyState);
   BLINK_PLATFORM_EXPORT ReadyState getReadyState() const;
diff --git a/ui/events/android/motion_event_android.cc b/ui/events/android/motion_event_android.cc
index 4af424d..3a8b35a2 100644
--- a/ui/events/android/motion_event_android.cc
+++ b/ui/events/android/motion_event_android.cc
@@ -233,16 +233,17 @@
       cached_flags_(e.cached_flags_),
       cached_raw_position_offset_(e.cached_raw_position_offset_),
       unique_event_id_(ui::GetNextTouchEventId()) {
-  for (size_t i = 0; i < cached_pointer_count_; i++)
-    cached_pointers_[i] = e.cached_pointers_[i];
+  cached_pointers_[0] = e.cached_pointers_[0];
+  if (cached_pointer_count_ > 1)
+    cached_pointers_[1] = e.cached_pointers_[1];
 }
 
 std::unique_ptr<MotionEventAndroid> MotionEventAndroid::Offset(float x,
                                                                float y) const {
   std::unique_ptr<MotionEventAndroid> event(new MotionEventAndroid(*this));
-  for (size_t i = 0; i < cached_pointer_count_; i++) {
-    event->cached_pointers_[i] = OffsetCachedPointer(cached_pointers_[i], x, y);
-  }
+  event->cached_pointers_[0] = OffsetCachedPointer(cached_pointers_[0], x, y);
+  if (cached_pointer_count_ > 1)
+    event->cached_pointers_[1] = OffsetCachedPointer(cached_pointers_[1], x, y);
   return event;
 }
 
diff --git a/ui/gl/BUILD.gn b/ui/gl/BUILD.gn
index 495eded..37596e8 100644
--- a/ui/gl/BUILD.gn
+++ b/ui/gl/BUILD.gn
@@ -234,6 +234,8 @@
       "gl_bindings_autogen_wgl.h",
       "gl_context_wgl.cc",
       "gl_context_wgl.h",
+      "gl_image_dxgi.cc",
+      "gl_image_dxgi.h",
       "gl_surface_osmesa_win.cc",
       "gl_surface_osmesa_win.h",
       "gl_surface_wgl.cc",
diff --git a/ui/gl/gl_image.h b/ui/gl/gl_image.h
index 4468019..f0d0842 100644
--- a/ui/gl/gl_image.h
+++ b/ui/gl/gl_image.h
@@ -86,10 +86,7 @@
   virtual bool EmulatingRGB() const;
 
   // An identifier for subclasses. Necessary for safe downcasting.
-  enum class Type {
-    NONE,
-    IOSURFACE
-  };
+  enum class Type { NONE, IOSURFACE, DXGI_IMAGE };
   virtual Type GetType() const;
 
  protected:
diff --git a/ui/gl/gl_image_dxgi.cc b/ui/gl/gl_image_dxgi.cc
new file mode 100644
index 0000000..2960a6b
--- /dev/null
+++ b/ui/gl/gl_image_dxgi.cc
@@ -0,0 +1,79 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gl/gl_image_dxgi.h"
+
+#include "third_party/khronos/EGL/egl.h"
+#include "third_party/khronos/EGL/eglext.h"
+#include "ui/gl/gl_bindings.h"
+#include "ui/gl/gl_image.h"
+#include "ui/gl/gl_surface_egl.h"
+
+namespace gl {
+
+GLImageDXGI::GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream)
+    : size_(size), stream_(stream) {}
+
+// static
+GLImageDXGI* GLImageDXGI::FromGLImage(GLImage* image) {
+  if (!image || image->GetType() != Type::DXGI_IMAGE)
+    return nullptr;
+  return static_cast<GLImageDXGI*>(image);
+}
+
+gfx::Size GLImageDXGI::GetSize() {
+  return size_;
+}
+
+unsigned GLImageDXGI::GetInternalFormat() {
+  return GL_BGRA_EXT;
+}
+
+bool GLImageDXGI::BindTexImage(unsigned target) {
+  return false;
+}
+
+void GLImageDXGI::ReleaseTexImage(unsigned target) {}
+
+bool GLImageDXGI::CopyTexImage(unsigned target) {
+  return false;
+}
+
+bool GLImageDXGI::CopyTexSubImage(unsigned target,
+                                  const gfx::Point& offset,
+                                  const gfx::Rect& rect) {
+  return false;
+}
+
+bool GLImageDXGI::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
+                                       int z_order,
+                                       gfx::OverlayTransform transform,
+                                       const gfx::Rect& bounds_rect,
+                                       const gfx::RectF& crop_rect) {
+  return false;
+}
+
+void GLImageDXGI::Flush() {}
+
+void GLImageDXGI::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
+                               uint64_t process_tracing_id,
+                               const std::string& dump_name) {}
+
+GLImage::Type GLImageDXGI::GetType() const {
+  return Type::DXGI_IMAGE;
+}
+
+void GLImageDXGI::SetTexture(
+    const base::win::ScopedComPtr<ID3D11Texture2D>& texture,
+    size_t level) {
+  texture_ = texture;
+  level_ = level;
+}
+
+GLImageDXGI::~GLImageDXGI() {
+  EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay();
+  eglDestroyStreamKHR(egl_display, stream_);
+}
+
+}  // namespace gl
diff --git a/ui/gl/gl_image_dxgi.h b/ui/gl/gl_image_dxgi.h
new file mode 100644
index 0000000..10d5b24
--- /dev/null
+++ b/ui/gl/gl_image_dxgi.h
@@ -0,0 +1,59 @@
+// 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 <d3d11.h>
+
+#include "base/win/scoped_comptr.h"
+#include "third_party/khronos/EGL/egl.h"
+#include "third_party/khronos/EGL/eglext.h"
+#include "ui/gl/gl_export.h"
+#include "ui/gl/gl_image.h"
+
+namespace gl {
+
+class GL_EXPORT GLImageDXGI : public GLImage {
+ public:
+  GLImageDXGI(const gfx::Size& size, EGLStreamKHR stream);
+
+  // Safe downcast. Returns nullptr on failure.
+  static GLImageDXGI* FromGLImage(GLImage* image);
+
+  // GLImage implementation.
+  gfx::Size GetSize() override;
+  unsigned GetInternalFormat() override;
+  bool BindTexImage(unsigned target) override;
+  void ReleaseTexImage(unsigned target) override;
+  bool CopyTexImage(unsigned target) override;
+  bool CopyTexSubImage(unsigned target,
+                       const gfx::Point& offset,
+                       const gfx::Rect& rect) override;
+  bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
+                            int z_order,
+                            gfx::OverlayTransform transform,
+                            const gfx::Rect& bounds_rect,
+                            const gfx::RectF& crop_rect) override;
+  void Flush() override;
+  void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
+                    uint64_t process_tracing_id,
+                    const std::string& dump_name) override;
+  Type GetType() const override;
+
+  void SetTexture(const base::win::ScopedComPtr<ID3D11Texture2D>& texture,
+                  size_t level);
+
+  base::win::ScopedComPtr<ID3D11Texture2D> texture() { return texture_; }
+  size_t level() const { return level_; }
+
+ protected:
+  ~GLImageDXGI() override;
+
+ private:
+  gfx::Size size_;
+
+  EGLStreamKHR stream_;
+
+  base::win::ScopedComPtr<ID3D11Texture2D> texture_;
+  size_t level_ = 0;
+};
+}
diff --git a/ui/views/layout/grid_layout.cc b/ui/views/layout/grid_layout.cc
index 4ff22d5..135fe19 100644
--- a/ui/views/layout/grid_layout.cc
+++ b/ui/views/layout/grid_layout.cc
@@ -820,6 +820,11 @@
 
 void GridLayout::SizeRowsAndColumns(bool layout, int width, int height,
                                     gfx::Size* pref) const {
+  // Protect against clients asking for metrics during the addition of a View.
+  // The View is in the hierarchy, but it will not be accounted for in the
+  // layout calculations at this point, so the result will be incorrect.
+  DCHECK(!adding_view_) << "GridLayout queried while adding a view.";
+
   // Make sure the master columns have been calculated.
   CalculateMasterColumnsIfNecessary();
   pref->SetSize(0, 0);
diff --git a/ui/views/layout/grid_layout_unittest.cc b/ui/views/layout/grid_layout_unittest.cc
index 0d9dc06..35cc80b 100644
--- a/ui/views/layout/grid_layout_unittest.cc
+++ b/ui/views/layout/grid_layout_unittest.cc
@@ -5,6 +5,7 @@
 #include "ui/views/layout/grid_layout.h"
 
 #include "base/compiler_specific.h"
+#include "base/test/gtest_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "ui/views/view.h"
 
@@ -34,6 +35,36 @@
   DISALLOW_COPY_AND_ASSIGN(SettableSizeView);
 };
 
+// A test view that wants to alter its preferred size and re-layout when it gets
+// added to the View hierarchy.
+class LayoutOnAddView : public SettableSizeView {
+ public:
+  LayoutOnAddView() : SettableSizeView(gfx::Size(10, 10)) {}
+
+  void set_target_size(const gfx::Size& target_size) {
+    target_size_ = target_size;
+  }
+
+  // View:
+  void ViewHierarchyChanged(
+      const ViewHierarchyChangedDetails& details) override {
+    if (GetPreferredSize() == target_size_)
+      return;
+
+    // Contrive a realistic thing that a View might what to do, but which would
+    // break the layout machinery. Note an override of OnNativeThemeChanged()
+    // would be more compelling, but there is no Widget in this test harness.
+    set_pref(target_size_);
+    PreferredSizeChanged();
+    parent()->Layout();
+  }
+
+ private:
+  gfx::Size target_size_;
+
+  DISALLOW_COPY_AND_ASSIGN(LayoutOnAddView);
+};
+
 // A view with fixed circumference that trades height for width.
 class FlexibleView : public View {
  public:
@@ -737,4 +768,29 @@
   RemoveAll();
 }
 
+// Test that attempting a Layout() while nested in AddView() causes a DCHECK.
+// GridLayout must guard against this as it hasn't yet updated the internal
+// structures it uses to calculate Layout, so will give bogus results.
+TEST_F(GridLayoutTest, LayoutOnAddDeath) {
+  // Don't use the |layout| data member from the test harness, otherwise
+  // SetLayoutManager() can take not take ownership.
+  GridLayout* grid_layout = new GridLayout(&host);
+  host.SetLayoutManager(grid_layout);
+  ColumnSet* set = grid_layout->AddColumnSet(0);
+  set->AddColumn(GridLayout::FILL, GridLayout::FILL, 0, GridLayout::USE_PREF, 0,
+                 0);
+  grid_layout->StartRow(0, 0);
+  LayoutOnAddView view;
+  EXPECT_DCHECK_DEATH(grid_layout->AddView(&view));
+  // Death tests use fork(), so nothing should be added here.
+  EXPECT_FALSE(view.parent());
+
+  // If the View has nothing to change, adding should succeed.
+  view.set_target_size(view.GetPreferredSize());
+  grid_layout->AddView(&view);
+  EXPECT_TRUE(view.parent());
+
+  RemoveAll();
+}
+
 }  // namespace views